beq
3,4,somewhere" to hexadecimal. Assume the instruction is at
decimal address 1020 and that the label "somewhere"
represents decimal address 996.
Since the PC register will have been incremented by four when the
instruction is executed, the target address will be 996 - 1024 =
-28, which must be divided by four to convert the distance from
number of bytes to number of words between the target and the PC.
Field Width Value Binary
Op code 6 4 000100
rs 5 3 00011
rt 5 4 00100
Address 16 -7 1111 1111 1111 1001
Binary instruction, 4 bits per group:
0001 0000 0110 0100 1111 1111 1111 1001
Hex: 1 0 6 4 F F F 9
1.23: 0x3F9D70A4 (last bit is rounded up)
We went over this one carefully in class on April 4.
You should have a matrix of four rows and three columns of SRAM
ICs. There are 25 Address lines; 23 go to each of the SRAMs, the
other two go to a 2x4 decoder, whose outputs go to the CS inputs of
all the SRAMS in a row. See the Memory
System Design web page for an example of how to label
everything.
| RegDst | Mem2Reg | RegWrite | ALUSelB | f | MemRead | MemWrite | |
|---|---|---|---|---|---|---|---|
| lw | 0 | 1 | 1 | 1 | 010 | 1 | 0 |
| sw | X
| X
| 0 | 0 | 010 | 0 | 1 |
| add | 1 | 0 | 1 | 0 | 010 | 0 | 0 |
| sub | 1 | 0 | 1 | 0 | 110 | 0 | 0 |
| and | 1 | 0 | 1 | 0 | 000 | 0 | 0 |
| or | 1 | 0 | 1 | 0 | 001 | 0 | 0 |
| slt | 1 | 0 | 1 | 0 | 111 | 0 | 0 |