Professional Documents
Culture Documents
Autumn 2003
Structure of a computer
Control
read/write
data
control signals
Memory
System
Data Path
data conditions
instruction unit
instruction fetch and
interpretation FSM
Autumn 2003
execution unit
functional units
and registers
CSE370 - XI - Computer Organization
Registers
LD
OE
D7
D6
D5
D4
D3
D2
D1
D0
Q7
Q6
Q5
Q4
Q3
Q2
Q1
Q0
CLK
Autumn 2003
Register transfer
Point-to-point connection
MUX
MUX
MUX
MUX
rs
rt
rd
R4
rs
rt
rd
R4
rd
R4
dedicated wires
muxes on inputs of
each register
load enables
for each register
control signals
for multiplexer
MUX
rs
rt
BUS
Autumn 2003
Register files
4 by 4 register file
16 D-FFs
organized as four words of four bits each
write-enable (load)
read-enable (output enable)
RE
RB
RA
Q3
Q2
Q1
Q0
WE
WB
WA
D3
D2
D1
D0
Autumn 2003
Memories
once written, memory holds forever (not true for denser dynamic RAM)
address lines to select word (10 lines for 1024 words)
read enable
Autumn 2003
RD
WR
A9
A8
A7
A6
A5
A4
A3
A2
A2
A1
A0
IO3
IO2
IO1
IO0
Instruction sequencing
Example an instruction to
add the contents of two registers (Rx and Ry)
and place result in a third register (Rz)
Step 1: get the ADD instruction from memory into an instruction register
Step 2: decode instruction
Autumn 2003
Instruction types
Data manipulation
Data staging
add, subtract
increment, decrement
multiply
shift, rotate
immediate operands
load/store data to/from memory
register-to-register move
Control
Autumn 2003
state register
next-state logic
output logic (datapath/control signalling)
Moore or synchronous Mealy machine to avoid loops unbroken by FF
instruction register (IR)
program counter (PC)
Inputs/outputs
Autumn 2003
Instruction execution
Init
reset
fetch instruction
decode
execute
branch
load/store
register-to-register
Autumn 2003
Reset
Branch
Branch
Branch
Taken Not Taken
Initialize
Machine
Fetch
Instr.
Load/
Store
XEQ
Instr.
Registerto-Register
Incr.
PC
10
Cin
Ain
Bin
FA
Cout
Ain
HA
Bin
HA
Cin
Autumn 2003
Sum
Sum
Cout
11
B
16
16
Operation
16
N
Autumn 2003
12
Accumulator
One-address instructions
special register
one of the inputs to ALU
output of ALU stored back in accumulator
operation and address of one operand
other operand and destination
is accumulator register
AC < AC op Mem[addr]
"single address instructions
(AC implicit operand)
16
REG
AC
16
16
OP
Multiple registers
Autumn 2003
16
Z
13
CO
ALU
CI
CO
ALU
ALU
AC
AC
AC
R0
R0
R0
rs
rs
rs
rt
rt
rt
rd
rd
rd
from
memory
from
memory
1 bit wide
Autumn 2003
CI
from
memory
2 bits wide
14
Instruction path
Autumn 2003
15
Memory
Separate memory
Single memory
address from PC or IR
memory output to instruction and data registers
memory input from ALU output
Autumn 2003
16
AC
16
store
path
OP
N
rd wr
data
Data Memory
(16-bit words)
addr
16
Z
Control
FSM
16
IR
PC
data
Inst Memory
(8-bit words)
16
16
OP
addr
16
Autumn 2003
17
AC
16
OP
N
rd wr
data
Data Memory
(16-bit words)
addr
Control
FSM
store
path
MAR
16
IR
PC
16
16
OP
16
Autumn 2003
18
Princeton architecture
Register file
Instruction register
PC incremented
through ALU
Modeled after
MIPS rt000
(used in 378
textbook by
Patterson &
Hennessy)
really a 32-bit
machine
well do a 16-bit
version
Autumn 2003
19
Processor control
Autumn 2003
20
Processor instructions
op
3
3
3
rs
3
3
13
rt
3
3
rd
3
7
funct
4
I
J
0
0
0
0
0
1
2
3
4
5
7
rs
rt
rd
rs
rt
rd
rs
rt
rd
rs
rt
rd
rs
rt
rd
rs
rt
offset
rs
rt
offset
rs
rt
offset
rs
rt
offset
target address
-
Autumn 2003
0
1
2
3
4
rd = rs + rt
rd = rs - rt
rd = rs & rt
rd = rs | rt
rd = (rs < rt)
rt = mem[rs + offset]
mem[rs + offset] = rt
pc = pc + offset, if (rs == rt)
rt = rs + offset
pc = target address
stop execution until reset
21
Instruction:
R
rs=r1
rt=r2
rd=r3
funct=0
1. instruction fetch
r3 = r1 + r2
2. instruction decode
Autumn 2003
22
Instruction:
R
r3 = r1 + r2
0
rs=r1
rt=r2
rd=r3
funct=0
3. instruction execute
Autumn 2003
23
Step 1
Autumn 2003
24
Step 2
Autumn 2003
25
to controller
Step 3
Autumn 2003
26
Register-transfer-level description
Control
PC ALUout
instruction decode:
IR to controller
values of A and B read from register file (rs, rt)
instruction execution:
op add
send regA into A input, regB into B input, add
(srcA, srcB0, scrB1, op)
rd ALUout
store result of add into destination register
(regWrite, wrDataSel, wrRegSel)
Autumn 2003
27
How do we set all of the control signals to be output by the state machine?
Autumn 2003
28
decode
fetch
step 1
execute
step 2
IR mem[PC];
PC PC + 1;
step 3
A rs
B rt
rd A + B
Autumn 2003
29
instruction
decode
LW
Autumn 2003
SW ADD
instruction
execution
30
reset
mabus PC;
memory read;
IR memory data bus;
PC PC + 1;
Autumn 2003
Fetch
instruction
fetch
31
Decode instruction
decode
add
Autumn 2003
32
add
Autumn 2003
instruction
execution
33
the famous
instruction
fetch
decode
execute
cycle
reset
Fetch
Decode instruction
decode
add
Autumn 2003
instruction
fetch
instruction
execution
34
Autumn 2003
35