Professional Documents
Culture Documents
Immediate
Memory Reference
Direct
Indirect
Register Reference
Register
Register Indirect
Displacement
Indexed
Base
Relative
Stack
1) Immediate Addressing
2) Direct Addressing
3) Indirect Addressing
Memory cell pointed to by address field contains the address of (pointer to) the
operand
EA = (A)
Look in A, find address (A) and look there for operand
e.g. ADD (A)
Add contents of cell pointed to by contents of A to accumulator
Large address space
2n where n = word length
May be nested, multilevel, cascaded
e.g. EA = (((A)))
Draw the diagram yourself
Multiple memory accesses to find operand
Hence slower
4) Register Addressing
5)
6)
Displacement Addressing
EA = A + (R)
Address field hold two values
i. A = base value
ii. R = register that holds displacement
iii. or vice versa
Indexed Addressing
A = base
R = displacement
EA = A + R
Base Addressing
Same as indexed mode except that indexed register is replaced with base address
register.
Relative Addressing
R = Program counter, PC
EA = A + (PC)
Ex: LDAC $5
Assumes that this instruction is locked at memory location 9 and it takes up two
memory locations where the next instruction is at location 12. Then the instruction
reads data from location 5+12=17 and stores it in the Accumulator.
7) Stack Addressing:
Interrupts
When a Process is executed by the CPU and when a user Request for another
Process then this will create disturbance for the Running Process. This is also called as
the Interrupt.
The sequence of events is usually like this:
1. Hardware signals an interrupt to the processor
2. The processor notices the interrupt and suspends the currently running Program
3. The processor jumps to the matching interrupt handler function in the OS
4. The interrupt handler runs its course and returns from the interrupt
5. The processor resumes where it left off in the previously running software
Types of Interrupt:
1) Internal Interrupt (Exception)
2) Hardware Interrupt.
3) Software Interrupt.
1)
For Example When a user performing any Operation which contains any Error and
which contains any type of Error. So that Internal Interrupts are those which are
occurred by the Some Operations or by Some Instructions and the Operations
those are not Possible but a user is trying for that Operation
Two Sources:
1) Processor- Detected Exception
These types of exception are generated when the CPU encounters an error while
attempting to execute an instruction. These errors do not allow the process to be
executed.
Reasons:
1) Faults ( Debugging) Correctable
2) Traps ( Addressing Error) Debugged
3) Aborts ( Arithmetic error, hardware failure , CPU send the appropriate signal to
kill that process)
2) Programmed exception:
These types of exception occur when the programmer makes logic or syntactical
mistakes. It would be illegal to execute the instruction.
Ex:
1) Reading from an unavailable memory unit
2) Detected before incrementing the IP
3) Executing a privileged Instruction
2) Hardware Interrupt (External Interrupt)
The External Interrupt occurs when any Input and Output Device request for any
Operation and the CPU will Execute that instructions first For Example When a
Program is executed and when we move the Mouse on the Screen then the CPU
will handle this External interrupt first and after that he will resume with his
Operation
I/O devices tell the CPU that an I/O request has completed by sending
an interrupt signal to the processor.
I/O errors may also generate an interrupt.
Most computers have a timer which interrupts the CPU every so many interrupts
the CPU every so many milliseconds
Maskable Interrupt: These interrupts are block (does not recognize) able like
Disk, Clock and Network interrupts unless the interrupt enable Flag is Set.
Non-maskable Interrupts: These interrupts are non-block (Recognize) able like
power failure, bus time out etc.
3)
Software Interrupt:
1) MARPC
2) MDRMemory
3) PCPC+1
4) IRMDR
The next step is for the CPU to make sense of the instruction it has just
finished.
The CPU Decodes the instruction and prepares various areas within the chip
in readiness of the next step
Start
Fetch
Next
Instructio
Decode
Instructio
n
Execute
Instructio
n
Stop
Control Unit:
The control unit of CPU is used to supervise the operations of the processor.
It builds connections (Coordinates) between various components of the computer
system.
Coordinates the movement of data to and from IO devices, memory units and
registers.
The CU operates according to the program stored by receiving and executing its
instructions one at a time.
Inputs to CU
1) Clock Signal
2) Instruction Register
3) Flag
4) Control Bus
Outputs of CU
1) It causes data movement and activates some specific functions within the CPU.
2) Sends control signals to memory and IO modules via control bus.
Types of Control Unit
Hardwired Control Unit
It uses flags, decoder, logic gates and
Software.
It generates a set of control signal on the
generated.
Difficult to design, test and implement
Inflexible to modify.
Faster mode of operation
Expensive and high error
Used in RISC processor
RISC
CISC
Computers
Computers
Complexity
Smaller instruction
Larger Instruction
Operating Speed
Faster
Slower
Fixed Length
Instructions
size
same size
Acronym
Dependency
Clock Signals
instruction
instruction
Large number of
Registers
additional registers
Compiler Design
Easy to design
Hard to Design
Code Size
Instruction length
MLL)
ALL)
execute)
Cycle.
Pipelining
Less use
Maximum Use
Optimizing Compiler
Instruction
Summary:
Pipelining:
Fetching instructions from memory takes long time which is major problem of
instruction execution speed.
It is more useful of wastage of time in fetching from the memory and thus
improves the system performance.