| PC |
- Next Address from BEQ Logic
|
- PC to read address of Instruction Memory
- PC + 2 to next address for BEQ Logic
|
| Instruction Memory |
|
- 16-bit Instruction splits into
- Bits 12-15 go to the Control Unit
- Bits 8-11 go to Read Addr 1 of Register File
- Bits 4-7 go to:
- Read Addr 2 of Register File
- Register File Write Addr Mux
- Bits 0-3 go to:
- Register File Write Addr Mux
- Sign extend to 16 bits and then:
- ALU 2nd Operand Mux
- Shift left 1 into Offset for BEQ Logic
|
| Control Unit |
- Bits 12-15 of Instruction
|
- Reg Write signal goes to Write Enable of Register File
- ALU Control signal goes to control inputs of ALU
- Branch signal goes to BEQ Logic Branch input
- Mem Store signal goes to Write Enable of Data Memory
- Mem signal goes to:
- Register File Write Addr Mux
- ALU 2nd operand Mux
- ALU/Memory result Mux
|
| Register File |
- Read Addr 1 from bits 8-11 of Instruction
- Read Addr 2 from bits 4-7 of Instruction
- Write Addr from Register File Write Addr Mux (either bis 0-3 or 4-7
of instruction)
- Write Data from Final Result Mux (either ALU Result or Data Memory
Read Data output)
- Write Enable from Reg Write output of Control Unit
|
- Read Data 1 goes to ALU 1st Operand
- Read Data 2 goes to:
- The ALU 2nd operand Mux (along with sign-extended instruction
bits)
- The Write Data input for Data Memory
|
| Arithmetic Logic Unit (ALU) |
- 1st operand from Read Data 1 of the Register File
- 2nd operand from the ALU 2nd operand Mux (either Read Data 2 from
the Register File or bits 0-3 of the instruction after sign extension to
16 bits)
- ALU Control output from Control Unit
|
- 16-bit result goes to:
- Address input for Data Memory
- Final Result Mux (along with Read Data from Data Memory)
- Zero flag goes to Zero input to BEQ Logic
|
| Data Memory (RAM) |
- Read Address from ALU result
- Write Data from Register file Read Data 2 output
- Write Enable from Control Unit Mem Store signal
|
- Read Data result goes to Final Result Mux (along with ALU
result)
|
| BEQ Logic |
- Next Address from PC + 2
- Offset from bits 0-3 of instruction after sign extend and shift left
by 1
- Branch from Control Unit
- Zero from ALU Zero Flag
|
- Adds PC + 2 and Offset inputs and then selects that result or the
original PC + 2 result using an AND between the Branch and Zero inputs.
Takes this result as the Next Address and feeds it back to the PC.
|