Professional Documents
Culture Documents
Computer Function: 1. Reading (Fetching) Instruction From Memory by CPU 2. Execution of Each Fetched Instruction
Computer Function: 1. Reading (Fetching) Instruction From Memory by CPU 2. Execution of Each Fetched Instruction
• CPU-memory
Data transfer between CPU and main memory.
• CPU-I/O
Data transfer to or from outside world by transferring
between CPU and I/O module.
• Data processing
Some arithmetic or logical operation on data.
• Control
An instruction may specify alteration of sequence of
execution, e.g. jump
• Execution cycle for a particular instruction
may involve more than one reference to
memory or it may specify an I/P operation.
• So a detailed state diagram of instruction is
as follows.
• Instruction Address Calculation (iac): Determines address of
next instruction to be executed.
• Instruction Fetch (if): Read instruction from memory
location into CPU.
• Instruction Operation Decoding (iod): Determines the type
of operation to be performed and operands to be used.
• Operand Address Calculation (oac): Determines the address
of operand (operand may be referenced from memory or
available via I/O) .
• Operand Fetch (of): Fetches the operand from memory or
reads it from I/O.
• Data Operation (do): Performs the operation indicated in
instruction.
• Operand Store (os): write the result into memory or to I/O.
Interrupts
• A signal informing a program that an event has occurred.
• All computers provide a mechanism by which other modules may
interrupt the normal processing of CPU.
• List of common classes of interrupts are :
1. Program: Generated by some condition that occurs
because of an instruction execution. E.g. arithmetic
overflow, division by zero, reference outside a user’s
allowed memory space.
2. Timer: Generated by timer within the processor.
3. I/O: Generated by I/O controller
4. Hardware failure: Generated by a failure such as power
failure or memory parity error.
• Interrupts are provided primarily to improve processing
efficiency.
• From the point of view of user program, an interrupt is just
an interruption of normal sequence of execution.
• If the CPU is idle, interrupt is served.
• When interrupt processing is completed, execution resumes.
• The processor and the operating system are responsible for
suspending the user program and then resuming it at the same
point.
Interrupt Cycle
• Define priorities
– Low priority interrupts can be interrupted by higher
priority interrupts
– When higher priority interrupt has been processed,
processor returns to previous interrupt