选择I和D缓存大小作为MIPS程序

发布于 2025-01-30 06:02:59 字数 110 浏览 2 评论 0原文

我编写了一个MIPS程序,总共有36个说明。我认为最适合选择具有32个单词的I-Cache大小,因为所有说明都可以缓存。

我不明白如何选择D-CACHE,我应该计算从/到内存读取或写入多少次?

I have written a MIPS program that has a total of 36 instructions. I think it's most suitable to choose a I-cache size with 32 words because all the instructions can be cached.

I don't understand how I would choose the D-cache, should I count how many times I read or write from/to memory?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野稚 2025-02-06 06:02:59

它不是读取 /写入的原始计数,而是程序的每个算法部分访问的数据存储器的大小(该算法的部分(代码花费时间的代码部分)。

名义上,将整个程序的数据集保存在缓存中是不错的,但是如果程序中的算法一次在一个较小的数据集上工作,则称为a 工作集,较小的缓存仍然可以很好地工作。

工作集的概念可以适用于多级缓存设计中的每个高速缓存以及虚拟内存分页。

最小化工作集大小的编写算法是整个主题,无论是针对某些特定的缓存大小/层次结构还是更广泛地称为缓存遗漏算法

但是,大多数程序都根据输入数据来改变其行为(时间&内存)。 与小输入数据集提供的相同程序相同的程序通常具有截然不同的高速缓存要求。

因此,要真正知道您需要什么缓存大小,您需要了解数据,这可能会了解程序输入。

It is not the raw count of reads / writes, but rather the size of the data memory that is accessed for each algorithmic portion of the program (the sections of the code where it spends its time).

Nominally, holding the whole program's data set in the cache is good, but if the algorithms in the program work on smaller portions of the data set at a time, called a working set, a smaller cache will still work well.

The notion of working set can apply to each level of a cache in multilevel cache designs as well as to virtual memory paging.

Writing algorithms that minimize working set sizes is an entire subject matter, whether targeting some specific cache sizes/hierarchies or more broadly, called cache oblivious algorithms.

However, most programs vary their behaviors (time & memory) based on input data.  The same program supplied with small input data set vs. large input data set will generally have very differing cache requirements.

So, to really know what cache size you'll need, you need to understand the data, which may go to understanding the program input.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文