Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Computer Architecture
Basic Computer Organization & Design
Review
We introduced registers
We discussed the kinds of Transfer, Arithmetic,
Logic and Shift Microoperations
Introduced a language that connects SSI to MSI
Combined groups of instructions using multi-selection
circuits
Goals
We conclude our lecture series by considering
computer organization
Combining the CPU, Memory and Bus architectures
M[K]
M[L-1]
CPU
Output
I/O Bus
Control
Unit
(CU)
Input
Output
is
Manoand
defines
Memory
as 4096
CLK
defined
using
the
words. This requires an
ASCII code
Control
Address
bus ofof12 bits to act as
Bus
length
8 bits. inputs to
selection
address/data multiplexers.
Arithmetic and Logic
TheUnit
fundamental unit of
(ALU)
addressable
memory is the
word. Each word is 16 bits
long. The Data bus carries
exactly 1 word of data between
Address Bus Memory and CPU.
IR
DR
AC
12 bits
AR
DR
IR
16 bits
AC
INR
OUTR
8 bits
SC
R
E
4 bits
1 bit
1 bit
Stored programs
A stored program is a set of instructions and data
expressed in binary language, stored in non-volatile (ie.
disk storage) memory
Programs can be executed only from Memory.
Thus, a program must be loaded from disk to RAM in
order to execute it.
Loaded programs are called processes.
Individual instructions must be transferred to the CPU
where they are executed, using data that must be obtained
from either CPU registers or RAM
Instruction Architecture
The list of all instructions engineered for a computers CPU
is called the instruction set.
To distinguish each instruction, they are assigned a unique
numeric code
Can be done in many ways
Does not need to be ordinal (ie. starting from 0 and
running contiguously)
Can be partially ordinal and partially hierarchical
Manos approach
Instruction Architecture
Instructions consist of
Operation code data
Address data
Mode data
Direct addressing data found at the specified address
Indirect addressing data found at the address found at the
The number of memory referenced operands varies
specified address
(pointer
concept)
from
computer
to computer.
0
15 14
Mode
bit
IR
12 11
I OpCode
Address
Instruction Hierarchy
It is desirable to engineer the computer to support a
reasonable number of independent instructions
Examples:
Add, subtract, transfer, shift, logic, comparison, branch,
input, output
IR
12 11
I OpCode
Address
Instruction Hierarchy
It is desirable to engineer the computer to support a
reasonable number of independent instructions
Use a hierarchical scheme (1+3 scheme)
OpCode 3 bits supports 8 unique codes
0-6 (instructions)
7 (toggle)
Direct addressing
Indirect addressing
IR
12 11
I OpCode
Address
Instruction Hierarchy
Manos instruction set consists of 25 instructions:
Instruction
OpCode (0-6)
Direct (I=0)
Indirect (I=1)
4 bit code
0 AND
1 ADD
2 LDA
3 STA
4 BUN
5 BSA
6 ISZ
4 bit code
8 AND
9 ADD
A LDA
B STA
C BUN
D BSA
E ISZ
OpCode (7)
Direct (I=0)
16 bit
7800
7400
7200
7100
7080
7040
7020
7010
7008
7004
7002
7001
code
CLA
CLE
CMA
CME
CIR
CIL
INC
SPA
SNA
SZA
SZE 12
HLT
Indirect (I=1)
16 bit
F800
F400
F200
F100
F080
F040
code
INP
OUT
SKI
SKO
ION
IOF
and CPU
registers
Input
status
CLR
..T0
T2 T1
CLR
SC
L-to-2 DEC
L
INC
T0 :
AR = PC
Load
AR
Step 2: How
do weMemory
obtain
instruction
This assumes
that thethe
next
instructionfrom
(yet
be executed) in logical sequence is
Data bus
memory attoactually
T1?
located at the next memory
INC
location.
LD is
M[AR]
DRaddress
PCtransferred onto the
The data stored
at the selected
This
restriction
to non-sequential
Data Bus instructions
and
then
to the
Data
Register (DR) in the CPU.
is removed by including
LD PC explicitly.
IR the
instructions
modify
The instruction
data that
is transferred
immediately to the
CPU bus
Instruction Register (IR)
Address bus
T1 :
AR
LD
DR = M[AR] , IR = DR , PC = PC + 1
Input
Output
T2 :
The AR may be
directly connected
to the IR address
bits indicated
3x8 DEC
7 6 5 4 3 2 1 0
F E D C B A 9 ... 1 0
Connect it all
together !
Enable one
specific
logic circuit
Signal the SC
to advance
(INC) to next
Control
timing value,
Control
Logic
or reset.
Outputs
Timing
inputs
Gates
4x16 DEC
3 2 1 0
4-bit
Sequence
Counter (SC)
INC
CLR
Clock
has not
been
include
d!
Assignment = Transfer
Integer arithmetic (may include optimized floating point)
Logic, Shift
Non-sequential control (branching for decision and repetition)
Input and Output
Communications
Specialized operations (string, array)
Specialized addressing modes
Enhanced data and register access modes
Instruction Categories
12 11
IR 0
1 1 1
bits
AC
Operation control
Mnemonic
CLA
CLE
CMA
CME
CIR
CIL
Binary coding
0111100000000000
0111010000000000
0111001000000000
0111000100000000
0111000010000000
0111000001000000
Meaning
CLear Accumulator
CLear E
CoMplement Accumulator
CoMplement E
CIrcular shift Right
CIrcular shift Left
7020
INC
0111000000100000
INCrement AC
7010
7008
7004
7002
SPA
SNA
SZA
SZE
0111000000010000
0111000000001000
0111000000000100
0111000000000010
Skip
Skip
Skip
Skip
7001
HLT
0111000000000001
if
if
if
if
Positive Accumulator
Negative Accumulator
Zero Accumulator
Zero E
Mnemonic
CLA
CMA
CIR
CIL
INC
SPA
SNA
SZA
7400
7100
7002
CLE
CME
SZE
7001
HLT
AC affected
E affected
Control affected
Mnemonic
CLA
CMA
INC
CLA
CMA
INC
RTL
AC = 0
AC = ~ AC
AC = AC + 1
AC
Mnemonic
CLE
CME
RTL
E = 0
E = ~ E
CLE
CME
7040
Mnemonic
CIR
CIL
RTL
AC(0-14) = AC(1-15),
AC(15) = E, E = AC(0)
AC(1-15) = AC(0-14),
AC(0) = E, E = AC(15)
E
AC
Mnemonic
SPA
SNA
SZA
RTL
( AC > 0 ) : PC = PC + 1
( AC < 0 ) : PC = PC + 1
( AC = 0 ) : PC = PC + 1
Mnemonic
SZE
RTL
~ E : PC = PC + 1
Mnemonic
HLT
RTL
Disable all circuits
IR I
12 11
OpCode
8
9
A
B
C
D
E
AND
ADD
LDA
STA
BUN
BSA
ISZ
0
Memory Address
Mnemonic
AND
RTL
DR = M[AR] ; AC = AC ^ DR
ADD
DR = M[AR] ; AC = AC + DR
2
3
LDA
STA
DR = M[AR] ; AC = DR
DR = AC
; M[AR] = DR
BUN
BSA
AR = IR(0-11) ;
PC = AR
AR = IR(0-11) ;
M[AR] = PC , PC = AR + 1
ISZ
AR = IR(0-11) ; DR = M[AR] ;
AC = DR ; AC = AC + 1 ; DR = AC ;
M[AR] = DR , (AC=0) : PC = PC + 1
Mnemonic
AND
RTL
AR = IR(0-11) ; DR = M[AR]
AR = DR(0-11) ; DR = M[AR]
AC = AC ^ DR
ADD
AR = IR(0-11) ; DR = M[AR]
AR = DR(0-11) ; DR = M[AR]
AC = AC + DR
I=1
A
B
M
Address
MUX
Mnemonic
LDA
RTL
DR = M[AR] ; AC = DR
STA
DR = AC
Data
bus
DR
AR
; M[AR] = DR
AC
I=1
8
9
M
Address
MUX
Mnemonic
AND
RTL
DR = M[AR] ; AC = AC ^ DR
ADD
DR = M[AR] ; AC = AC + DR
Data
bus
DR
AR
AC
ADD/AND
Logic
Next instr.
Current instr.
(b) AFTER
COMPLETION
OF EXECUTION
M
PC
This is
called a
Branch
Point
Address
Next instr.
Current instr.
AR = PC, SC = SC + 1
T1:
IR = M[AR], PC = PC +1, SC = SC +1
T2:
{D0..D7} = DEC(IR(12..14)), AR = IR(0..11), I =
IR(15), SC = SC+1
D0.T3:
DR = M[AR], SC = SC+1
I.D0.T4:
AC = AC^DR, SC = 0
I.D0.T4:
AR = DR(0..11), SC = SC+1
I.D0.T5:
DR = M[AR], SC = SC+1
I.D0.T6:
AC = AC^DR, SC = 0
Note how the Direct and Indirect forms of the instruction are
differentiated using the I (or I) bit value for control differentiation.
PC = M[ M[ IR(0-11) ] ]
Operation Codes
Direct Indirect
I=0
4
I=1
C
Mnemonic
BUN
RTL
AR = IR(0-11)
PC = AR
PC
M
Address
MUX
I=1
Data
bus
DR
AR
IR
I=0
I=1
D
Mnemonic
BSA
RTL
AR = IR(0-11)
M[AR] = PC , PC = AR + 1
(b) AFTER SUBROUTINE CALL
M
PC
M
Subr. call instr.
PC
Return addr.
Subr. entry instr.
I=1
Mnemonic
RTL
ISZ
AR = IR(0-11) , DR = M[AR]
AC = DR , AC = AC + 1 , DR = AC
M[AR] = DR , (AC=0) : PC = PC + 1
(a) BEFORE
(b) AFTER
M
M
PC
Current instr.
PC
Branch instr.
Continue instr.
AR
AR
Data value
Continue instr.
Data value + 1
15 14
IR 1
12 11
1 1 1
Input/Output Instructions
Used for communicating data between CPU and I/O peripheral
devices
Also, need instructions to support programmed polling.
Polling refers to waiting for a condition to be true before proceeding
16 bit
OpCode Mnemonic Meaning
F800
F400
INP
OUT
F200
F100
SKI
SKO
15 14
IR 1
12 11
1 1 1
Input/Output Instructions
Each peripheral device has a communications and control
interface that interacts with the computers interface logic circuits
Input
Need a data buffer (INPR) and a flag (FGI) indicating buffer empty/full
Output
Need a data buffer (OUTR) and a flag (FGO) indicating buffer empty/full
FGO
Printer
Receiver
Interface
OUT
R
Status
Data
NOTE:
AC(H) AC(L)
Keyboard
Transmitte
r Interface
INPR
FGI
PERIPHERAL DEVICES
CPU
Interrupts
Input and Output interactions with electromechanical peripheral
devices require huge processing times compared with CPU
processing times
I/O (milliseconds) versus CPU (nano/micro-seconds)
IR 1
ION
IOF
1 1 1
IEN
Interrupts
In this approach, interrupts are used only with I/O handling
In addition to a flip-flop to store the Interrupt Enable state, one more
flip-flop (R) is needed to store the I/O Status (Ready/Not_ready).
In general, interrupts may be used with arbitrary instructions for
exception trapping and handling
We will also
require one
final register,
called TR (for
transfer). This
can be 16 bits,
but must be at
least 12 bits.
1-bit registers
IEN
IEN
=1
=1
FGI
FGI
=0
=1
R1
Control Bus
=0
FG0
=0
FGO
R
All of these
flipflops are
assumed to
be reset to 0
when
bootstrapping
the computer.
=0
Fetch/Decode
Instruction
Execute
Instruction
IEN
=0
=1
Interrupt Cycle
IEN
=1
=1
FGI
FGI
Branch to location 1
PC 1
=0
=1
R1
FG0
=0
FGO
Reset Interrupt, Ready
IEN 0
R0
TR
Control Bus
Main Prog.
Main Prog.
255 Curr Instr.
Branch to location 1
PC 1
Control Logic
Timing of microoperations requires explicit enabling of
logic circuits through the Control Unit logic gates
3x8 DEC
7 6 5 4 3 2 1 0
Control
Logic
Gates
F E D C B A 9 ... 1 0
4x16 DEC
3 2 1 0
4-bit
Sequence
Counter (SC)
INC
CLR
Control
Outputs
Control Logic
Timing of microoperations requires explicit enabling of
logic circuits through the Control Unit logic gates
Need signals
Condition
D7
T2
R
T0
D5
T4
Microoperation
R T0
AR PC
R T2
AR IR(0-11)
D7 I T3
AR M[AR]
R T0
AR 0
D5 T4
AR AR + 1
LD
INC
AR
CLR
Clk
To
Bus
From
Bus
Control Logic
In previous lectures we discussed complex register
circuits
Control was exerted through enabling inputs
Memory
Memory storage cells
Address, Data and Control Bus structure
Input-Output
Buffer registers, Control
Hardware
CPU
Instruction set Arithmetic & Logic Unit Subsystem
Control logic Control Unit Subsystem
Registers
Memory
Memory storage cells
Address, Data and Control Bus structure
Memory
4096 words
16 bits/word
Buses
9 Registers
- AR, PC, DR, AC, IR, TR, OUTR,
INPR, SC
Address
7 Flip-flops
- I, S, E, R, IEN, FGI, FGO
Control
2 Decoders
- 3x8 Operation DEC, 4x16 Timing
DEC
Data
Buffer connections
Summary
We adopted and discussed M. Manos logical model of computer
architecture.
Instruction Set
Control architecture
Instruction processing
Register access
Memory access (Direct, Indirect)
I/O access
Interrupts