Professional Documents
Culture Documents
R1 R2 + R3
Field:
SELA SELB SELD OPR
Symbol: R2 R3
R1 ADD
Control
Word:
010 011 001 00010
R1
R2
R4
R5
R1
R2
R2 + R3 : 010
R2 - R3 : 010
R4 R5 : 100
R5 + R6 : 101
R2
: 010
R1 + R3 : 001
011
011
101
110
000
011
001
010
100
101
001
010
00010
00101
01000
00010
00000
00010
The Stack
LIFO(Last-In First-Out) List
1) Stand-alone stack
2) Memory stack
1
The push operation
If FULL = 0
SP SP + 1
M[SP] DR
If (SP = 0 ) then (FULL 1)
EMTY 0
Else Stack-Overflow
Stand-alone stack
If EMTY = 0
DR M[SP]
SP SP - 1
If (SP = 0 ) then (EMTY 1)
FULL 0
Else Stack-Underflow
1
The push operation
3000 ULR
If SP LLR
SP SP + 1
M[SP] DR
If (SP = LLR) then (FULL 1)
EMTY 0
Else Stack-Overflow
Upper-Limit Register
Memory stack
If SP ULR
DR M[SP]
SP SP - 1
If (SP < ULR) then (EMTY 1)
FULL 0
Else Stack-Underflow
34*56*+
R1, A : R1 M[A]
R1, B : R1 R1 + M[B]
R2, C
R2, D
R1, R2
X, R1
Memory operation
Register operation
Memory operation
1
The purpose of Addressing Modes
1) Programming versatility( )
pointers to memory, counters for loop control,
indexing of data, program relocation
2) Reduction of the number of bits
in the addressing field
Addressing Modes
Implied Mode
CMA, ADD
Immediate Mode
R1 2
Register Mode
R1 R1 + 2
R1 R1 + M[R2], R2 R2 + 1
Addressing Modes
BR
R1 M[AD]
R1 M[M[AD]]
(PC-)Relative
Address Mode
R1 M[AD+PC]
R1 M[AD+XR]
AD
XR
1
Computer Instructions
1. Data transfer
2. Data manipulation
3. Program control
LD @PTR
LD $DIF
LD #395
B
-
AH
AL
BH
BL
-------------CH
CL
SUB
A = 101x1100
B = 00010000
If A B = 0, x = 0
If A B 0, x = 1
111000000
A: 11110000
B + 1 : +1 1 1 0 1 1 0 0
-----------------------A-B: 11011100
C(c8) = 1
S(F7) = 1
B:
V(c8c7) = 0
00010100
Z=0
1) Unsigned numbers
A = 240, B = 20, A-B = 220
A-B = A+(2n B), C = 1 and Z = 0 A > B
2) Signed numbers
A = -16, B = 20, A-B = -36
S = 1, V = 0, Z = 0 A < B
Program Interrupt
The state of the CPU should be saved
1. The content of the program counter: PC(Subroutine Call
)
2. The content of all processor registers: AC, E
3. The content of certain status conditions: S, V, C, Z
PSW(Program Status Word)
Types of Interrupt
1. Hardware interrupts
External : power, I/O device
Internal : Stack-overflow, divide-by-zero
2. Software interrupts : OS call(Read, Write)
CISC Characteristics
1.
2.
3.
4.
5.
6.
Computer Architecture
A Quantitative Approach
RISC Characteristics
1.
2.
3.
4.
5.
6.
7.
8.
9.
1
overlapped register windows
Berkeley RISC I
ADD R22, R21, R23 : R23 R22 + R21
ADD R22, #150, R23 : R23 R22 + 150
ADD R0, R21, R22 : R22 R21 (Move)
ADD R0, #150, R22 : R22 150 (Load immediate)
ADD R22, #1, R22 : R22 R22 + 1