## HW4

Previewing page *1*
of
actual document.

**View the full content.**View Full Document

## HW4

0 0 89 views

- Pages:
- 4
- School:
- University of California, Los Angeles
- Course:
- Comsci M151b - Computer Systems Architecture

**Unformatted text preview: **

4 7 4 7 1 The instruction is 101011 00011 00010 0000000000010100 opcode is 101011 rs is 00011 rt is 00010 instruction address is 0000000000010100 To sign extend the address we have to add the most significant bit which is 0 so the output is 0000 0000 0000 0000 0000 0000 0001 0100 A jump instruction is 28 bits and since we re only considering 26 bits 32 bits minus 6 bits for the opcode we have 00 0110 0010 0000 0000 0001 0100 And so to shift left 2 we ll get 28 bits which is 0001 1000 1000 0000 0000 0101 0000 4 7 2 The values of the ALU control unit s inputs are The ALU will take the lower 6 bits 010100 The main control will take take bits 31 26 which is 101011 4 7 3 The PC will have PC 4 as its new address The path that will be taken 1 The PC register s value is moved to the adder The adder will add 4 to the PC value Hence the PC address will be PC 4 2 This value is moved to branch MUX 3 This value is moved to jump MUX 4 After the MUX the value is moved back to PC 4 7 4 The opcode of the instruction is 101011 which is SW Since it is not a branch instruction the branch address is PC 4 rt is 00010 so the write register input is 00010 The memory address for the SW instruction is calculated by adding rs and the instruction address The output of the MUX selects the sign extended version of the instruction so the decimal value is 20 Since it is a store instruction it doesn t read anything from the data memory 4 7 5 ALU 3 and 20 Add PC 4 PC and 4 Add branch PC 4 and 20 4 4 7 6 Read register 1 input is 00011 Read register 2 input is 00010 Depending on the RegDst the value will be 0 or 1 and will determine whether the write register input is 00010 or 00000 Since SW instruction will not write anything on the registers the write register input is 0 1 blt instruction I format instruction We want to find out if rs is less than rt One of the ways we can do this is by using the ALU to subtract rt from rs One of the opcodes that the ALU has already derived is beq which does

View Full Document