简体   繁体   English

将以下MIPS指令转换为32位指令

[英]Translate the following MIPS instructions into 32 bit instructions

I'm trying to translate the following MIPS instructions into 32 bit machine code (using Big-endian): 我正在尝试将以下MIPS指令转换为32位机器代码(使用Big-endian):

swc1 $f1 8($t0)

What I did was: 我所做的是:

111001 00001 01000 00001000

I'm only sure about the translation of swc1, but not the others. 我只知道swc1的翻译,而其他人则不确定。 I've googled a lot but couldn't find the number of $f1. 我在Google上搜索了很多,但找不到$ f1的数量。 I also read this thread: Link to a similar question However I'm still not sure if I should use 00001 for $f1. 我也阅读了该线程: 链接到类似的问题但是,我仍然不确定是否应该为$ f1使用00001。 As for the machine code of offset 8 and $t0, am I doing it right? 至于偏移量8和$ t0的机器代码,我做对了吗?

Since instructions are 32 bit, the machine code format has space for a 16 bit immediate, as follows: 由于指令是32位的,因此机器码格式具有立即16位的空间,如下所示:

111001 Rs[5] Ft[5] Offs[16]

(The numbers in brackets indicate bit counts.) (括号中的数字表示位数)。

Note that $t0 is register #8, and $f1 is indeed register #1. 注意$t0是寄存器#8,而$f1实际上是寄存器#1。 As such your instruction is: 因此,您的指示是:

111001 01000 00001 0000000000001000
= 1110 0101 0000 0001 0000 0000 0000 1000 = E5 01 00 08

You can of course verify it using a trusted assembler: 您当然可以使用受信任的汇编程序来验证它:

1 0000 E5010008      swc1 $f1, 8($t0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM