ECE332, Week 8. Topics. October 15, Exceptions. Hardware Interrupts Software exceptions

Similar documents
An overview of Interrupts ECE3534

Interfacing. Introduction. Introduction Addressing Interrupt DMA Arbitration Advanced communication architectures. Vahid, Givargis

Module 3. Embedded Systems I/O. Version 2 EE IIT, Kharagpur 1

Interface Synthesis. Communication Synthesis

PC Interrupt Structure and 8259 DMA Controllers

Types of Interrupts:

6.1 Introduction. 6.2 Timing diagrams 6-1. Chapter 6: Interfacing

Interrupts Peter Rounce - room 6.18

9. PIO Core. Core Overview. Functional Description

Introduction to Embedded Systems. Lab Logistics

8085 Microprocessor Architecture and Memory Interfacing. Microprocessor and Microcontroller Interfacing

Interrupts Peter Rounce

Microprocessors & Interfacing

These three counters can be programmed for either binary or BCD count.

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: Interrupt Handling Module No: CS/ES/13 Quadrant 1 e-text

EEL 4744C: Microprocessor Applications. Lecture 7. Part 1. Interrupt. Dr. Tao Li 1

Reading Assignment. Interrupt. Interrupt. Interrupt. EEL 4744C: Microprocessor Applications. Lecture 7. Part 1

Interrupts (I) Lecturer: Sri Notes by Annie Guo. Week8 1

Introduction to Embedded Systems

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

EEL 4744C: Microprocessor Applications. Lecture 7. Part 2. M68HC12 Interrupt. Dr. Tao Li 1

ECE332, Week 2, Lecture 3. September 5, 2007

ECE332, Week 2, Lecture 3

INTERRUPTS in microprocessor systems

8086 Interrupts and Interrupt Responses:

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

ECE 341. Lecture # 19

Newbie s Guide to AVR Interrupts

SISTEMI EMBEDDED. (Software) Exceptions and (Hardware) Interrupts. Federico Baronti Last version:

CHAPTER 11 INTERRUPTS PROGRAMMING

Interrupts. by Rahul Patel, Assistant Professor, EC Dept., Sankalchand Patel College of Engg.,Visnagar

Laboratory Exercise 4

Input/Output Programming

EE414 Embedded Systems. Ch 6. Interfacing. Part 4/4: DMA & Arbitration

Microprocessors B (17.384) Spring Lecture Outline

Lab 5 Simple Interrupts. ECE 375 Oregon State University Page 37

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places

Today: Computer System Overview (Stallings, chapter ) Next: Operating System Overview (Stallings, chapter ,

27 December 2016 Pramod Ghimire. Slide 1 of 16

Active Serial Memory Interface

Interrupt is a process where an external device can get the attention of the microprocessor. Interrupts can be classified into two types:

Embedded Systems. Input/Output Programming

Input / Output. School of Computer Science G51CSA

LatticeMico32 GPIO. Version. Features

Pin Description, Status & Control Signals of 8085 Microprocessor

Interrupts. How can we synchronize with a peripheral? Polling

MACHINE CONTROL INSTRUCTIONS: 1. EI

COSC 243. Input / Output. Lecture 13 Input/Output. COSC 243 (Computer Architecture)

Process Scheduling Queues

8085 Interrupts. Lecturer, CSE, AUST

Nios PIO. General Description. Functional Description

MP Assignment III. 1. An 8255A installed in a system has system base address E0D0H.

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

ECEN 449 Microprocessor System Design. Hardware-Software Communication. Texas A&M University

Reset, Interrupts, Exceptions, and Break ECE 3534

CSC227: Operating Systems Fall Chapter 1 INTERRUPTS. Dr. Soha S. Zaghloul

ECE 485/585 Microprocessor System Design

Lecture 10 Exceptions and Interrupts. How are exceptions generated?

Bringing Organization to our Code (the shared-data problem)

EKT222 Miroprocessor Systems Lab 5

Interfacing. Embedded Systems Design: A Unified Hardware/Software Introduction, (c) 2000 Vahid/Givargis

ECE331: Hardware Organization and Design

INPUT/OUTPUT ORGANIZATION

Interrupt Basics Karl-Ragmar Riemschneider

CS252 S05. Main memory management. Memory hardware. The scale of things. Memory hardware (cont.) Bottleneck

CS 134. Operating Systems. April 8, 2013 Lecture 20. Input/Output. Instructor: Neil Rhodes. Monday, April 7, 14

Real Time Embedded Systems. Lecture 10 January 31, 2012 Interrupts

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

Interrupts in Zynq Systems

538 Lecture Notes Week 5

A First Look at Microprocessors

Course Introduction. Purpose: Objectives: Content: 27 pages 4 questions. Learning Time: 20 minutes

Interrupt: (verb) the interruption of a CPU s normal processing...using a mechanism provided for this purpose.

(1) Define following terms: Instruction, Machine Cycle, Opcode, Oprand & Instruction Cycle. Instruction:

ECE 1160/2160 Embedded Systems Design. Midterm Review. Wei Gao. ECE 1160/2160 Embedded Systems Design

Microprocessors and Microcontrollers (EE-231)

University of Toronto Faculty of Applied Science and Engineering Department of Electrical and Computer Engineering Final Examination

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

Fixed-Point Math and Other Optimizations

MICROPROCESSOR MEMORY ORGANIZATION

Figure 1. Software interface generated by Nios IDE - 1 -

Real-Time Programming

ECE251: Thursday September 27

by I.-C. Lin, Dept. CS, NCTU. Textbook: Operating System Concepts 8ed CHAPTER 13: I/O SYSTEMS

538 Lecture Notes Week 5


EECS 373 Design of Microprocessor-Based Systems

EXAM (Tentamen) TDDI11 Embedded Software. Good Luck! :00-12:00. On-call (jour): Admitted material: General instructions:

Interrupt/Timer/DMA 1

CPUs. Input and output. Supervisor mode, exceptions, traps. Co-processors. Computers as Components 4e 2016 Marilyn Wolf

AE68 EMBEDDED SYSTEMS DESIGN DEC 2014

For more notes of DAE

2. List the five interrupt pins available in INTR, TRAP, RST 7.5, RST 6.5, RST 5.5.

Programming the 8259 PIC: A Tech-Tip Example and Boilerplate

Interrupts L33-1. Interrupts

I/O Devices. Nima Honarmand (Based on slides by Prof. Andrea Arpaci-Dusseau)

Lecture 23: Storage Systems. Topics: disk access, bus design, evaluation metrics, RAID (Sections )

There are different characteristics for exceptions. They are as follows:

Special Topics for Embedded Programming

CS 104 Computer Organization and Design

Transcription:

ECE332, Week 8 October 15, 2007 1 Topics Exceptions Hardware Interrupts Software exceptions Unimplemented instructions Software traps Other exceptions 2 1

Exception An exception is a transfer of control away from a program s normal flow of execution Caused by an event, either internal or external to the processor Requires immediate attention 3 Reference Textbook Section 6.4 Nios II Software Developer s Handbook Chapter 7 - Exception Handling Nios II Processor Reference Handbook Page 2-6 to 2-7, and Page 3-5 to 3-10 Quartus II Version 7.1 Handbook Volume 5: Embedded Peripherals Chapters 7, 8, 13, and 14 4 2

Review: Questions on this? typedef unsigned int REGISTER; struct PIO_REGS { REGISTER data; // data read/write REGISTER direction; // set port direction REGISTER interruptmask; // enable/disable interrupt REGISTER edgecapture; // edge detection }; struct PIO_REGS *KEY1 = (struct PIO_REGS *) (BUTTON1_BASE 0x80000000); 5 Hardware Interrupt 6 3

Polling versus Interrupt Context: Processor and peripheral Polling Interleave the processor s other tasks with a routine that checks for new data in the peripheral This repeated checking by processor is called polling Pro: simple to implement Con: repeated checking wastes clock cycles Interrupt Hardware support Interrupt pin (int) During normal instruction execution, the processor check whether int has been asserted The checking doesn t incur any overhead, as this is done in hardware If int has been asserted, interrupt services routine (ISR) will7 take over the servicing Is Interrupt a free lunch? Not exactly, there is still overhead involve There are three key metrics Interrupt latency The time from when an interrupt is first generated to when the processor runs the first instruction at the exception address Interrupt response time The time from when an interrupt is first generated to when the processor runs the first instruction in the ISR. Interrupt recovery time The time taken from the last instruction in the ISR to return to normal processing Basically, the amount of time spent servicing the interrupt 8 4

Interrupt One type of exception The goal of microprocessor is interfacing and controlling peripherals This means that these peripherals requires servicing If peripheral produces data in predictable interval, polling will work just fine What about unpredictable interval? How to avoid the processor busy for nothing? i.e. check whether data is available Goal: Keep the processor doing useful work Peripheral interrupts the processor when service is required 9 Interrupt Different processors have different methods to determine where the ISR resides (address). Basically, there are two methods: Fixed interrupt Vectored interrupt Fixed interrupt Address built into microprocessor, cannot be changed Either ISR stored at address or a jump to actual ISR stored if not enough bytes available Vectored interrupt Peripheral must provide the address Common when microprocessor has multiple peripherals connected by a system bus Compromise: interrupt address table 10 5

Fixed ISR Address Time 1(a): µp is executing its main program. 1(b): P1 receives input data in a register with address 0x8000. 3: After completing instruction at 100, µp sees Int asserted, saves the PC s value of 100, and sets PC to the ISR fixed location of 16. 2: P1 asserts Int to request servicing by the microprocessor. 4(a): The ISR reads data from 0x8000, modifies the data, and writes the resulting data to 0x8001. 4(b): After being read, P1 deasserts Int. 5: The ISR returns, thus restoring PC to 100+1=101, where µp resumes executing. 11 Vectored ISR Address Time 1(a): µp is executing its main program. 1(b): P1 receives input data in a register with address 0x8000. 3: After completing instruction at 100, µp sees Int asserted, saves the PC s value of 100, and sets PC to the ISR fixed location of 16. 2: P1 asserts Int to request servicing by the microprocessor. 4(a): The ISR reads data from 0x8000, modifies the data, and writes the resulting data to 0x8001. 4(b): After being read, P1 deasserts Int. 5: The ISR returns, thus restoring PC to 100+1=101, where µp resumes executing. 12 6

Interrupt Address Table Compromise between fixed and vectored interrupts One interrupt pin Table in memory holding ISR addresses (maybe 256 words) Peripheral doesn t provide ISR address, but rather index into table Fewer bits are sent by the peripheral Can move ISR location without changing peripheral 13 Additional Interrupt Issues Maskable vs. non-maskable interrupts Maskable: programmer can set bit that causes processor to ignore interrupt Important when in the middle of time-critical code Non-maskable: a separate interrupt pin that can t be masked Typically reserved for drastic situations, like power failure requiring immediate backup of data to non-volatile memory Jump to ISR Some microprocessors treat jump same as call of any subroutine Complete state saved (PC, registers) may take hundreds of cycles Others only save partial state, like PC only Thus, ISR must not modify registers, or else must save them first Assembly-language programmer must be aware of which 14 registers stored 7