Computer Organization Architecture - Topic 4
Computer Organization Architecture - Topic 4
Role of Register
Type of
statement • User visible
Register
• Control Status
CPU Register
Organization
Assembly
Language
Element Register
Organization
Fetch
CENTRAL
PROCESSING Indirect
Instruction
UNIT Cycle
Expression
evaluation
(Infix, Stack Interrup
Postfix) Immediate
Displacement t Execute
Addressing
• PC Relative
• Index Register
• Base Register Direct
Addressing
Operation
(PUSH, Addressing
Register-
POP)
Indirect
Mode
Addressing Indirect
Addressing
Register-
Direct
Addressing
INTRODUCTION
• CPU is a single microprocessor made from a
semiconducting material (silicon)
• Main function perform arithmetic and logical
operations on data
• Controlled by a computer program
Task of CPU
CPU reads an instruction from
Fetch instructions memory
CU
• Controls the movement of data, instructions and the operation of ALU
Register
• A set of storage locations
CPU Interconnection
• Internal processor bus - The data transfer and logic control paths
REGISTER ORGANIZATION
• Enable to minimize
User- main memory
Visible references by
Register optimizing use of
registers
Role of
Register
• Used to control the
Control operation of the
And Status processor and to
Register control the execution
of programs
User- Visible Register
• Can be assigned to a variety
functions • Used only to hold data
• Contain the operand for any • Cannot be employed in the
op-code calculation
• Used for addressing function General
Data
Purpose
Register
Register
Condition
Codes Address
Register Register
• May be devoted to a
(or Flags)
• Condition codes are bits set addressing mode
• Example: segment pointers,
by the processor hardware
index registers, stack
pointer
Control And Status Register
• Function: To control the operation of the processor
• Registers:
Memory Buffer
Program Counter Instruction Memory Address
Register
(PC) Register (IR) Register (MAR)
(MBR/MDR)
Contains the
Contains the Contains a
address of Contains the
instruction word of data
an address of a
most to be written
instruction location in
recently or most
to be memory
fetched recently read
fetched
INSTRUCTION CYCLE
Read the next
Save the current
instruction from
process state and FETCH
memory
service the interrupt
INTERRUPT INDIRECT
The instruction is
EXECUTE
decoded to determine
Interpret the opcode
what action is
and perform the
required
operation
Data Flow
• The exact sequence of events during an instruction cycle
depends on the design of the processor
• Connected to • Connected to data
address line Memory lines
• Specifies the Memory Buffer • Contains the value
Address
address for a read Register (MBR) to be stored or the
or write operation Register (MAR) last value read from
memory
7
PC is incremented by 1,
1
prepare for the next
fetch An instruction to be
fetched from
memory
5
6
The result is placed
Then copied into the MBR on the data bus
and then moved to the IR
3
Get the desired
address of the
operand into the MBR
Register
Displacement Stack
Indirect
• For the purpose of references, we use notation:
Program Index
Counter Register
(PC) (XR)
Base
Register
(B)
• It requires that the instruction have two address fields:
• Address field 1: Contain value = A, used directly
• Address field 2: Contain a register, the contents are added
to A to produce the effective address
• Three addressing technique:
Infix Postfix
Notation Notation
@ Reverse Polish
Method Notation
Infix Notation
• Mathematical formulas are expressed in infix
notation
• A binary operator appears between the operands
(e.g. A + B)
• For complex expressions, parentheses are used to
determine the order of evaluation of expressions
• To minimize the use of parentheses, operations
have an implied precedence
Postfix Notation
• The operator follows its two operands
• Example
a+b ab+
a + (b x c) a b c x +
(a + b) x c a b + c x
• No parentheses are required
• Advantage: An expression in this form is easily
evaluated using a stack
• Example: f = (a - b) / (c + d * e)
• Solution:
(a - b) / (c + d * e)
a b - c d e * + /
• Procedure for Postfix notation
2a
Variable or
2 constant: Push 3
it onto the stack
After the
expression has
Scan for each of been scanned,
1
element: the result is on
Operator: Pop the top of the
An expression is the top two stack
scanned from items, perform
left to right the operation,
and push the
result
2b
• Example: f = (a - b) / (c + d * e)
• Solution: a b – c d e * + /
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
a
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
b
a
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
c
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
d two items, perform the
operation, and push
the result
c
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
e • Variable or constant:
Push it onto the stack
• Operator: Pop the top
d two items, perform the
operation, and push
the result
c
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
d*e two items, perform the
operation, and push
the result
c
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
(d * e) + c
a–b
• Solution: a b – c d e * + /
Remember!!
If the element is ..
• Variable or constant:
Push it onto the stack
• Operator: Pop the top
two items, perform the
operation, and push
the result
a–b
(d * e) + c
ASSEMBLY LANGUAGE
Augmented by additional
A symbolic representation of types of statements that
the machine language facilitate program writing
Assembly
Language
Each instruction is
translated into machine
Provide instructions to the instruction by the
assembler assembler
Advantages: Disadvantages:
• Debugging and verifying • Development time
• Making compilers • Reliability and security
• Embedded systems • Maintainability
• Hardware drivers and • Portability
system code
• Function libraries:
Assembly Language Elements
Example:
Label Mnemonic
• Equivalent to the address • The name of the operation
of the object code or function of the
generated for the loaded assembly language
instruction statement
• Used as an address or as • The symbolic name
data in another associated with an opcode
instruction’s address field
• The assembler replaces
the label with the
assigned value
Operand(s)
• Each operand identifies an immediate value, a register
value, or a memory location
• Three types of operand references
• Register addressing Refers to the name of the register
that is used in the instruction
• Immediate addressing Indicates that the value is
encoded in the instruction
• Direct addressing Refers to a memory location and is
expressed as a displacement from the DS register
Comment
• Occur at the right-hand
end of statement or can
occupy an entire text line
• It begins with a special
character that signals to
the assembler - to be
ignored by the assembler
• Use a semicolon (;)
Type of Assembly Language Statements
Instruction
Macro
definition
Instructions
Define constants
Designate areas of memory for data storage
Examples: Initialize areas of memory
Place tables or other fixed data in memory
Allow references to other programs
Macro Definitions