Documente Academic
Documente Profesional
Documente Cultură
Chapter 5
Components of a Computer
Processor Control
Datapath
Processor Control
Datapath
Processor Control
000000 000000 100011 100011 101011 101011 000000
Memory
00000 00100 00010 00010 00010 00010 11111 00101 00010 01111 10000 10000 01111 00000 0001000010000000 0001000000100000 0000000000000000 0000000000000100 0000000000000000 0000000000000100 0000000000001000
Datapath
Processor
Control
000000 00100 00010 0001000000100000
Datapath
Control
000000 00100 00010 0001000000100000
Datapath
contents Reg #4 ADD contents Reg #2 results put in Reg #2
Memory
00000 00100 00010 00010 00010 00010 11111 00101 00010 01111 10000 10000 01111 00000 0001000010000000 0001000000100000 0000000000000000 0000000000000100 0000000000000000 0000000000000100 0000000000001000
Datapath
Fetch
Exec
Decode
7
Memory
Datapath
Processor
Two main components
Datapath Control
Design of Processor
1. Analyze the instruction set architecture 2. Select the datapath elements each instruction needs 3. Assemble the datapath 4. determine the controls required 5. Assemble the control logic
10
11
15
Instruction address Instruction Instruction memory a. Instruction memory b. Program counter c. Adder PC Add Sum
16
17
5 5 5
4 Read data 1
ALU operation
Register numbers
Data
Register File
Consists of a set of 32 registers that can be read and written
Registers built from D flip-flops
has two read ports and one write port Register number are 5 bit long To write, you need three inputs:
a register number, the data to write, and a clock (not shown explicitly) that controls the writing into the register The register content will change on rising clock edge
5 5 5
19
R-format
31-26 opcode
25-21 rs
20-16 rt
15-11 rd
10-6 shamt
5-0 funct
20
21
Memory Unit
MemRead
MemRead to be asserted to read MemWrite to be asserted to write Both MemRead and MemWrite not to be asserted in same clock cycle Memory is edge triggered for writes
Address
ReadData
Write Data
MemWrite
22
I-format
31-26
opcode rs
rt
offset
23
rt
offset
I-format
31-26
opcode rs
rt
offset
24
offset
I-format
31-26
opcode rs
rt
offset
25
rs
rt
31-26
C
25-21 rs
20-16 rt
15-0 C
26
opcode
If ($rs-$rt)=0, PC=PC+4+(C.4)
27
28
29
P C
Instruction Memory
30
31
ALU Operation
32
Instruction
RegDst
RegWrite
ALUSrc
MemRead
MemWrite
MemToReg
PCSrc
ALU operation
R-format
0000(and) 0001(or) 0010(add) 0110(sub) 0010 (add) 0010 (add) 0110 (sub)
lw sw beq
0 X x
1 0 0
1 1 0
1 0 0
0 1 0
1 X X
0 0 1 or 0
33
Control
We next add the control unit that generates
write signal for each state element control signals for each multiplexer ALU control signal
34
Control Unit
Divided into two parts
Main Control Unit
Input: 6-bit opcode Output: all control signals for Muxes, RegWrite, MemRead, MemWrite and a 2-bit ALUOp signal
36
37
38
39
0111
40
41