如何分配内存来存储寄存器号?(how to allocate memory to store register number?)

编程入门 行业动态 更新时间:2024-10-28 12:26:09
如何分配内存来存储寄存器号?(how to allocate memory to store register number?)

我了解到,指定64个寄存器中的一个的寄存器字段需要6位。

因为64 = 2 6

但是我们不必考虑最右边的位?,即2 0 ,在这种情况下,我们需要7位来指定64个寄存器中的一个。

I learned that a register field to specify one out of 64 registers takes 6 bits.

since 64 = 26

but don't we have to consider the right most bit ?, which is 20, in which case we require 7 bits to specify one out of 64 registers..

最满意答案

如果只有一个可能的值,则根本不需要任何位。 如果你有一位,它有两个可能的值。

因此,如果只有一个寄存器,则根本不需要任何位来选择它。 如果有两个寄存器,则需要一位 - 该位为零可以选择一个寄存器,另一个寄存器。

继续,如果你有两个位,它们有四个可能的值。 如果有三位,则它们有八个可能的值。 上升,六位有64个可能的值,因此足以选择64个寄存器中的一个。

If there is only one possible value, you need no bits at all. If you have one bit, it has two possible values.

So if there was only one register, no bits would be needed at all to select it. If there were two registers, you'd need one bit -- a zero in that bit could select one register, a one the other.

Continuing, if you have two bits, they have four possible values. If you have three bits, they have eight possible values. Going up, six bits has sixty-four possible values, so that's sufficient to chose one of sixty-four registers.

更多推荐

本文发布于:2023-07-14 17:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1106068.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:寄存器   分配   内存   allocate   number

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!