In: Computer Science
Convert in machine code for MIPS
LW S5, 33(S2);
Add R1, T3, S5;
Sub T4, S3, R3;
SW T4, 124(T7);
Mips machine code conversion of
LW S5, 33(S2)
Syntax: |
lw $t, offset($s) |
Encoding: |
|
So here S5 is register r21 and S2 is r18
So source = S2 = 10010
Target S5 = 10101
Off set = 33 = 0000000000100001
Machine code = 10001110010101010000000000100001 = 0x8E550021
Add R1, T3, S5;
Syntax: |
and $d, $s, $t |
Encoding: |
|
source = t3 = r11 = 01011
Target =S5 =r21 = 10101
Destination = r1 = 00001
Machine code = 00000001011101010000100000100100 = 0x01750824
Sub T4, S3, R3;
Syntax: |
sub $d, $s, $t |
Encoding: |
|
source = s3 = r19 = 10011
Target =r3 = 00011
Destination = t4 = r12 = 01100
Machine code = 00000010011000110110000000100010 = 0x02636022
SW T4, 124(T7);
Syntax: |
sw $t, offset($s) |
Encoding: |
|
Source = t7 = r15 = 01111
Target = t4 = r12 = 01100
Offset = 124 = 0000000001111100
Machine code = 10101101111011000000000001111100 = 0xADEC007C