CSCE 611: Interrupts and Exception Handling - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

CSCE 611: Interrupts and Exception Handling

Description:

Invalid instruction or fetch alignment error (bus error) ... Use polled exceptions. Use Cause register. This is what MIPS does. CSCE 611 6. Required Hardware ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 14
Provided by: jasond9
Category:

less

Transcript and Presenter's Notes

Title: CSCE 611: Interrupts and Exception Handling


1
CSCE 611Interrupts and Exception Handling
  • Instructor Jason D. Bakos

2
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 or fetch alignment error (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

3
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

4
Interrupts
  • Must implement way for external devices to get
    the processors attention
  • Assume 1 external interrupt
  • Signals processor through IRQ input
  • Processor signals completion through IACK output
  • Want to complete current instruction before
    servicing interrupt

5
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

6
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

7
Cause Register
  • Use last 2 bits

8
Status Register
  • Use last 4 bits

9
Control
  • When an exception or interrupt occurs, must have
    a state where
  • EPC lt PC
  • Cause lt (cause)
  • Status lt Status ltlt 4
  • PC lt (handler address)
  • Return
  • PC lt EPC
  • Status gtgt 4
  • How to add states?

10
Required Hardware
11
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, well implement two
    instructions
  • mfc0 rt, rd
  • mtc0 rd, rt
  • Datapath analysis for these instructions?

12
Required Instructions
  • Also, we need a syscall instruction to implement
    system calls
  • syscall
  • Syscall call value in v0
  • Return from exception
  • rfe

13
Notes
  • Due date is Friday, April 27
  • What to turn in
  • Waves from testbench run
Write a Comment
User Comments (0)
About PowerShow.com