Mips to Machine Code, and Machine Code to Mips (Procedures will be preferred!) M
ID: 3922146 • Letter: M
Question
Mips to Machine Code, and Machine Code to Mips
(Procedures will be preferred!)
MACHINE CODE MIPS Convert each of the following 32-bit machine code instructions into a MIPS instruction. Formatting: use register names in your final answer, e.g. $to instead of $8 For all questions, you can assume PC+4 = 0x0040004 and we have the following labels: func1: 0x0040000c func2: 0x00400014 func3: 0x0040002c problem (1 point possible) 0xA2 6 8000A. (Recall PC+4 Ox0040004, func 1 : 0x0040000c, func2: 0x0 0 4 0 0 0 14 , func3: 0x0040002c) sb $t0 0x000A $s3 CHECK problem (1 point possible) 0x00851026 (Recall PC+4 0x0 040004, func1: 0x0040000c, func2: 0x00400014, func 3 : 0x0040002c) 2 CHECK problem (1 point possible) 0x0C100005 (Recall PC+4 0x0 040004, func1: 0x0040000c, func2: 0x00400014, func 3 : 0x0040002c) 2 CHECK problem (1 point possible) 0x00008A03 (Recall PC+4 0x0 040004, func1: 0x0040000c, func2: 0:00400014, func 3 : 0x0040002c) 2 CHECKExplanation / Answer
1)
0xA268000A
in binary => 10100010011010000000000000001010
101000 10011 01000 0000000000001010
opcode(101000) = SB
register(10011) => $s3
register(01000) => $t0
0000000000001010 = 0x000A
Answer: sb $t0, 0x000A($s3)
2)
0X00851026
in binary => 00000000100001010001000000100110
000000 00100 00101 00010 00000 100110
first 6 bits are special bits in this case
opcode(100110) = xor
register(00100) = $a0
register(00101) = $a1
register(00010) = $v0
Answer: xor $v0, $a0, $a1
3)
0x0C100005
binary => 00001100000100000000000000000101
000011 00000100000000000000000101
opcode(000011) = jal
target adress = 00000100000000000000000101
Answer: jal 0x0100005
4)
0x00008A03
binary => 00000000000000001000101000000011
first 6 bits are special bits in this case
opcode(000011) = sra
register(00000) = $zero
register(10001) = $s1
01000 = 8
Answer: sra $s1, $zero, 8