Co&a Unit 3
Co&a Unit 3
BASIC ORGANIZATION- 1
CONTENTS
General register organization
ALU
Instruction codes
Instruction format
Stack organization
Addressing modes
Registers
ALU
Control Unit
Control bus
Address bus
COMPUTER ORGANISATION AND ARCHITECTURE
BY PROF. SHINDE M.D. 5
REGISTERS
• A control unit operates by fetching instructions from
memory and executing them one at a time.
• Fig shows the memory format of the processor
0 1 39
a. Number Word
0 8 20 28 39
1. General purpose
2. Data
3. Address
4. Condition codes
Data Registers
• These registers may be used only to hold data and can not be
employed in the calculation of an operand address.
Conditional codes
• Referred as flags.
• These are bits set by the processor hardware as the result of
operations.
PC
IR
MAR
MBR
Flags
Control Unit
ALU
Registers Registers
Add (A+B)
Add with Carry (A+B+Cin) Not A
Subtract (A-B) Not B
Subtract with Borrow (A-B-Cin) A
[Subract reverse (B-A)]
B
[Subract reverse with Borrow (B-A-Cin)]
Negative A (-A) Multiply Step or Multiply
Negative B (-B) Divide Step or Divide
Increment A (A+1)
Mask
Increment B (B+1)
Decrement A (A-1) Conditional AND/OR (uses
Decrement B (B-1) Mask)
Logical AND Shift
Logical OR Zero
Logical XOR
COMPUTER ORGANISATION AND ARCHITECTURE
BY PROF. SHINDE M.D. 17
• The encoding of the ALU operations for the CPU is
specified in table below.
• The OPR has five bits and each operation is designed
with a symbolic name.
OPR Select Operation Symbol
00000 Transfer A TSFA
00001 Increment A INCA
00010 Add A+B ADD
00101 Subtract A-B SUB
00110 Decrement A DECA
01000 AND A and B AND
01010 OR A and B OR
01100 XOR A and B XOR
01110 Complement A COMA
10000 Shift right A SHRA
11000 Shift left A SHLA 18
COMPUTER ORGANISATION AND ARCHITECTURE BY PROF. SHINDE M.D.
• Example Of Operation:
• R1 R2 – R3
• They are
-Operation code and
-operands.
• The most basic part of an instruction code is its operation
part
• The control unit decode the OpCode and do the required operation.
Instruction: POP X
PUSH A
PUSH B
ADD
PUSH C
PUSH D
ADD
MUL
POP X
• Microoperation: AC ¬ AC + M[X]
LOAD A AC M [ A]
ADD B AC AC M [ B]
STORE T M [T ] AC
All operations are done between the AC register and memory operand
Microoperation: R1 R1 + R2
MOV R1, A R1 M [ A]
MOV R2, B R 2 M [ B]
ADD R1, R2 R1 R1 R 2
MOV X, R1 M [ x] R1
• Three address instructions: Memory addresses for the two operands and
one destination need to be specified.
Microoperation: R1 R2 + R3
ADD R1, A, B
R1 M[A] + M[B]
ADD R2, C, D
R2 M[C] + M[D]
MUL X, R1, R2
M[X] R1 * R2
• A stack can be
organized as a
collection of a finite
number of registers.
Initialization
SP 0, EMPTY 1, FULL
0
Push
SP SP + 1
M[SP] DR
If (SP = 0) then (FULL 1)
Note that SP becomes 0 after 63
EMPTY 0
Pop
DR M[SP]
SP SP - 1
IF (SP = 0) THEN (EMPTY
1)
FULL 0
(EXAMPLE)
INFIX NOTATION A+B
REVERSE POLISH NOTATION AB+ ALSO CALLED POSTFIX.
A * B + C * D (AB *)+(CD *) AB * CD * +
( 3 * 4 ) + ( 5 * 6 ) 34 * 56 * +
(EXAMPLE)
INFIX 3 * 4 + 5 * 6 = 42
POSTFIX 3 4 * 5 6 * +
12 5 6 * +
12 30 +
42
stack evaluation:
Get value
If value is data: push data
Else if value is operation: pop, pop
evaluate and push.