Академический Документы
Профессиональный Документы
Культура Документы
Combinational logic
State element 2
clock
Datapath
17-2
Fetch
o To execute an instruction,
we must first fetch it from memory . . . o . . . and then increment the program counter (PC) to point to the next instruction.*
Instruction
op
6 bits
rs
5 bits
rt
5 bits
rd
5 bits
shamt
5 bits
funct
6 bits
function code
*R-type (for register) or R-format include add, sub, and, or, and slt.
Datapath 17-4
000000
6 bits
10001
5 bits
10010
5 bits
01000
5 bits
00000
5 bits
100000
6 bits
function code
Datapath
17-5
Datapath
17-6
Instruction
5 5 32
Read Data 2
32
ALU
*An explict RegWrite line is shown as data is not necessarily written back to the register file on every operation.
Datapath 17-7
lw $t0, 1200($t1)
instruction operation or opcode destination register offset
base register
op
6 bits
rs
5 bits
rt
5 bits
constant or address
16 bits
still 32 bits
lw $t0, 1200($t1)
instruction operation or opcode destination register offset
base register
100011
6 bits
01001
5 bits
01000
5 bits
still 32 bits
lw $t0, 1200($t1)
Control Unit RegWrite 5 Read Addr 1 Read Addr 2 Write Addr Write Data 16 Read Data 2 Read Data 1 32 32 Address 4 ALU control MemWrite
Instruction
5
ALU
Data Memory
32 Write Data
Read Data
Sign Extend
32
MemRead 32
Datapath 17-10
Read Read Addr 2 Data 1 Write Addr Write Data Read Data 2 ALU
Datapath
17-11
While an . . .
I-format instruction like lw $t0, 1200($t2) wants . . .
RegWrite
Read Addr 1
Read Read Addr 2 Data 1 Write Addr Write Data Read Data 2
Sign 16 Extend
32
MemRead
Everyone is happy . . .
. . . by the addition of three muxs (guided by the munificent control unit)
RegDst RegWrite
Read Addr 1
MemWrite
MemtoReg
Read Read Addr 2 Data 1 Write Addr Write Data Read Data 2 ALU
Sign 16 Extend
MemRead
32
Datapath 17-13
000100
6 bits
10001
5 bits
10010
5 bits
still 32 bits
Datapath 17-14
Sign 16 Extend
32
Datapath 17-15
Sign 16 Extend
32
Datapath 17-16
Add
RegDst
RegWrite
Read Addr 1
Read Read Addr 2 Data 1 Write Addr Write Data Read Data 2 ALU
Sign 16 Extend
MemRead
32
Datapath 17-17
instruction to perform ALU, register file, and memory read/write operations, o . . . and to control the flow of data through multiplexer inputs, o . . . and to select proper registers.
Datapath 17-18