CS251 - Computer Organization and Design - Spring 2008
Lecture 15 - Data Flow
Practical Details
- Read 5.1 to 5.4, C.2
Instruction Execution Components
The more you can keep them separate the more you can
Instruction Fetch
Sequence
- Signal to fetch
- Read cycle to instruction memory with PC as address
- Increment PC by 4 (combinational logic)
Often there is a FIFO
Datapaths
- PC to memory
- PC to adder
- Adder to PC
- Instruction to next stage
Decode Instruction and route the parts accordingly
Instruction Types
- Register instructions
- Memory instructions
- Branch instructions
Register (R-type) Instructions
Arithmetic, logical
- Need two arguments, one destination, all are data
Details
- Argument parts of instruction select read and write registers
- ALU part of instruction selects operation of ALU
- Register file has two read outputs determined by two selector
- Register file has one write input, determined by a third selector
Sequence
- Read arguments of instruction put register values on path to ALU
input
- ALU part of instruction selects the combinational logic function to be
applied
- Result appears on ALU output
- ALU output written to register selected by argument
Datapaths
- Instruction to register file
- Instruction to ALU
- Register file to ALU input
- ALU output to register file
Memory Instructions
Register to/from memory
- need data, address
- data in register
- address = register value plus offset
Details
- Offset in last 16 bits of instruction
Sequence
- Get arguments from registers
- address register to ALU
- data register to write port of memory
- Add offset to address is ALU, send result to memory address
- Read/Write
- write pushes data into write port
- read flushes data out of read port
- If read data latched into register
Datapaths
- Instruction to register file
- Instruction to ALU
- Register file to memory write port
- Register file to ALU
- ALU to memory address
- Memory read port to register file
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
Return to: