Professional Documents
Culture Documents
03 CO B1Ch5 2
03 CO B1Ch5 2
03 CO B1Ch5 2
Computer Organization
Fall 2021
Chapter 5
BASIC COMPUTER ORGANIZATION
AND DESIGN
s0 s1 s2
Back to our basic computer Bus
Memory Unit
4096x16
7
Address
WRITE READ
AR 1
LD INR CLR
PC 2
LD INR CLR
DR 3
LD INR CLR
Adder E
& Logic AC 4
LD INR CLR
INPR
IR 5
LD INR CLR
TR 6
LD INR CLR
OUTR
Clock
LD
16-bit common bus 3
Basic Computer Instructions
◼ Basic Computer has three types of instructions:
Memory-Reference Instructions
Register-Reference Instructions
Input-Output Instructions
4
Basic Computer Instructions
◼ In Basic Computer,
Memory-Reference Instructions
15 14 12 11 0
Addressing
mode I Opcode Address
5
Basic Computer Instructions
◼ In Basic Computer,
Memory-Reference Instructions
15 14 12 11 0
Addressing
mode I Opcode Address
6
Basic Computer Instructions
◼ In Basic Computer,
Memory-Reference Instructions
Op-code
(3 bits)
000
001
010
011 Memory reference instruction
100
101
110
111 Register reference
instruction OR I/O instruction
Based on I (bit no. 15)
15 14 12 11 0
Addressing
mode I Opcode Address
8
Basic Computer Instructions
Op-code
(3 bits)
Memory-Reference Instructions (OP-code = 000 ~ 110) 000
15 14 12 11 0
001
I Opcode Address 010
011
Register-Reference Instructions (OP-code = 111, I = 0) 100
15
0 1 1 1
12 11
Register operation
0
101
110
Input-Output Instructions (OP-code =111, I = 1)
111
15 12 11 0
1 1 1 1 I/O operation
9
Basic Computer Instructions
Op-code
(3 bits)
Memory-Reference Instructions (OP-code = 000 ~ 110) 000
15 14 12 11 0
001
I Opcode Address 010
Op-code011
Register-Reference Instructions (OP-code = I=0 111,(Hex)
I = 0) I=1(Hex)
100
0000(0) 1000(8)
15
0 1 1 1
12 11
Register operation
0
0001(1) 101
1001(9)
0010(2) 110
1010(A)
0011(3) 1011(B)
111
Input-Output Instructions (OP-code =111, I = 1)
0100(4) 1100(C)
15 12 11 0 0101(5) 1101(D)
1 1 1 1 I/O operation
0110(6) 1110(E)
0111(7) 1111(F)
10
Instructions
7
In Basic Computer 4096x16
Address
WRITE READ
AR 1
1. Fetch
an instruction from LD INR CLR
PC 2
memory = IRM[PC] LD INR CLR
➔AR PC DR 3
LD INR CLR
(S0 S1 S2= 0 1 0) Adder E
AC 4
➔IR M [AR], PC PC + 1 & Logic
LD INR CLR
IR 5
2. Decode the instruction LD
➔D0,…,D7 Decode IR(12-14), TR 6
AR IR(0-11), I IR(15)
LD INR CLR
OUTR
Clock
3. Execute the instruction LD
16-bit common bus
4.After an instruction is executed,
the cycle starts again at step 1,
for the next instruction
Control unit (CU) translates machine instructions to control signals
the microoperations that implement them
12
Instruction Set Completeness
A computer should have a set of instructions so that the user can
construct machine language programs to evaluate any function that is
known to be computable.
• Instruction Types In Basic Computer
Functional Instructions
- Arithmetic, logic, and shift instructions
- ADD, CMA, INC, CIR, CIL, AND, CLA
Transfer Instructions
- Data transfers between the main memory
and the processor registers
- LDA, STA
Control Instructions
- Program sequencing and control
- BUN, BSA, ISZ
Input/Output Instructions
- Input and output
- INP, OUT
13
Control Unit
Instruction register (IR)
15 14 13 12 11 - 0 Other inputs
3x8
decoder
7 6543 210
D0
I Combinational
D7 Control Control
logic signals
T15
T0
15 14 . . . . 2 1 0
4 x 16
decoder
T0
T1
T2
T3
T4
D3
CLR
SC
15
Control Unit
Start
SC 0
T0
AR PC
T1
IR M[AR], PC PC + 1
T2
Decode Opcode in IR(12-14),
AR IR(0-11), I IR(15)
T0
AR PC
T1
IR M[AR], PC PC + 1
T2
Decode Opcode in IR(12-14),
AR IR(0-11), I IR(15)
T3 T3 T3 T3
Execute Execute AR M[AR] Nothing
input-output register-reference
instruction instruction
SC 0 SC 0 Execute T4
memory-reference
instruction
SC 0
23
Register Reference Instructions
Register Reference Instructions are identified when:
- D7 = 1, I = 0, execution starts with timing signal T3
- r = D7 IT3
- Register Ref. Instr. is specified in B0 ~ B11 of IR s 0 s1 s2
- Bi = IR(i) , i=0,1,2,...,11 Bus
Memory Unit 7
4096x16
Address
WRITE READ
AR 1
LD INR CLR
PC 2
LD INR CLR
DR 3
LD INR CLR
E
ALU AC 4
LD INR CLR
INPR
IR 5
LD
TR 6
LD INR CLR
OUTR
Clock
LD
24
16-bit common bus
Register Reference Instructions
Register Reference Instructions are identified when:
- D7 = 1, I = 0, execution starts with timing signal T3
- r = D7 IT3
- Register Ref. Instr. is specified in B0 ~ B11 of IR
- Bi = IR(i) , i=0,1,2,...,11
25
Register Reference Instructions
Register Reference Instructions are identified when:
- D7 = 1, I = 0, execution starts with timing signal T3
- r = D7 IT3
- Register Ref. Instr. is specified in B0 ~ B11 of IR
- Bi = IR(i) , i=0,1,2,...,11
r : SC 0
CLA rB11: AC 0
CLE rB10: E0
CMA rB9 : AC AC’
CME rB8 : E E’
CIR rB7 : AC shr AC, AC(15) E, E AC(0)
CIL rB6 : AC shl AC, AC(0) E, E AC(15)
INC rB5 : AC AC + 1
SPA rB4 : if (AC(15) = 0) then (PC PC+1)
SNA rB3 : if (AC(15) = 1) then (PC PC+1)
SZA rB2 : if (AC = 0) then (PC PC+1)
SZE rB1 : if (E = 0) then (PC PC+1)
HLT rB0 : S 0 (S is a start-stop flip-flop)
26
Memory Reference Instructions
Operation
Symbol Symbolic Description
Decoder
AND D0 AC AC M[AR]
ADD D1 AC AC + M[AR], E Cout
LDA D2 AC M[AR]
STA D3 M[AR] AC
BUN D4 PC AR
BSA D5 M[AR] PC, PC AR + 1
ISZ D6 M[AR] M[AR] + 1, if M[AR] + 1 = 0 then PC PC+1
s0 s1 s2
Bus
Memory Unit
4096x16
7 - The effective address of the
Address
WRITE READ
1
instruction is in AR and was placed
AR
LD INR CLR there during
PC 2 timing signal T2 when I = 0, or
LD INR CLR
DR 3 during timing signal T3 when I = 1
LD INR CLR - Memory cycle is assumed to be short
ALU
E
AC 4 enough to complete in a CPU cycle
LD INR CLR - The execution of MR instruction
INPR
5
starts with T4
IR
LD
TR 6
LD INR CLR
OUTR
LD
Clock 27
16-bit common bus
Memory Reference Instructions
Operation
Symbol Symbolic Description
Decoder
AND D0 AC AC M[AR]
ADD D1 AC AC + M[AR], E Cout
LDA D2 AC M[AR]
STA D3 M[AR] AC
BUN D4 PC AR
BSA D5 M[AR] PC, PC AR + 1
ISZ D6 M[AR] M[AR] + 1, if M[AR] + 1 = 0 then PC PC+1
AND to AC
D0T4: DR M[AR] Read operand
D0T5: AC AC DR, SC 0 AND with AC
ADD to AC
D1T4: DR M[AR] Read operand
D1T5: AC AC + DR, E Cout, SC 0 Add to AC and store carry in E
LDA: Load to AC
D2T4: DR M[AR]
D2T5: AC DR, SC 0
STA: Store AC
D3T4: M[AR] AC, SC 0
BUN: Branch Unconditionally
28
D4T4: PC AR, SC 0
Memory Reference Instructions
Memory, PC, AR at time T4 Memory, PC after execution
20 0 BSA 135 20 0 BSA 135
PC = 21 Next instruction 21 Next instruction
AR = 135 135 21
136 Subroutine PC = 136 Subroutine
BSA:
D5T4: M[AR] PC, AR AR + 1
D5T5: PC AR, SC 0
D0 T 4 D1 T 4 D2 T 4 D 3T 4
DR M[AR] DR M[AR] DR M[AR] M[AR] AC
SC 0
D0 T 5 D1 T 5 D2 T 5
AC AC DR AC AC + DR AC DR
SC 0 E Cout SC 0
SC 0
D4 T 4 D5 T 4 D6 T 4
PC AR M[AR] PC DR M[AR]
SC 0 AR AR + 1
D5 T 5 D6 T 5
PC AR DR DR + 1
SC 0
D6 T 6
M[AR] DR
If (DR = 0)
then (PC PC + 1)
SC 0
30
EX 13.7
How many times does the processor need to refer to
memory when it fetches and executes an indirect-address-
mode instruction if the instruction is:
(a) a computation requiring a single operand;
3 times: fetch instruction; fetch operand reference; fetch
operand.
(b) a branch?
2 times: fetch instruction; fetch operand reference and load into
PC.
32
CONTROL OF REGISTERS AND MEMORY
EX: Address Register AR
Scan all of the register
transfer statements that
change the content of AR:
R’T0: AR PC LD(AR)
R’T2: AR IR(0-11) LD(AR)
D’7IT3: AR M[AR] LD(AR)
RT0: AR 0 CLR(AR)
D5T4: AR AR + 1 INR(AR)
33
CONTROL OF REGISTERS AND MEMORY
EX: Address Register AR
Scan all of the register
transfer statements that
change the content of AR:
R’T0: AR PC LD(AR)
R’T2: AR IR(0-11) LD(AR)
D’7IT3: AR M[AR] LD(AR)
RT0: AR 0 CLR(AR)
D5T4: AR AR + 1 INR(AR)
selected
x1 x2 x3 x4 x5 x6 x7 S2 S1 S0 register
0 0 0 0 0 0 0 0 0 0 none
1 0 0 0 0 0 0 0 0 1 AR
0 1 0 0 0 0 0 0 1 0 PC
0 0 1 0 0 0 0 0 1 1 DR
0 0 0 1 0 0 0 1 0 0 AC
0 0 0 0 1 0 0 1 0 1 IR
0 0 0 0 0 1 0 1 1 0 TR
0 0 0 0 0 0 1 1 1 1 Memory
For AR D4T4: PC AR
D5T5: PC AR
x1 = D4T4 + D5T5
35
DESIGN OF ACCUMULATOR LOGIC
Circuits associated with AC 16
Adder and
16 16 16
From DR logic AC
8 circuit To bus
From INPR
Control
gates
38
Thank you