Building a Datapath
Tom Kelliher, CS 220
Nov. 7, 2005
Homework due Wednesday.
Read 6.1.
Logic design, overview of MIPS datapath.
- Building separate datapaths.
- Merging the datapaths.
- The control unit.
Introduction to pipelining.
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.
- An ALU.
Organization:
Control signals: Write, ALU Control, Zero.
Requirements:
- 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:
Memory reference instructions:
Branch instructions:
Recall instruction formats:
Merged datapath, with control shown:
- RegDst -- selects rt or rd field as write address.
- RegWrite -- write enable.
- ALUsrc -- selects rd2 or immediate data.
- PCSrc -- selects PC + 4 or branch target.
- MemRead -- read enable.
- MemWrite -- write enable.
- MemToReg -- selects ALU output or memory data to register file write
data port.
- Is it combinational or sequential?
- Why are its only inputs the opcode bits?
How should the control signals be set (0, 1, x) for each of the following?
- R-format instructions.
- lw.
- sw.
- beq.
Thomas P. Kelliher
2005-11-08
Tom Kelliher