MIPS I 指令立即域 [英] MIPS I instruction immediate field

查看:69
本文介绍了MIPS I 指令立即域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该字段由算术和条件分支指令使用.

The field is used by arithmetic and conditional branch instructions.

第一个问题是:

可以存储在立即算术指令和条件分支中的值的范围是多少?

What would be the range of values which can be stored in an immediate arithmetic instruction and conditional branch?

第二个是:

如果 MIPS 处理器有 64 个寄存器,您将如何更改立即指令格式以引用这些寄存器?我将如何绘制和标记格式?

if a MIPS processor has 64 registers, how would you change the immediate instruction format to reference these registers? How would I draw and label the format?

推荐答案

第 1 部分:

如下图所示:

I-Type 指令为立即数字段保留了 16 位.这当然意味着立即数字段可以采用 216 个可能的值.如果我们考虑立即数字段可以是正数或负数(1 位用于符号),我们可以看到最大值为 215 - 1,最小值为 -(215 - 1).

The I-Type instruction has 16 bits reserved for the immediate field. This of course means that the immediate field can take on 216 possible values. If we consider that the immediate field can be positive or negative (1 bit is used for the sign) we can see that the max would be 215 - 1 and the min would be −(215 - 1).

第 2 部分:

再一次,查看上图我们可以看到 rs 和 rt 寄存器被指定为 5 位.这是因为 mips 指令集中有 32 个寄存器——即 25.如果有 64 个寄存器,那么 rs 和 rt 字段都需要 6 位长,因此立即字段只剩下 14 位.

Again, looking at the diagram above we can see that the rs and rt registers are specified with 5 bits. This is because there are 32 registers in the mips instruction set — i.e. 25. If there were instead 64 registers, both the rs and rt fields would need to be 6 bits long, thus leaving only 14 bits for the immediate field.

这篇关于MIPS I 指令立即域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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