Nstruction Datapath
Nstruction Datapath
Computer Architecture
1
Instruction Datapath
4
Instructions will be held
in the instruction
Add
memory
The instruction to fetch
PC Read address is at the location
Instruction
Instruction
specified by the PC
Memory Instr. = M[PC]
• After we fetch one
instruction, the PC must be
Note: Regular instruction width incremented to the next
(32 for MIPS) makes this easy instruction
• All instructions are 4 bytes
• PC = PC + 4
2
R-type Instruction Datapath
Read reg. num AA
reg num
Read reg data A
Instruction Read reg num B
Zero
Registers Result
Write reg num
Read reg data B ALU
Write reg data
3
Memory Operations
Read reg. num AA
reg num Read address
Read reg data A
Instruction Read reg num B Data Memory
Zero Read data
Registers
Result Write address
Write reg num
Read reg data B
Write data
Write reg data
16 sign 32
extend
offset 16 sign 32
• Add this to PC+4 (from
extend
PC logic)
• Control logic has to
decide if the branch is
taken
– Uses ‘zero’ output of
ALU 5
Integrating the R-types and Memory
Datapath
16 sign 32
extend
6
Adding the instruction memory
4 Simply add the instruction memory
Result and PC to the beginning of the datapath.
Add
16 sign 32
extend
7
Adding the Branch Datapath
0
4
Result 1
Result
Sh. Add
Add Left
2
16 sign 32
extend
Now we have the datapath for R-type, I-type, and branch instructions.
On to the control logic!
8
When does everything
happen? 0
4 Result 1
Result clk Sh. Add
Left
Add 2 Single-Cycle Design
Read reg. num AA
reg num Read address
Read reg data A
Read address
Read reg num B Data Memory
PC Zero Read data
Registers 1
Instruction [31-0] Result Write address
Write reg num
Instruction Read reg data B 0 0
Write data
Memory Write reg data 1
clk
16 sign
extend
32
clk
Combinational Logic:
Just does it! Outputs are
always just a function of its Registers: Written at the end of the clock cycle.
inputs (with some delay) (Rising edge triggered).
9
What do we need to control? Mux - are we
branching or not?
Registers- 0
4 Should we
Result 1
write data? Mux - Result from
Result Sh. Add
Add
Left ALU or Memory?
2
16 sign 32
Mux - Where
extend Memory-
does 2nd ALU ALU - Read/Write/neither?
operand come What is the
from? Operation?