CS251 - Computer Organization and Design - Spring 2008
Lecture 17 - Data Flow
Practical Details
- Assignment 4
- Friday's class
Instruction Execution Components
Branch/Jump Instructions
Branch
Will change program counter if condition is true
Needs
- two registers to compare data
one address to branch to: in the code, Why?
Details
- branch target in low 16 bits of instructions
- but target can be up to 2^18
Sequence
- Instruction arguments to register file
- Branch target to sign extender to shifter
- Data from register file to ALU
- ALU calculates result
- Shifted output and PC + 4 to adder
- Target on output of adder
Datapaths
- Instruction to register file
- Instruction to sign extender to shifter to adder
- PC + 4 to adder
- Register file to ALU
- Adder and ALU to branch control logic
Put It All Together
Instruction fetch
- PC
- Instruction memory
- Adder: no longer goes straight to PC, but is output (branch)
Control: none
R-type instruction
- Registers
- read1 -> ALU
- read2 -> ALU
- write: needs a MUX because sometimes the second one comes here
(load)
- ALU
Control signals:
- Clock
- Regwrite
- ALU operation select (3)
I-type instructions
Load/store
- Registers
- read1 -> ALU for address calculation
- read2 -> memory with data to be written
- write -> needs a MUX, might be
- third register field (R-inst)
- second register field (I-inst)
- Sign extender
- ALU: combines read1 and sign-extended immediate
- Data memory: needs a MUX on output
- could be load
- could be ALU output
Control signals
- Regwrite
- ALUctl (3)
- MemRead
- MemWrite
- MemToReg
Conditional branch
- Registers
- read1 -> ALU
- read2 -> ALU
- ALU:
- zero output
- needs a MUX on input
- could be sign extended instruction for load/store
- could be read2 for r-type
- Sign extender:
- Shifter
- Adder: MUX needed on output
Control signals
- ALUctl
- PCSrc
- ALUSrc
Control Logic
Highest six bits of instruction is opcode
- For opcode 0, lowest six bits select function
Control logic needs to accept opcode (26:31) and function (0:5)
- and output all the control signals
Split into two stages
- From opcode only generate all control signals except ALUctl, plus
ALUop
- From ALUop plus function generate ALUctl
Climax
The CPU plus memory is just a finite state machine,
albeit a complex one.
Return to: