Professional Documents
Culture Documents
Dhiraj Shrestha
INRODUCTION
2
GENERAL REGISTER ORGANIZATION
3
4
GENERAL REGISTER ORGANIZATION
5
STACK ORGANIZATION
6
STACK ORGANIZATION
7
STACK ORGANIZATION
Reverse Polish Notation(RPN)
⚫ Infix Notation- operator is written between two operand A + B
⚫ Prefix Notation- operator is written before two operand +AB
⚫ Postfix/reverse polish Notation- operator is written after two
operand AB+
⚫ RPN is suitable for stack manipulation
⚫ Expression: A×B + C×D
⚫ RPN: AB×CD×+
8
STACK ORGANIZATION
Conversion to RPN
1. Print operands as they arrive.
2. If the stack is empty or contains a left parenthesis on top, push the incoming operator onto the stack.
4. If the incoming symbol is a right parenthesis, pop the stack and print the operators until you see a left
parenthesis. Discard the pair of parentheses.
5. If the incoming symbol has higher precedence than the top of the stack, push it on the stack.
6. If the incoming symbol has equal precedence with the top of the stack, use association. If the association
is left to right, pop and print the top of the stack and then push the incoming operator. If the association
is right to left, push the incoming operator.
7. If the incoming symbol has lower precedence than the symbol on the top of the stack, pop the stack and
print the top operator. Then test the incoming operator against the new top of stack.
8. At the end of the expression, pop and print all operators on the stack. (No parentheses should remain.)
9
STACK ORGANIZATION
10
STACK ORGANIZATION
11
INSTRUCTION FORMAT
Fields in Instruction Formats
⚫ 1) Operation Code Field : specify the operation to be
performed
⚫ 2) Address Field : designate a memory address or a
processor register
⚫ 3) Mode Field : specify the operand or the effective
address (Addressing Mode)
12
13
INSTRUCTION FORMAT
14
INSTRUCTION FORMAT
15
INSTRUCTION FORMAT
16
ADDRESSING MODE
18
ADDRESSING MODE
1. Implied / Immediate Addressing mode (AM)
Operand = A
2. Direct AM
19
ADDRESSING MODE
EA = (A)
Indirect AM
Register direct AM
EA = R
20
ADDRESSING MODE
3. Register Indirect AM
EA = ( R )
4. Displacement AM
EA = A + (R)
21
ADDRESSING MODE
4 a) Relative Address mode
EA = A + (PC)
b) Indexed Addressing mode
EA = A + (IR) IR= Index register
c) Base register Addressing mode
EA = A + (BR) BR= Base register
22
23
Mode Algorithm Principal Advantage Principal
Disadvantage
Immediate Operand = A No memory Limited operand
reference magnitude
Direct EA = A Simple Limited address
space
Indirect EA = (A) Large address space Multiple memory
references
Register EA = R No memory Limited address
reference space
Register Indirect EA = (R) Large address space Extra memory
references
Displacement EA = A + (R) Flexibility Complexity
Stack EA = top of stack No memory Limited applicability
reference
24
DATA TRANSFER AND MANIPULATION
25
26
27
28
PROGRAM CONTROL
29
PROGRAM CONTROL
30
RISC AND CISC
Read yourself characteristics of RISC and CISC
Architecture
31
END of Chapter 6
32