Академический Документы
Профессиональный Документы
Культура Документы
Definition
Instruction Codes
A process is controlled by a program
A program is a set of instructions that
specify the operations, data, and the
control sequence
An instruction is stored in binary code
that specifies a sequence of
microoperations
Instruction codes together with data
are stored in memory (Stored Program
Concept)
Cont..
Address
instruction
data
Not an instruction
Components of Instructions
Operations (opcodes)
Number of operands (Number of data
locations)
R1 R2 + R3
Instruction encodings
addr1,r2,r3
opcode
NOP
No Operands
1 operand NOT R4
R4 R4
R1 R1 + R2
> 3 operands
R1 R2 + R3
MADD R4,R1,R2,R3
R4 R1+(R2*R3)
2. Program Counter
PC
000000000001
3. Instruction Register
IR
0101
010101010101
1. Memory
address
contents
0000000000000001
0101010101010101
0000000000000010
1010101010101010
0000000000000011
1100110011001100
0000000000000100
0011001100110011
0000000000000101
0101010101010011
0000000000000110
1010101010101010
0000000000000111
1100110011001100
0000000000001000
0011001100110011
+1
PC
000000000010
00000001
AR
000000000010
Direct access to
Memory
IR
1010101010101010
Direct address
Direct addressing: A very simple form of addressing is direct
addressing, in which the address field contains the effective
address of the operand
1. Address part of IR is placed on the bus and loaded
back into the AR
2. Address is selected in memory and its Data placed on
the bus to be loaded into the Data Register to be used
for requested instructions
Direct address
Indirect address
Occurs When the Operand Contains the Address of the Address
of Needed Data.
1. Address part of IR is placed on the bus and loaded back
into the AR
2. Address is selected in memory and placed on the bus to be
loaded Back into the AR
3. New Address is selected in memory and placed on the bus
to be loaded into the DR to use later
Indirect address
Effective address:
Effective address: Address
where an operand is physically
located
Addressing
Mode
s0 s1 s2
7
Address
READ
AR
LD
CLR
INR
PC
LD
INR
CLR
DR
LD
Adder
& Logic
CLR
INR
AC
LD
Bus
CLR
INR
INPR
IR
TR
LD
LD
INR
CLR
OUTR
LD
Clock
Computer Registers
Accumulator(AC) : takes input from ALU
The ALU takes input from DR, AC and INPR :
ADD DR to AC, AND DR to AC
Note) Input register is not connected to the bus.
The input register is connected only to the ALU
Program Counter(PC) :
Register
symbol
DR
AR
AC
IR
PC
TR
INPR
OUTR
Number
Register
of bits
name
16
Data register
12
Address register
16
Accumulator
16
Instruction register
12
Program counter
16
Temporary register
8
Input register
8
Output register
Register
Function----------------------Holds memory operands
Holds address for memory
Processor register
Holds instruction code
Holds address of instruction
Holds temporary data
Holds input character
Holds output character
12 11
15
I
000 AND
001 ADD
010 LDA
(Load Accumulator)
011 STA
(Store Accumulator)
Symbol
AND
ADD
LDA
STA
BUN
BSA
ISZ
CLA
CLE
CMS
CME
CIR
CIL
INC
SPA
SNA
SZA
SZE
HLT
INP
OUT
SKI
SKO
ION
IOF
Hex Code
I=0 I=1
0xxx 8xxx
1xxx 9xxx
2xxx Axxx
3xxx Bxxx
4xxx Cxxx
5xxx Dxxx
6xxx Exxx
7800
7400
7200
7100
7080
7040
7020
7010
7008
7004
7002
7001
F800
F400
F200
F100
F080
F040
Description
And memory word to AC
Add memory word to AC
Load memory word to AC
Store content of AC in memory
Branch unconditionally
Branch and Save return address
Increment and skip if z ero
Clear AC
Clear E
Complement AC
Comp e
m
Circulate right AC and E
Circulate left AC and E
Increment AC
Skip next instruction if AC positive
Skip next instruction if AC negative
Skip next instruction if AC z ero
Skip next instruction if E is 0
Halt computer
Input character to AC
Output character from AC
Skip on input flag
Skip on output flag
Interrup
Inter
I=0 : Direct,
I=1 : Indirect
15 14
12
11
I Opcode
Address
Register-reference instruction
12
11
0 1 1 1
Register Operation
Input-Output instruction
Fxxx(F800 ~ F040) : INP, OUT, ION, SKI,
15 14
12
1 1 1 1
11
I/O Operation
Symbol
AND
ADD
LDA
STA
BUN
BSA
ISZ
CLA
CLE
CMS
CME
CIR
CIL
INC
SPA
SNA
SZA
SZE
HLT
INP
OUT
SKI
SKO
ION
IOF
Hex Code
I=0 I=1
0xxx 8xxx
1xxx 9xxx
2xxx Axxx
3xxx Bxxx
4xxx Cxxx
5xxx Dxxx
6xxx Exxx
7800
7400
7200
7100
7080
7040
7020
7010
7008
7004
7002
7001
F800
F400
F200
F100
F080
F040
Description
And memory word to AC
Add memory word to AC
Load memory word to AC
Store content of AC in memory
Branch unconditionally
Branch and Save return address
Increment and skip if zero
Clear AC
Clear E
Complement AC
Comp e
m
Circulate right AC and E
Circulate left AC and E
Increment AC
Skip next instruction if AC positive
Skip next instruction if AC negative
Skip next instruction if AC zero
Skip next instruction if E is 0
Halt computer
Input character to AC
Output character from AC
Skip on input flag
Skip on output flag
Interrup
Inter
s0 s1 s2
7
Address
READ
AR
LD
CLR
INR
PC
LD
INR
CLR
DR
LD
Adder
& Logic
CLR
INR
AC
LD
Bus
CLR
INR
INPR
IR
TR
LD
LD
INR
CLR
OUTR
LD
Clock
Selection variables
Load input
Load input (LD): Enables the input
of a register to download bits form
the common bus. When LD = 1 for
a register, the data on the
common bus is read into the
register during the next clock pulse
transition.
> Increment input (INR): Increments the content of a register.
> Clear input (CLR): Clear the content of a register to zero.
Incompatibility in register
sizes
IR and TR
s2
s1
s0
M e m o r y u n it
4096 16
W r ite
IN R
1
C LR
P C
LD
IN R
C LR
D R
LD
A dder
and
lo g ic
Read
A R
LD
A d d re s s
B us
IN R
3
C LR
A C
LD
IN R
C LR
IN P R
IR
TR
LD
LD
IN R
C LR
O U TR
LD
1 6 - b it c o m m o n b u s
C lo c k
Computer Instruction
3 Instruction Code Formats :
1-Register-reference instruction
7xxx (7800 ~ 7001) :
CLA, CMA, .
15 14
12
11
0 1 1 1
Register Operation
2-Input-Output instruction
Fxxx(F800 ~ F040) : INP,
OUT, ION, SKI, .
15 14
12
11
I/O Operation
3-Memory-reference instruction
Opcode = 000 110
I=0 : 0xxx ~ 6xxx, I=1: 8xxx
~Exxx
15 14
12
I=0 : Direct,
I=1 : Indirect I Opcode
11
Address
Types of control
A 4-bit binary
sequence counter
(SC) to count
from 0 to 15 to
achieve time
sequencing;
> A 4x16 decoder
to decode the
output of the
counter into 16
timing signals,
T0, ..., T15
A digital circuit
with inputs
D0, ..., D7,
T0, ..., T15, I,
and address bits
in IR (11-0)
to generate
control outputs
supplied to
control inputs and
select signals of
registers , bus.
Interrupts Disabled
START
START
Fetch,
Fetch,decode
decode
Next
Next
Instruction
Instruction
Execute
Execute
Instruction
Instruction
HALT
HALT
Interrupts Enabled
Instruction cycle
Interrupt
Interrupt
cycle
cycle
T10:IA
R
P
C
M
[A
R
],P
C
P
C
1
Instruction Fetch
Instruction Fetch : T0, T1
T0 = 1
1) Place the content of PC onto the bus by making the bus
selection inputs S2S1S0=010
2) Transfer the content of the bus to AR by enabling the LD
input of AR
Continue
indefinitely
unless HALT
instruction is
encountered
T1 = 1
1) Enable the read input memory
2) Place the content of memory onto the bus by making S 2S1S0= 111
s0 s1 s2
7
Address
READ
AR
LD
CLR
INR
PC
LD
INR
CLR
DR
LD
Adder
& Logic
CLR
INR
AC
LD
Bus
CLR
INR
INPR
IR
TR
LD
LD
INR
CLR
OUTR
LD
Clock
Instruction Cycle
Controlfunction
D7`IT3:
transfer
D7`I`T3:
transfer
D7I`T3:
instruction
D7IT3:
instruction
Microoperation
ARM[AR],indirectmemory
Nothing,directmemory
Executearegisterreference
ExecuteanI/O
Decoding at T2
T2: The operation code in IR is
decoded; the indirect bit is
transferred to I; the address
part of the instruction is
transferred to AR.
REGISTER-REFERENCE INSTRUCTIONS
The 12 register-reference instructions are recognized by I = 0 and
D7 = 1 (IR(12-14) = 111). Each operation is designated by the
presence of 1 in one of the bits in IR(0-11). Therefore D7I`T3 r =
1 is common to all register-transfer instructions.
For example
For example
Memory Reference
Instructions
Computer Registers
Accumulator(AC) : takes input from ALU
The ALU takes input from DR, AC and INPR :
ADD DR to AC, AND DR to AC
Note) Input register is not connected to the bus.
The input register is connected only to the ALU
AND to AC
SC start counter
ADD to AC
Load to AC
Store AC
Branch unconditionally
D4T4: PC AR, SC 0
D6T4: DR M[AR]
D6T5: DR DR + 1
D6T6: M[AR] DR, if DR=0 then
PC PC + 1, SC 0
Computer Instruction
3 Instruction Code Formats :
1-Register-reference instruction
7xxx (7800 ~ 7001) :
CLA, CMA, .
15 14
12
11
0 1 1 1
Register Operation
2-Input-Output instruction
Fxxx(F800 ~ F040) : INP,
OUT, ION, SKI, .
15 14
12
11
I/O Operation
3-Memory-reference instruction
Opcode = 000 110
I=0 : 0xxx ~ 6xxx, I=1: 8xxx
~Exxx
15 14
12
I=0 : Direct,
I=1 : Indirect I Opcode
11
Address
Figure 5-11
Summary of memory-reference
instructions
Input-Output Configuration :
IO and Interrupt
IO instructions
Program Interrupt
Program Interrupt
Two I/O Transfer Modes
1) Programmed I/O
2) Interrupt-initiated I/O (FGI FGO)
In s tr u c tio n c y c le
= 0
F e tc h a n d d e c o d e
in s tr u c tio n
E x e c u te
in s t r u c t io n
T0'12(IEN
)FG
IO
):R
1
=1
In te r ru p t c y c le
S to re re tu rn a d d re s s
in lo c a t io n 0
M [ 0]
P C
=0
IE N
= 1
=1
B r a n c h t o lo c a t io n 1
P C
1
F G I
=0
=1
IE N
R
F G O
=0
0
0
Program Interrupt
R
T
,P
A
R
0
T
R
P
C
012:M
[C
]P
0
C
1IE
N
,R
0,SC
Save Return
Address(PC) at 0
Jump to 1(PC=1)
256
Interrupt
1120
Service Routine
BUN
SC 4 bits
OUTR,INPR 8 bits
Seven Flip-Flops
I(1 bit) S(1 bit) E(1 bit) R(1 bit) IEN(1 bit) FGI(1 bit) FGO(1 bit)
Adder and Logic circuit
connected to the AC input
ALU
16 bits