coe 1502 interrupt and exception handling
Download
Skip this Video
Download Presentation
COE 1502 Interrupt and Exception Handling

Loading in 2 Seconds...

play fullscreen
1 / 12

COE 1502 Interrupt and Exception Handling - PowerPoint PPT Presentation


  • 86 Views
  • Uploaded on

COE 1502 Interrupt and Exception Handling. Interrupts and Exceptions. Events other than branches that change the normal flow of instruction execution Exceptions Unexpected event from inside the processor Arithmetic overflow, divide-by-zero Invalid instruction (bus error)

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' COE 1502 Interrupt and Exception Handling' - imala


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
interrupts and exceptions
Interrupts and Exceptions
  • Events other than branches that change the normal flow of instruction execution
    • Exceptions
      • Unexpected event from inside the processor
        • Arithmetic overflow, divide-by-zero
        • Invalid instruction (bus error)
        • L/S address error (misalignment, attempted access to protected memory)
        • Reserved/privileged instruction
        • Syscall (invoking the OS from user program)
        • Breakpoint
    • Interrupts
      • Unexpected event from outside the processor
        • I/O device request
        • Timer
  • Additional information
    • H&P text
exceptions
Exceptions
  • We will implement:
    • Arithmetic overflow
      • add, addi, sub
      • Use overflow output from ALU
      • Write-back result?
    • System call
      • OS services
        • I/O, process control, process synchonization
    • Invalid instruction
      • Invalid opcode/function code
      • Lowest priority, unconditional transitions
interrupts
Interrupts
  • Must implement way for external devices to get the processor’s attention
    • Assume 1 external interrupt
    • Signals processor through IRQ input
    • Processor signals completion through IACK output
      • Want to complete current instruction before servicing interrupt
interrupts and exceptions1
Interrupts and Exceptions
  • What to do?
    • Execute code in response to event (handler)
      • Save PC (EPC reg,)
      • Record cause (Cause reg.)
      • Disable e/i (shift Status reg.)
      • Set new PC (4)
    • Return from handler
      • Restore PC
      • Enable e/i (shift Status reg.)
  • Determining type of exception
    • Use vectored exceptions
      • Infer type from address
    • Use polled exceptions
      • Use Cause register
      • This is what MIPS does
required hardware
Required Hardware
  • Hardwired handler address
  • EPC register
    • Address of instruction that caused exception + 4 (PC)
  • Cause register
    • 32-bit register that holds cause of exception
  • Status register (shiftable)
    • Use for disabling interrupts and exceptions
  • Additional control and datapaths
cause register
Cause Register
  • Use last 2 bits…
status register
Status Register
  • Use last 4 bits…
control
Control
  • When an exception or interrupt occurs, must have a state where…
    • EPC <= PC
    • Cause <= (cause)
    • Status <= Status << 4
    • PC <= (handler address)
  • Return…
    • PC <= EPC
    • Status >> 4
  • How to add states?
required instructions
Required Instructions
  • EPC, Status, and Cause registers
    • Instruction set treats these registers as being on coprocessor 0
      • Status (12), Cause (13), and EPC (14)
    • To use these registers, we’ll implement two instructions:
      • mfc0 rt, rd
      • mtc0 rd, rt
      • Datapath analysis for these instructions?
required instructions1
Required Instructions
  • Also, we need a syscall instruction to implement system calls
    • Syscall call value in $v0
  • Return from exception (rfe instruction)
ad