Beruflich Dokumente
Kultur Dokumente
BUILDING A DATAPATH
Datapath element - A funtional unit which is used to operate on or hold data within a pracessor. 1 . Program counter [ PC ] - The register which holds the address of current instruction.
PC
Instruction Memory
Memory unit to store instructions of a program and supply instructions given an address.
Instruction Fetching
The CPU is always in an infinite loop, fetching instructions from memory and executing them. The program counter or PC register holds the address of the current instruction. MIPS instructions are each four bytes long, so the PC should be incremented by four to read the next instruction in sequence.
Register File Our register file stores thirty-two 32bit values. Each register specifier is 5 bits long. You can read from two registers at a time. RegWrite is 1 if a register should be written.
Heres a simple ALU with five operations, selected by ALU control signal which is 4 bits wide.
1. Read an instruction from the instruction memory. 2. The source registers, specified by instruction fields rs and rt, should be read from the register file. 3. The ALU performs the desired operation. 4. Its result is stored in the destination register, which is specified by field rd of the instruction word.
R Type
instruction memory. 2. For an instruction like lw $t0, 4($s2), the base register $s2 is added with the sign-extended constant [ 4 ] to get a data memory address. 5.Data is read from data memory by supplying an address. 4. Its result is stored in the destination register, which is specified by field rt of the instruction word.
rs
rt
Need of Multiplexors
The arithmetic and logical instructions use the ALU with inputs coming from two registers.The memory instructions use ALU to do address calculation. 1 input register , 2nd input sign extend. The value stored into destination register comes from ALU(R Type instructions) or memory (load).
Branching Hardware
Final Datapath
rs rt rd
Lw instruction datapath
Sw instruction Datapath
J - Format 31 26 Op 25 address o
For j instruction
Function AND
0111
1100