【发布时间】: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 指令示例:
jr、bltz、lui。 -
这就是我自己在看的东西。也许寄存器最多只能占用 15 位?这就是我卡住的地方。作业说明了这些:假设我们有一个 cpu,它有 64 个寄存器,其命令长度为 15 位。也许它说嘿我每个寄存器只能存储 15 位?但这有点不清楚......
-
@Michael 我可以问你,因为我是个菜鸟,如果 0 注册是 j 教练吗?
标签: assembly 32bit-64bit cpu-architecture opcode