CH 08
CH 08
CH 08
Outline
Fundamental Concepts
Hardwired Control
Microprogrammed Control
Content Coverage
Main Memory System
Address
Data/Instruction
Program
Counter
Arithmetic
and
Logic Unit
Instruction
Sets
Control Unit
Input/Output System
Advanced Reliable Systems (ARES) Lab.
Instruction Execution
To execute an instruction, the processor has to
perform the following three steps:
Step 1: fetch the contents of the memory location pointed by the
PC. The contents of this location are interpreted as an
instruction to be executed. Hence, they are loaded into the IR.
Symbolically, this can be written as IR[[PC]]
Step 2: assuming that the memory is byte addressable,
increment the contents of the PC by 4, that is, PC[PC]+4
Step 3: carry out the actions specified by the instruction in the
IR
Address
lines
Instruction
decoder and
control logic
MAR
Memory bus
MDR
Data
lines
IR
Constant 4
R0
Select
ALU control
lines
R(n-1)
ALU
Carry-in
TEMP
Z
Advanced Reliable Systems (ARES) Lab.
Instruction Execution
An instruction can be executed by performing
one or more of the following operations in some
specified sequence
Transfer
Register Transfers
Riin
Ri
Rjout
1 Riout
Yin
Rj
Y
Constant 4
Rjin 1
Select
A
ALU
Zin
Z
Zout
Advanced Reliable Systems (ARES) Lab.
1
Riout
Riin
Clock
Arithmetic Operation
R1in
R1
R2out 1
1 R1out
1 Yin
R2
Y
Constant 4
1 Select
R2in
1
R3out
ALU
B
R3
1 Zin
R3in 1
Z
1 Zout
Advanced Reliable Systems (ARES) Lab.
MDRoutE
MDRout
Move (R1), R2
1. R1out, MARin, Read
2. MDRinE, WMFC
3. MDRout, R2in
MDR
MDRinE
MDRin
10
the instruction
Fetch the first operand (the contents of the memory
location pointed to by R3)
Perform the addition
Load the result into R1
11
Control Sequence
Riin
Rjout
Ri
Rj
Riout
Yin
Rjin
Instruction fetch
Constant 4
Step Action
Select
A
ALU
Zin
Z
Zout
Advanced Reliable Systems (ARES) Lab.
1
2
3
4
5
6
7
12
Control
To execute instructions, the processor must have
some means of generating the control signals
needed in the proper sequence. Computer
designers use a wide variety of techniques to
solve this problem.
The approaches used fall into one of two
categories: hardwired control and
microprogrammed control
13
External inputs
IR
Decoder/encoder
Conditional
codes
Control signals
14
M e m to R e g
P C S o u rce
ALUOp
O u tp u ts
A L U S rc B
A L U S rc A
R e g W rite
R e gD st
NS3
NS2
NS1
NS0
I n s tru c tio n re g is te r
o p c o d e fie ld
S0
S1
S2
S3
Op0
Op1
Op2
Op3
Op4
Op5
In p u ts
S ta te re g is te r
15
PLA Implementation
Op5
Op4
Op3
Op2
Op1
Op0
S3
S2
S1
S0
PCWrite
PCWriteCond
IorD
MemRead
MemWrite
IRWrite
MemtoReg
PCSource1
PCSource0
ALUOp1
ALUOp0
ALUSrcB1
ALUSrcB0
ALUSrcA
RegWrite
RegDst
NS3
NS2
NS1
NS0
16
ROM Implementation
ROM = "Read Only Memory"
values
0
0
0
1
1
1
1
0
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
Microprogrammed Control
Microprogrammed control
Microcode memory
Outputs
Input
PCWrite
PCWriteCond
IorD
MemRead
MemWrite
IRWrite
BWrite
MemtoReg
PCSource
ALUOp
ALUSrcB
ALUSrcA
RegWrite
RegDst
AddrCtl
Datapath
1
Microprogram counter
Adder
Address select logic
Instruction register
opcode field
18
Microinstruction format
Field name
ALU control
SRC1
SRC2
Value
Add
Subt
Func code
PC
A
B
4
Extend
Extshft
Read
ALUOp = 10
ALUSrcA = 0
ALUSrcA = 1
ALUSrcB = 00
ALUSrcB = 01
ALUSrcB = 10
ALUSrcB = 11
Write ALU
RegWrite,
RegDst = 1,
MemtoReg = 0
RegWrite,
RegDst = 0,
MemtoReg = 1
MemRead,
lorD = 0
MemRead,
lorD = 1
MemWrite,
lorD = 1
PCSource = 00
PCWrite
PCSource = 01,
PCWriteCond
PCSource = 10,
PCWrite
AddrCtl = 11
AddrCtl = 00
AddrCtl = 01
AddrCtl = 10
Register
control
Write MDR
Read PC
Memory
Read ALU
Write ALU
ALU
PC write control
ALUOut-cond
jump address
Sequencing
Signals active
ALUOp = 00
ALUOp = 01
Seq
Fetch
Dispatch 1
Dispatch 2
Comment