Unit-3 COA 2
Unit-3 COA 2
ORGANIZATION
&
ARCHITECTURE
Unit-
3
Basic Computer
Organization & Design
2
Basic Computer Organization
& Design 6. Memory-Reference
1. Instruction Instructions
Codes
7. Input-Output and
2. Computer Interrupt
Registers
8. Complete Computer
3. Computer Description
Instructions
9. Design of Basic
4. Timing and Computer
Control
10. Design of Accumulator3
5. Instruction Cycle Logic
nstruction Codes
Instruction Codes:
* The organization of the computer is defined by its internal registers, the timing and
control structure, and the set of instructions that it uses.
* Program: set of instructions that specify the operations, operands, and the sequence
by which processing has to occur.
Instruction Code: group of bits that instruct the computer to perform specific
operation.
Instruction code is usually divided into two parts: Opcode and address(operand)
5
nstruction Codes The Operation code
(Opcode) field
determines the process
that needs to be
performed The Address field
The Mode field specifies contains the operand's
how the operand locates location, i.e., register
or memory location.
15 14 12 11 0
Instruction 6
Format
Operation Code (opcode):
• No. of bits required for opcode depends on no. of operations available in computer.
• Address (operand):
• The ability to store and execute instructions is the most important property of a general-purpose computer.
That type of stored program concept is called stored program organization.
• The simplest way to organize a computer is to have one processor register and an instruction code format
with two parts. The first part specifies the operation to be performed and the second specifies an address.
8
* Instructions are stored in one section of memory and data in another.
• For a memory unit with 4096 words we need 12 bits to specify an address since 212 = 4096.
• If we store each instruction code in one 16-bit memory word, we have available four bits for
the operation code (abbreviated opcode) to specify one out of 16 possible operations, and 12
bits to specify the address of an operand.
• Accumulator (AC):
• Computers that have a single-processor register usually assign to it the name accumulator
and label it AC.
• The operation is performed with the memory operand and the content of AC.
9
Addressing of Operand
Addressing of Operand:
10
Computer Registers
Computer Registers:
• The need of the registers in computer for Instruction sequencing needs a counter to
calculate the address of the next instruction after execution of the current instruction is
completed (PC).
• Necessary to provide a register in the control unit for storing the instruction code after it is
read from memory (IR).
• Needs processor registers for manipulating data (AC and TR) and a register for holding a
memory address (AR).
11
12
S2
COMMON BUS
S1 Bus
LD INR CLR
E
ALU AC 4
LD INR CLR
INPR
IR 5
LD
TR 6
LD INR CLR
OUTR
Clock
LD
16-bit common bus
Instructions are of
three types
• Register reference
12 bits to specify an instructions
address • Memory reference
instructions
Addressing
• IO reference instruction
mode
I = 0 : direct
addressing
I = 1 : indirect
addressing
14
15
Timing and Control Timing and Control
The timing for all registers in the basic computer is controlled by a master clock
generator.
The clock pulses are applied to all flip-flops and registers in the system, including the
flip-flops and registers in the control unit.
The clock pulses do not change the state of a register unless the register is enabled by
a control signal.
The control signals are generated in the control unit and provide control inputs for the
multiplexers in the common bus, control inputs in processor registers, and micro
operations for the accumulator.
There are two major types of control organization: o Hardwired control o Micro
programmed control 16
17
18
19
20
Instruction Cycle Instruction Cycle
• Every program is a collection of instructions
• Each instruction of the program is executed using instruction cycle.
In Basic Computer, a machine instruction is executed in the following cycle:
1. Fetch an instruction from memory (Retrieving Instruction from the
memory)
2. Decode the instruction (which operation the corresponding instruction
will perform)
3. Read the effective address from memory if the instruction has an indirect
address
4. Execute the instruction
Initially, the program counter PC is loaded with the address of the first instruction in the program
The micro operations for the fetch and decode phases can be specified by the following register transfer
statements
23
24
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
• The effective address of the instruction is in AR and was placed there during timing signal T2 when I = 0, or
during timing signal T3 when I = 1
ADD to AC
D1T4: DR M[AR] Read operand 25
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
D6T4: DR M[AR]
D6T5: DR DR + 1
D6T4: M[AR] DR, if (DR = 0) then (PC PC + 1), SC 0 26
FLOWCHART FOR MEMORY REFERENCE INSTRUCTIONS
Memory-reference instruction
D T 4 D 1T 4 D 2T 4 D 3T 4
0
DR M[AR] DR M[AR] DR M[AR] M[AR] AC
SC 0
D 0T 5 D 1T 5 D 2T 5
AC AC DR AC AC + DR AC DR
SC 0 E Cout SC 0
SC 0
D 4T 4 D 5T 4 D 6T 4
PC AR M[AR] PC DR M[AR]
SC 0 AR AR + 1
D 5T 5 D 6T 5
PC AR DR DR + 1
SC 0
D 6T 6
M[AR] DR
If (DR = 0)
then (PC PC + 1) 27
SC 0
Input-Output and Interrupt Input-Output and Interrupt
Instructions and data stored in memory must come from some input device.
To demonstrate the most basic requirements for input and output communication, we
will use as an illustration a terminal unit with a keyboard and printer
28
Input-Output Configuration
29
Input-Output Instructions
30
FLOWCHART FOR INTERRUPT CYCLE
R = Interrupt flip-flop
=0 Interrupt cycle
Instruction cycle =1
R
=0
Execute IEN
instructions =1 Branch to location 1
PC 1
=1
FGI
=0
=1 IEN 0
FGO R0
=0
R1
31
Interrupt cycle Interrupt cycle Memory
Before interrupt After interrupt cycle
0 0 256
1 0 BUN 1120 PC = 1 0 BUN 1120
Main Main
255 Program 255 Program
PC = 256 256
1120 1120
I/O I/O
Program Program
start
SC 0, IEN 0, R 0
Hardware Components of BC
• A memory unit : 4096 x 16.
• Registers: Flip-
Flops(Status):
Fetch RT0: AR PC
RT1: IR M[AR], PC PC + 1
Decode RT2: D0, ..., D7 Decode IR(12 ~ 14),
AR IR(0 ~ 11), I IR(15)
Indirect AR M[AR]
D7IT3:
Interrupt
T0T1T2(IEN)(FGI + FGO): R1
AR 0, TR PC
RT0: M[AR] TR, PC 0
RT1: PC PC + 1, IEN 0, R 0, SC 0
Memory-Reference RT2:
AND DR M[AR]
D0T4: AC AC DR, SC 0
ADD D0T5: DR M[AR]
D1T4: AC AC + DR, E Cout, SC 0
LDA D1T5: DR M[AR]
D2T4: AC DR, SC 0
STA M[AR] AC, SC 0
BUN D2T5: PC AR, SC 0
BSA D3T4: M[AR] PC, AR AR + 1
D4T4: PC AR, SC 0
ISZ D5T4: DR M[AR]
D5T5: DR DR + 1
D6T4: M[AR] DR, if(DR=0) then (PC PC + 1),
D6T5: SC 0
D6T6:
35
Register-Reference
D7IT3 = r (Common to all register-reference instr)
IR(i) = Bi (i = 0,1,2, ..., 11)
r: SC 0
CLA AC 0
rB11:
CLE E0
CMA rB10:
AC AC
CME rB9: E E
CIR rB8: AC shr AC, AC(15) E, E AC(0)
CIL rB7: AC shl AC, AC(0) E, E AC(15)
INC rB6: AC AC + 1
SPA rB5: If(AC(15) =0) then (PC PC + 1)
SNA rB4: If(AC(15) =1) then (PC PC + 1)
SZA If(AC = 0) then (PC PC + 1)
SZE rB3:
If(E=0) then (PC PC + 1)
HLT rB2: S0
rB1:
Input-Output rB0: (Common to all input-output instructions)
(i = 6,7,8,9,10,11)
D7IT3 = p SC 0
INP IR(i) = Bi AC(0-7) INPR, FGI 0
OUT p: OUTR AC(0-7), FGO 0
SKI pB11: If(FGI=1) then (PC PC + 1)
SKO If(FGO=1) then (PC PC + 1)
pB10:
ION IEN 1
IOF pB9: IEN 0
pB8:
pB7:
pB6:
36
CONTROL OF REGISTERS AND MEMORY
Address Register; AR
Scan all of the register transfer statements that change the content of AR:
12 12
From bus To bus
R’T0: AR PC LD(AR) D' AR
7
R’T2: AR IR(0-11) LD(AR)
I
D’7IT3: AR M[AR] LD(AR) LD Clock
RT0: AR 0 CLR(AR) T
3
T INR
D5T4: AR AR + 1 INR(AR) 2
CLR
T0
LD(AR) = R'T0 + R'T2 + D'7IT3
D
CLR(AR) = RT0
T4
INR(AR) = D5T4
37
CONTROL OF FLAGS
IEN: Interrupt Enable Flag
D
7
p
I
J Q IEN
B
7
T3
B
6
K
R
T
2
38
CONTROL OF COMMON BUS
x1
x2 S2
Multiplexer
x3
Encoder S1 bus select
x4
x5 inputs
x6 S0
x7
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 39
DESIGN OF ACCUMULATOR LOGIC
16
Adder and
Circuits associated with AC 16 16 16
From DR logic AC
circuit To bus
8
From INPR
Control
gates