内存层次结构-为什么寄存器价格昂贵? [英] Memory Hierarchy - Why are registers expensive?

查看:631
本文介绍了内存层次结构-为什么寄存器价格昂贵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解:

更快访问时间> 更多昂贵

较慢访问时间> 较少昂贵

我还了解到寄存器是层次结构的顶部,并且具有最快的访问时间.我很难研究的是为什么这么贵?据我所知,寄存器实际上是直接内置到ALU中的电路.如果它们实际上是内置在CPU中的(特别是ALU),实际上是什么使它最昂贵?

I also understand that registers are the top of the hierarchy, and have the fastest access time. What I am having a hard time researching is why it's so expensive? To my knowledge, registers are literally circuits built directly into the ALU. If they're literally built into the CPU (the ALU especially), what actually makes it the most expensive?

是大小吗(当然是最小的)?

Is it the size (registers being the smallest, of course)?

推荐答案

寄存器非常非常昂贵,因为它们必须非常非常快,并且需要同时从许多地方进行访问.

Registers are very, very expensive because they have to be very, very fast and they need to be accessed from many places simultaneously.

例如,如果您有语句a = a + x; b = b + x; c = c + x;您有三个指令都想读取相同的寄存器.因此,寄存器不仅仅是存储器.还有所有数据路径都需要在处理器中,因此来自保存x的寄存器的相同数据可以同时发送到三个指令.数据可以到达很多地方.如果写成双倍a = x;并且x是整数,则必须有一条将寄存器x发送到浮点单元的数据路径.或向量单位.等等.

For example if you have statements a = a + x; b = b + x; c = c + x; you have three instructions which all want to read the same register. So the register is not just the memory. There are also all the data paths that need to be in the processor so the same data from the register holding x can be sent to three instructions at the same time. And the data can go to many, many places. If you write double a = x; and x is an integer, then there must be a data path that sends the register x to the floating point unit. Or to a vector unit. And so on.

然后,您将面临一个问题,即不仅需要存储数据,还必须确保数据可用.如果写x = y + z; a = a + x;当第一个指令运行时,必须有人跟踪保存x的寄存器在存储加法结果之前是无效的,并停止第二个加法运算的运行.那太贵了.

Then you have the problem that not only to you need to store the data, you also must make sure that it is available. If you write x = y + z; a = a + x; someone must keep track when the first instruction runs that the register holding x is not valid right now until the result of the addition is stored, and stop the second addition from running. That is super expensive.

因此,建立寄存器不仅仅是增加一点内存,还需要付出很多.寄存器对于处理器的速度至关重要,因此使用了最昂贵,最快的技术来构建它们.

So there is much more to building a register than just adding a bit of memory, and that needs to be paid for. And registers are so essential to the speed of the processor, that the most expensive and fastest technology is used to build them.

这篇关于内存层次结构-为什么寄存器价格昂贵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆