64 个寄存器,使用 MIPS 架构,长度为 15 位

64 registers using MIPS architecture with 15 bits length

我有一个作业要完成,它会问以下问题: 我们有 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 instructor 而应该使用 i?当我们有 60 个命令和 1 个寄存器引用时,第二个操作会发生什么?哪个讲师实际上只能将一个寄存器作为参数?如果能提供一些帮助,我们将不胜感激,谢谢

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

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

这意味着,对于其余的指令,我们只剩下 12 位(因为前 3 位是 000)。要编码 60 条指令,我们需要 6 位,另外 6 位用于寄存器,因此再次用完所有 space.

但是,我们仍然有 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)