INSTRUCTION CYCLE - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

INSTRUCTION CYCLE

Description:

resuming the user program. 4-10 ... Jump to ISR and resume normal instruction cycle. When ISR is completed, restore the state of the program and resume its operation ... – PowerPoint PPT presentation

Number of Views:1919
Avg rating:3.0/5.0
Slides: 23
Provided by: kus2
Category:

less

Transcript and Presenter's Notes

Title: INSTRUCTION CYCLE


1
CHAPTER 4
  • INSTRUCTION CYCLE

2
Chapter Outline
  • Introduction
  • Fetch cycle
  • Execute cycle
  • Interrupts

3
4.1 Introduction
  • Instruction cycle refers to the processing
    performed by a CPU to execute a single
    instruction
  • Each basic cycle is made up of FETCH and EXECUTE
    cycle

Basic Instruction Cycle
4-1
4
(No Transcript)
5
Instruction Cycle State Diagram, without Interrupt
4-2
6
  • The states can be described as below-
  • Instruction address calculation (iac)
  • determine the address of the next instruction
  • Instruction fetch (if)
  • Read instruction from its memory location into
    the processor
  • Instruction operating decoding (iod)
  • Analyse instruction to determine type of
    operation to be performed and operands to be used
  • Operand address calculation (oac)
  • Determine the address of the operand

4-3
7
  • Operand fetch (of)
  • Fetch operand from memory or read it in from I/O
  • Data operation (do)
  • Perform the operation indicated in the
    instruction
  • Operand store (os)
  • Write the result into memory or out to I/O

4-4
8
4.2 Fetch Cycle
  • This cycle involves fetching of instruction from
    memory by the CPU
  • 4 registers are used
  • Program Counter (PC)
  • Memory Address Register(MAR)  
  • Memory Buffer Register (MBR)  
  • Instruction Register (IR)

4-5
9
  • The following steps are performed
  • PC holds address of the next instruction to be
    fetched
  • Processor fetches instruction from memory
    location pointed to by PC
  • Increment PC unless told otherwise
  • Instruction is loaded into IR
  • Processor interprets instruction and performs the
    required action

4-6
10
(No Transcript)
11
4.3 Execute Cycle
  • Processor-memory
  • Data transfer between CPU and MM
  • Processor I/O
  • Data transfer between CPU and I/O modules
  • Data Processing
  • Some arithmetic or logical operation on data
  • Control
  • Alteration of sequence of operations eg. JUMP
  • Combination of the above

4-7
12
  • An example

Example of program execution
4-8
13
4.4 Interrupts
  • The mechanism by which other system modules may
    interrupt the normal processing of the CPU
  • These devices are 1-10 orders of magnitude slower
    than the CPU
  • There are 3 different types of interrupts
  • Internal due to invalid data / instructions
  • External normally from I/O devices
  • Software used by the OS

4-9
14
  • Interrupts let the CPU
  • execute its normal instruction sequence and
  • pause to service the external devices
  • ONLY when they signal that they
  • are ready for the CPUs attention
  • The processor and OS are responsible for
  • recognizing an interrupt,
  • suspending the user program,
  • servicing the interrupt and then
  • resuming the user program

4-10
15
  • Interrupts are processed in an interrupt cycle
    within the overall instruction cycle
  • At the end of an instruction cycle, check to see
    if any interrupts are pending
  • If there arent any,proceed with the next
    instruction
  • If there are interrupts
  • Suspend execution of the program and save its
    state
  • Jump to ISR and resume normal instruction cycle
  • When ISR is completed, restore the state of the
    program and resume its operation

4-11
16
Instruction Cycle State Diagram, with Interrupt
4-13
17
Transfer of control via interrupt
4-14
18
  • A typical system can support multiple interrupts
  • If more than 1 interrupts occur at the same
    time-
  • Systems prioritize the various interrupts
  • At the start of the interrupt cycle, the highest
    priority pending interrupt will be serviced
  • Remaining interrupt requests will be serviced in
    turn

4-15
19
  • If an interrupt occur while an ISR is being
    executed then
  • Ignore the second interrupt until the ISR
    completes e.g. MC68HC11 controller
  • Recognize and service the interrupt only if it
    has a higher priority than the one currently
    being serviced e.g. 8085

4-16
20
Sequential Interrupt Processing
Nested Interrupt Processing
4-17
21
Program Flow of Control without and with Interrupt
4-18
22
Chapter Exercises
  • Design issues with multiple modules and thus
    multiple interrupts..
  • How does the CPU determine which device caused
    the interrupt?
  • If multiple interrupts occur at the same time,
    which is processed first?
Write a Comment
User Comments (0)
About PowerShow.com