【问题标题】:64 registers using MIPS architecture with 15 bits length使用 MIPS 架构的 64 个寄存器,长度为 15 位
【发布时间】:2016-01-05 00:30:56
【问题描述】:

我有一个任务要做,它会问以下问题: 我们有 64 个寄存器,它们的所有命令都有 15 位长度。 它还指出我们在编译它们(将它们转换为机器语言)后得到了以下内容。 7 个指令参考 2 个寄存器,60 个指令参考 1 个寄存器。它询问我们可以有多少没有寄存器引用的命令..

这是我的想法,但似乎我有问题。

Since this is mips architecture each of the commands we use (add,all etc) will be using 32bits where for the r instructor we have:
opcode(6bits),rs(6bits),rt(6bits),rd(6bit),shamt(5bit),func(3bit)
because it says that we have 64 registers so we need 6 bits for each and the func is 3 due to the fact that we have max 7 functions.So in the case for example of all we have the following 
000000->opcode
000000->rs
6bit-> rt
6bit-> rd
5bit-> shame
3bit-> the function.

这是正确的还是我错过了什么?也许我们不应该使用 r 指导员而是 i?当我们有 60 个命令和 1 个寄存器引用时,第二次操作会发生什么?哪个讲师实际上只能将一个寄存器作为参数?一些帮助将不胜感激,谢谢

【问题讨论】:

  • “我们有 64 个寄存器,它们的所有命令都有 15 位长度。” 嗯? 什么有 15 位长度?
  • 一些只有一个寄存器操作数的 MIPS 指令示例:jrbltzlui
  • 这就是我自己在看的东西。也许寄存器最多只能占用 15 位?这就是我卡住的地方。作业说明了这些:假设我们有一个 cpu,它有 64 个寄存器,其命令长度为 15 位。也许它说嘿我每个寄存器只能存储 15 位?但这有点不清楚......
  • @Michael 我可以问你,因为我是个菜鸟,如果 0 注册是 j 教练吗?

标签: assembly 32bit-64bit cpu-architecture opcode


【解决方案1】:

我怀疑这是在谈论 mips,它是在谈论您将要设计的虚构架构 :)

具有 2 个寄存器的 7 个命令需要 3+6+6=15 位,因此使用所有可用位。幸运的是,它确实留下了 1 个免费的操作码来编码其他指令 :) 假设 000b 用于那些。

这意味着,对于其余的指令,我们只剩下 12 位(因为前 3 位是000)。要编码 60 条指令,我们需要 6 位,另外 6 位用于寄存器,这样又会占用所有空间。

但是,我们仍然有 4 个免费的操作码,我们可以将它们全部用于没有操作数的指令,当然我们仍然有以前用于寄存器的 6 位,所以我们可以编码 4*64=256 指令不带任何操作数。

000 000000 xxxxxx = no operand block #1 with 64 instructions
000 000001 xxxxxx = no operand block #2 with 64 instructions
000 000010 xxxxxx = no operand block #3 with 64 instructions
000 000011 xxxxxx = no operand block #4 with 64 instructions
000 000100 rrrrrr = first instruction with 1 operand
000 111111 rrrrrr = last instructon with 1 operand (60 total)
001 ssssss tttttt = first instruction with 2 operands
111 ssssss tttttt = last instruction with 2 operands (7 total)

【讨论】:

  • 这是我的第一个想法,但后来我认为嘿,如果对于第一个示例我们有 15 位,那么寄存器为 6 +6,函数为 3,我们将没有操作码。所以你说我们只是避免 r 教练的功能?
  • 我也可以问你为什么写000b吗? b 应该是什么?很抱歉问你一些无聊的问题,我只是想更好地了解计算机体系结构。起初我的错误是,对于 7 个命令,我认为不是剩下的 3 位作为操作码,而是我认为它们是 func(r 指导员),使操作码为空,我想嘿,你可以拥有操作码空...
  • 好吧,我明白了一切。如果你最后能解释一下 000b,我将不胜感激!
  • b 只是在不清楚时表示二进制的后缀:)
  • 我明白了。非常感谢。非常感谢您的帮助!
猜你喜欢
  • 2014-01-05
  • 1970-01-01
  • 2019-04-21
  • 2014-02-05
  • 1970-01-01
  • 2022-01-04
  • 1970-01-01
  • 2016-01-18
  • 2019-04-20
相关资源
最近更新 更多