Homework 3 Computer Organization
Due: noon Friday, 2/14/03
1) Draw a 4-bit register that is able to perform the following operations:
2) Use the handout on the register file to draw a complete (not just a one-bit slice) register file that has:
3) Consider the simple RISC Assembly Language:
Type of Instruction | Assembly Language | Register Transfer Language Description |
Memory Access | Load R1, Mem | |
Store R1, Mem | Mem[R1] | |
Move | Move R1, R2 | R1 R2 |
Move R1, #100 | R1 100 | |
Arithmetic Instruction (reg. operands only) |
Add R1, R2, R3 | R1 R2 + R3 |
Sub R1, R2, R3 | R1 R2 - R3 | |
Conditional Branch |
Compare R1, R2 | Sets condition codes |
BGT LABEL (BLT, BLE, etc. too) |
Branch to LABEL if conditions codes are set for < | |
Unconditional Branch |
B LABEL | Always Branch to LABEL |
What would the assembly language code for each of the programming statements be?
a) if (R2 < R3) then . else . end if |
b) while (R2 < R4 and R2 >= 0) do . . . end while |
c) repeat . . . until (R2 < R3) |
d) for R2 = 0 to 100 by steps of size 5 do . . . end for |