I'm trying to translate the following MIPS instructions into 32 bit machine code (using 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. I've googled a lot but couldn't find the number of $f1. I also read this thread: Link to a similar question However I'm still not sure if I should use 00001 for $f1. As for the machine code of offset 8 and $t0, am I doing it right?
Since instructions are 32 bit, the machine code format has space for a 16 bit immediate, as follows:
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. 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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.