Reset, Interrupts, Exceptions, and Break ECE 3534

Similar documents
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

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

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

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

Systems Programming and Computer Architecture ( ) Timothy Roscoe

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

Interrupt/Timer/DMA 1

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

Chapter 6 Exceptions. Chapter 6. Exceptions 6-1. This document was created with FrameMaker 4.0.4

PC Interrupt Structure and 8259 DMA Controllers

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

8086 Interrupts and Interrupt Responses:

INTERRUPTS in microprocessor systems

Microprocessors & Interfacing

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

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

An overview of Interrupts ECE3534

ECE 372 Microcontroller Design Parallel IO Ports - Interrupts. ECE 372 Microcontroller Design Parallel IO Ports - Interrupts

Computer System Overview

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

The control of I/O devices is a major concern for OS designers

The von Neuman architecture characteristics are: Data and Instruction in same memory, memory contents addressable by location, execution in sequence.

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

EE458 - Embedded Systems Exceptions and Interrupts

The K Project. Interrupt and Exception Handling. LSE Team. May 14, 2018 EPITA. The K Project. LSE Team. Introduction. Interrupt Descriptor Table

ECE 485/585 Microprocessor System Design

POLITECNICO DI MILANO. Exception handling. Donatella Sciuto:

Interrupts (Exceptions) (From LM3S1968) Gary J. Minden August 29, 2016

INPUT/OUTPUT ORGANIZATION

For more notes of DAE

CS 201. Exceptions and Processes. Gerson Robboy Portland State University

Table 6-2. Exceptions and Conditions Overview

INPUT/OUTPUT ORGANIZATION

Interrupts (Exceptions) Gary J. Minden September 11, 2014

Types of Interrupts:

Chapter 13: I/O Systems

ECE 341. Lecture # 19

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

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

A First Look at Microprocessors

eaymanelshenawy.wordpress.com

ECE251: Thursday September 27

Chapter 3. Top Level View of Computer Function and Interconnection. Yonsei University

Exception Handling. Precise Exception Handling. Exception Types. Exception Handling Terminology

Interrupts. Chapter 20 S. Dandamudi. Outline. Exceptions

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

Computer Architecture 5.1. Computer Architecture. 5.2 Vector Address: Interrupt sources (IS) such as I/O, Timer 5.3. Computer Architecture

Procesory Sygnałowe w aplikacjach przemysłowych

Input / Output. School of Computer Science G51CSA

PD215 Mechatronics. Week 3/4 Interfacing Hardware and Communication Systems

Chapter 13: I/O Systems

Chapter 13: I/O Systems. Chapter 13: I/O Systems. Objectives. I/O Hardware. A Typical PC Bus Structure. Device I/O Port Locations on PCs (partial)

EECS 373 Design of Microprocessor-Based Systems

Unit 3 and Unit 4: Chapter 4 INPUT/OUTPUT ORGANIZATION

Change log for MicroBlaze

Instruction Set Architecture of MIPS Processor

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

Q.1 Explain Computer s Basic Elements

Chapter 13: I/O Systems

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

SECTION 8 EXCEPTION PROCESSING

CSE 153 Design of Operating Systems

Chapter 12: I/O Systems

Chapter 13: I/O Systems

Chapter 12: I/O Systems. Operating System Concepts Essentials 8 th Edition

Chapter Operation Pinout Operation 35

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

ECE 486/586. Computer Architecture. Lecture # 12

Module Introduction. PURPOSE: The intent of this module is to explain MCU processing of reset and interrupt exception events.

Process Scheduling Queues

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

18-349: Introduction to Embedded Real-Time Systems

Lecture 10 Exceptions and Interrupts. How are exceptions generated?

Fredrick M. Cady. Assembly and С Programming forthefreescalehcs12 Microcontroller. шт.

October, Saeid Nooshabadi. Overview COMP 3221

Chapter 3 - Top Level View of Computer Function

Instruction Level Parallelism. ILP, Loop level Parallelism Dependences, Hazards Speculation, Branch prediction

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

Programmed I/O Interrupt-Driven I/O Direct Memory Access (DMA) I/O Processors. 10/12/2017 Input/Output Systems and Peripheral Devices (02-2)

Interrupt level Interrupt level 1

Lecture 13 Input/Output (I/O) Systems (chapter 13)

Lecture 5: MSP430 Interrupt

Design and Implementation Interrupt Mechanism

Hardware OS & OS- Application interface

Advanced Parallel Architecture Lesson 3. Annalisa Massini /2015

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

The Purpose of Interrupt

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION

MICROPROCESSOR MEMORY ORGANIZATION

Silberschatz and Galvin Chapter 12

Interrupts in Zynq Systems

Hercules ARM Cortex -R4 System Architecture. Processor Overview

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

Interrupts and Low Power Features

EECS 373 Design of Microprocessor-Based Systems

EPPC Exception Processing

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III

Mobile Operating Systems Lesson 01 Operating System

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

Transcription:

Reset, Interrupts, Exceptions, and Break ECE 3534 1

Reset, Interrupts, Exceptions, Break These topics are closely related Both software and hardware aspects of a processor are involved On the MicroBlaze, the facilities to handle them are quite similar All of these refer to mechanisms for altering the normal execution of a program Usual purpose: get the processor s attention for something that can t wait Reading: relevant parts of Chapter 1 in MBlaze 2

For the MicroBlaze, these things are prioritized: Reset ( highest priority) Hardware Exception Non-maskable Break Breaks Interrupts User Vectors (Exceptions) (Yes, the Xilinx terminology is a little confusing at first) 3

Interrupts and Exceptions These concepts are closely related, and the terminology is sometimes blurred (An interrupt is often considered to be a type of exception!) Deviation in normal sequence of actions For our purposes, An interrupt is asynchronous, traditionally generated by some external hardware device An exception is synchronous, resulting directly from the most recent instruction (example: divide-by-zero) 4

Typical sequence of actions (1/2) A triggering event occurs CPU finishes executing the current instruction CPU may save the state of the processor (PC, MSR, other registers) CPU may update status registers CPU branches to service routine (the MBlaze does this through its vector table ) 5

Vector Table in MicroBlaze 6

Typical sequence of actions (2/2) The CPU executes instructions in the appropriate service routine The service routine terminates with the appropriate instruction: rtid rted rtbd (return from interrupt) (return from exception) (return from break) By executing this instruction, the CPU may update status registers the CPU changes the PC No return from a reset! 7

Notice... A service routine is often called a handler A service routine should be quick and efficient To a reasonable extent, a service routine should not disrupt normal program execution Servicing an interrupt/exception/etc. is ideally totally transparent to the process that is executing when the event occurs If the service routine alters any registers, then typically it should preserve and restore them For larger systems, a service routine is usually considered part of the operating system 8

Reset Most microprocessors have an input pin that causes a reset to occur If asserted for 16 clock cycles or longer: PC 0 MSR 0 EAR 0 ESR 0 9

Interrupts Hardware support for getting CPU s attention Traditionally, an interrupt occurs in response to a request from an external hardware device The device sends its request to a physical input pin of the processor This pin is often called IRQ ( interrupt request ) The external device simply drives this signal to the logic ON state when it needs to be serviced On many systems, internal devices (e.g., timers) can also cause interrupts 10

Interrupts The interrupt service routine/handler ( ISR ) behaves much like a subroutine that is initiated by hardware In general, nested interrupts are possible; a new interrupt can occur while an interrupt handler is already executing Asynchronous, and typically unrelated to currently executing process 11

Interrupts Execution process: R14 PC PC 0x00000010 MSR[IE] 0 Special return instruction: rtid ra, IMM PC (ra) + sext(imm) allow following instruction to complete execution MSR[IE] 1 12

Interrupts The MicroBlaze will ignore an interrupt request, at least temporarily,... if MSR[IE] is 0 if MSR[BIP] is 1 (Break In Progress) 13

Nonmaskable interrupt Most interrupt requests can be serviced, denied or deferred Nonmaskable interrupts (NMI) are those that cannot be denied or deferred Examples Low-voltage interrupt detector response would be to perform orderly shutdown High temperature detector XMD seizing control of your processor 14

Prioritized Interrupt More than one level of interrupt possible Prioritize High level serviced sooner Example disk service routine to capture and transfer the data from the disk Medium level serviced in acceptable time Example keyboard where data may be held for 200ms Low level serviced as processing allows Example continue adding data to printer output buffer 15

Vectored Interrupts (1) Identify the requesting device Simple processors typically only have a single IRQ* input pin Interrupt Service Routine may need to poll the devices capable of asserting interrupt to determine who generated the request 16

Vectored Interrupts (2) IACK output pin on many common processors (x86, PowerPC, etc.) When asserted, requesting device places identification code (number) on bus Processor (in supervisory mode) branches to correct routine to service peripheral Many desktop processors support both vectored and non-vectored interrupts 17

Exceptions Synchronous: immediate result of most recent instruction often represents a hardware error condition Features are common to a subroutine call In practice an exception is effectively a call to the operating system Bridge three components of microprocessor Hardware Application software Operating system 18

Example hardware error exception Trying to read from a memory address not populated Example software exceptions Should never happen: Illegal op code Deliberate: Termed a TRAP can be used to create new instructions Ex: floating point 19

MicroBlaze Hardware Exceptions Unaligned Data Access Illegal Opcode Instruction Bus Error Data Bus Error Divide by Zero Floating Point Errors (underflow, overflow, divide by zero, invalid operation, denormalized operand) 20

Exception Causes (1/2) Unaligned Data Access Word with A30:A31!= 0 or Half Word with A31!= 0 Illegal Opcode Exception Opcode (bits 0-5 of the instruction) don t map to MicroBlaze s capabilities 21

Exception Causes (2/2) Instruction Bus Exception Something asserted the instruction bus OPB_errAck signal Data Bus Exception Something asserted the data bus OPB_errAck signal Divide by Zero FPU Exception 22

Exceptions Execution process: r17 PC PC 0x00000020 MSR[EE] 0 MSR[EIP] 1 ESR[DS] exception in delay slot ESR[EC] exception specific value ESR[ESS] exception specific value EAR exception specific value FSR exception specific value 23

Exceptions Special return instruction: rted ra, IMM PC (ra) + sext(imm) allow following instruction to complete execution MSR[EE] 1 MSR[EIP] 0 ESR 0 24

Exception Status Register (ESR) 25

Exception Specific Status (ESS) 26

Breaks Execution process (for hardware breaks): R16 PC PC 0x00000018 MSR[BIP] 1 Special return instruction: rtbd ra, IMM PC (ra) + sext(imm) allow following instruction to complete execution MSR[BIP] 0 Also, interrupts are disabled while a break is in progress, although MSR[IE] is not affected 27

Hardware Breaks A hardware break occurs when an external device asserts 1 of the 2 external break signals A normal hardware break (the Ext_BRK input port) is only handled when there is no break in progress (i.e MSR[BIP] is set to 0). The Break In Progress flag disables interrupts. A non-maskable break (the Ext_NM_BRK input port) will always be handled immediately. The BIP bit in the MSR is automatically cleared when executing the RTBD instruction. 28

Software Breaks The BRK or BRKI instruction is inserted by software at the point where a breakpoint is desired. Like a BRILD instruction, but BIP set, and returned by RTBD. 29

Software Breaks 30

User Exceptions These are exceptions that are actually called by the user: BRALID R15,0x8 A useful mechanism in operating systems. Not too meaningful to MicroBlaze since there is no concept of privilege separation. Refer to Wiki definition of Trap 31

SUMMARY Reset Hardware Exception Non-maskable Break Breaks Interrupts User Vectors (Exceptions) 32