Can you please give the machine code output for eachsection?
Example:
add r3,r2,r1
This instruction add r2 and r1 and result stored to r3.
This is R -type instruction,
Opcode Rs1(5 bits) Rs2(5bits) Rd(5 bits) Function(11bits)Opcode = 000000
Rs1 = r2 = 00010
Rs2 = r1 = 00001
Rd = r3 = 00011
Function = 00000 100000 (For ADD )
So instruction format is,
000000 00010 00001 00011 00000100000Machine code = 0x00411820
1) (40 pts) Using all the given DLX handouts, give the machine code of each of the following instructions: (assuming that the current instruction is located in memory with it address equal to 0x000024ac) a) sub r3,r5,r7 b) addi r2,r4,#–21 c) lhi r7,#0x3ca0 (LHI follows the ALU-immediate instruction format) d) jal sub (sub is the starting address label of the subroutine to jump to with its value equal to 0x00004134) e) sh -16(r5),r13 f) beqz r3, target (target equals an address of x00001c38) g) slti r7,r3,#-3 h) srl r3,r4,r5
Can you please give the machine code output for each section? Example: add r3,r2,r1 This instruction add r2 and r1 and r
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am