Building a Datapath
Tom Kelliher, CS 240
Mar. 13, 2002
Homework due Wednesday. Exam Friday.
Read Section 5.3.
Multiplication.
- Overview of the implementation.
- Parts of the implementation.
Merging the parts: a simple implementation.
The general instruction cycle:
- Instruction fetch.
- Instruction decode.
- Register fetch.
- Operate.
- Register store or memory operation.
How do the steps of the cycle fit each of the three instruction classes:
arithmetic-logic, memory reference, branch?
A high level view of the implementation, in view of the instruction cycle:

- Datapath only.
- Is everything we need for our instructions here?
Strategy: Look at the major datapath components needed to execute each
class of instructions.
Hardware needed:
- Individual registers (PC).
- Register file.
- Memory (data memory).
- ALU.
- Sign extend, shift?
Common to all instruction formats.
Requirements:
- Store program.
- Remember which instruction is to be executed next.
- Fetch next instruction. (And store.)
Elements:
- A register for the PC.
- A memory for the program.
- An adder to update the PC.
Organization:

The adder is a hardwired ALU.
Requirements:
- Fetch two register operands.
- Operate.
- Store result back into a register.
Elements:
- A 32 word by 32 bit register file with two read ports and a write
port (read B-25--B-26).
- An ALU.
Organization:

Control signals: Write, ALU Control, Zero.
Requirements:
- Immediate mode arithmetic-logic instructions:
- Replace one source register with sign-extended immediate value.
- Memory reference instructions:
- Add base register and sign-extended offset.
- Transfer data
- Branch instructions:
- Compare register values.
- Conditionally update PC with PC + 4 + sign-extended, shifted
offset.
Elements: R-format elements plus:
- Substitution of a register source value with the immediate value.
- A data memory.
- A mechanism for loading a branch target address into the PC.
Organizations:
Immediate mode arithmetic-logic instructions:

Memory reference instructions:

Branch instructions:

Thomas P. Kelliher
Thu Feb 26 17:55:30 EST 2004
Tom Kelliher