A Simple Implementation
Tom Kelliher, CS 240
Mar. 29, 1999
Focus upon individual parts of the datapath.
- Simple execution example.
- Drawing the pieces together.
- Understanding the control hooks.
The control unit.
Consider a simple datapath:
- Straight-line execution only.
- Four word program memory.
- Four word register file.
- Simple ALU.
Show the execution of the following C statement:
d = a + b - c;
Fake the control signals. Assume the following instruction format:

Important points:
- State changes on falling clock edge.
- Propagation delays:
- Memory read: 50 ns.
- Register file read: 10 ns.
- ALU operation: 10 ns.
- Register file write set-up: 3 ns.
- Assume a 100 ns clock period.
Is the clock period optimal? (What part of the propagation did we forget?)
Reconcile the various facets of the datapath design. The final result:

Instructions implemented:
- lw, sw.
- beq.
- add, sub, and, or, slt.
Recall ALU control inputs:
- 000 --- AND.
- 001 --- OR.
- 010 --- add.
- 110 --- subtract.
- 111 --- slt.
ALU op signals:
- 00 --- lw, sw.
- 01 --- beq.
- 10 --- R-format.
Funct field for R-format instructions:
- 100000 --- add.
- 100010 --- subtract.
- 100100 --- and.
- 100101 --- or.
- 101010 --- slt.
Truth table for ALU control outputs?
- 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.
Thomas P. Kelliher
Sun Mar 28 22:16:42 EST 1999
Tom Kelliher