ECE 485/585 Microprocessor System Design

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

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

Interrupts. Chapter 20 S. Dandamudi. Outline. Exceptions

The Purpose of Interrupt

eaymanelshenawy.wordpress.com

8086 Interrupts and Interrupt Responses:

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

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

ECE 485/585 Microprocessor System Design

PC Interrupt Structure and 8259 DMA Controllers

BASIC INTERRUPT PROCESSING

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

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

Chapter 12: INTERRUPTS

Grundlagen Microcontroller Interrupts. Günther Gridling Bettina Weiss

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Types of Interrupts:

Northern India Engineering College, Delhi (GGSIP University) PAPER I


ECE 341. Lecture # 19

Homework / Exam. Return and Review Exam #1 Reading. Machine Projects. Labs. S&S Extracts , PIC Data Sheet. Start on mp3 (Due Class 19)

Common Computer-System and OS Structures

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

For more notes of DAE

9/25/ Software & Hardware Architecture

EC6504 MICROPROCESSOR AND MICROCONTROLLER

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 153) Pass Marks: 24

2.5 Address Space. The IBM 6x86 CPU can directly address 64 KBytes of I/O space and 4 GBytes of physical memory (Figure 2-24).

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

CS609 Final Term Solved MCQs with References Without Repetitions 14/02/2013

FIFTH SEMESTER B.TECH DEGREE EXAMINATION MODEL TEST QUESTION PAPER, NOVEMBER CS 305: Microprocessor and Microcontrollers PART A

Week 11 Programmable Interrupt Controller

16-Bit Intel Processor Architecture

Interrupt/Timer/DMA 1

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

7/19/2013. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter Objectives 12 1 BASIC INTERRUPT PROCESSING

Chapter 12: Interrupts

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

UNIT II OVERVIEW MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Introduction to 8086 microprocessors. Architecture of 8086 processors

Microprocessor Architecture

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

Operating Systems 2010/2011

Design with Microprocessors

I/O - input/output. system components: CPU, memory, and bus -- now add I/O controllers and peripheral devices. CPU Cache

Chapter 8 PC Peripheral Chips - Pt 3 Interrupts

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

INPUT/OUTPUT ORGANIZATION

MICROPROCESSOR TECHNOLOGY

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

EKT222 Miroprocessor Systems Lab 5

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

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

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

Instructions Involve a Segment Register (SR-field)

Introduction to Microprocessor

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

UNIT-IV. The semiconductor memories are organized as two-dimensional arrays of memory locations.


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

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

Architecture of 8085 microprocessor

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

LABORATORY 1: EXPLORING THE SOFTWARE ARCHITECTURE OF THE MICROPROCESSOR

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

Computer Organization ECE514. Chapter 5 Input/Output (9hrs)

C02: Interrupts and I/O

16-bit MS-DOS and BIOS Programming

Mechanisms for entering the system

CS 550 Operating Systems Spring Interrupt

UNIT-1. It is a 16-bit Microprocessor (μp).it s ALU, internal registers works with 16bit binary word.

W4118: interrupt and system call. Junfeng Yang

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

8086 Hardware Specification

Internal architecture of 8086

Operating Systems Engineering Recitation #3 (part 2): Interrupt and Exception Handling on the x86. (heavily) based on MIT 6.

Chapter 3. Assembly Language Programming with 8086

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

8086 INTERNAL ARCHITECTURE

Chapter 8 Summary: The 8086 Microprocessor and its Memory and Input/Output Interface

OS Structure. Hardware protection & privilege levels Control transfer to and from the operating system

Advanced Microprocessors

Lecture 23. I/O, Interrupts, exceptions

Intel 8086 MICROPROCESSOR ARCHITECTURE

8085 Interrupts. Lecturer, CSE, AUST

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

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

Computer System Overview. Chapter 1

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

Input / Output. School of Computer Science G51CSA

Review: Hardware user/kernel boundary

Hardware OS & OS- Application interface

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

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

Architectural Support for Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CPS104 Computer Organization and Programming Lecture 17: Interrupts and Exceptions. Interrupts Exceptions and Traps. Visualizing an Interrupt

for Operating Systems Computer Systems Laboratory Sungkyunkwan University

2. (a) Draw and explain the pin out diagram of (b) Explain the various operations performed by Bus Interfacing unit in 8086.

Architecture of 8086 Microprocessor

Transcription:

Microprocessor System Design Lecture 3: Polling and Interrupts Programmed I/O and DMA Interrupts Zeshan Chishti Electrical and Computer Engineering Dept Maseeh College of Engineering and Computer Science Source: Lecture based on materials provided by Mark F.

I/O Subsystems Things to Think About What instructions does the processor use to communicate with I/O devices? Direct (Isolated) I/O Memory Mapped I/O How do we know if an I/O device is ready or an I/O operation is complete Polling Interrupts How do we transfer data between the I/O device and memory? Programmed I/O (PIO) Direct memory access (DMA) Bus Mastering

I/O Completion or Ready Notification Two methods: Polled I/O Interrupt driven I/O Polled I/O: Peripheral make status (ex: busy/ready for new I/O request) available through an I/O port or memory mapped register CPU executes a busy-wait loop reading the status from the peripheral and looping until peripheral is ready to accept a new I/O request (and/or has completed the current I/O request) Interrupt driven I/O: Peripheral signals the CPU when it is ready for a new I/O request (and/or has completed the current I/O request) Program running on the CPU is interrupted and starts executing the code that handles the peripheral

Polling READB: IN AL, BUSY ; get BUSY flag TEST AL, BUSY_BIT ; test BUSY bit JNE READB ; still busy -- loop IN AL, DATAP ; read data Simplified Polling Code Fragment Microprocessor Address, Data, Control Memory I/O Device

Interrupt Driven I/O Permits the processor to execute useful instructions instead of polling an I/O device The I/O device interrupts the processor when it needs attention (e.g. has data) or an I/O operation has completed Keyboard character typed, mouse button clicked, etc. Requested disk block has actually been read (this takes eons in CPU cycle time) Timer tick expired Analog/Digital conversion complete new measurement available System wake-up (power saving architectures)

The Interrupt Mechanism Hardware Interrupts (Asynchronous) Non-Maskable Interrupt(s) (NMI) Priority Maskable Interrupt(s) (INTR) Software Interrupts (Synchronous) Nomenclature varies Intel calls these exceptions to distinguish them from H/W interrupts Often called traps or faults RISC architectures (ARM, MIPS, ) tend to name both hardware and software interrupts exceptions and handle them the same way

Interrupt Hardware: Vectors NMI INTR INTA# AD0-AD15 Non-maskable Interrupt Interrupt Interrupt Acknowledge Type vector Intel 8086

Interrupt Mechanism: Hardware Interrupts Occur under external control (asynchronous) Can occur any time during instruction/program execution but may only be recognized at instruction boundaries Non-Maskable Interrupts Ex: Power Failure Enough time to save state and shutdown gracefully Priority Maskable Interrupts I/O Devices Assigned Different Priorities Relative importance of servicing request (e.g. keyboard or disk) Ability of device to buffer data

Interrupt Mechanism: Software Interrupts Occur under CPU control (synchronous) Can occur when the CPU wants it to occur May be the result of instruction execution Divide-by-Zero Page fault or segmentation violation May be the result of instruction(s) inserted into the program that s running Debugging (breakpoints and single step) Operating System Calls User program makes O.S. request INT # instruction

x86 Interrupt Processing Sequence Interrupt occurs Push current processor state onto stack Flags (zero, carry, negative, ) CS:IP Clear IF and TF (Interrupt and Trap Flags) Prevents further interrupts Retrieve Instruction Pointer (CS:IP) Uses Interrupt Vector as index into Interrupt Descriptor Table (IDT) Begin executing with new CS:IP of ISR Service the interrupt (Interrupt Service Routine) ISR ends by executing IRET instruction (explicit) Pops CS:IP and Flags from Stack

x86 Interrupt Processing Sequence 255 1 0 START: MOV AX, CX ; comment MOV CX, ICOUNT ; comment. Executing Code ISR: PUSH AX ; comment PUSH BX IN IRET Entry number, not address Interrupt Service Routine Interrupt Descriptor Table CS:IP (PC) of ISRs 1 2 4 3 Interrupt occurs Push Flags and CS:IP (PC) Clear IF and TF (interrupt/trap flag) Stack CS:IP Flags IRET pops stack and execution resumes where interrupted IDT[Vector x 4] to get new CS:IP

Why multiply interrupt by 4?

I/O Subsystems Things to Think About What instructions does the processor use to communicate with I/O devices? Direct (Isolated) I/O Memory Mapped I/O How do we know if an I/O device is ready or an I/O operation is complete Polling Interrupts How do we transfer data between the I/O device and memory? Programmed I/O (PIO) Direct memory access (DMA) Bus Mastering

Data Transfer Two methods: Programmed I/O DMA (Direct Memory Access) Programmed I/O: All I/O operations go through the CPU Program running on CPU accesses device registers and moves data to/from peripheral and memory (and/or internal registers) DMA: CPU sets up DMA hardware, tells the DMA hardware to start and then goes merrily on its way DMA hardware accesses peripherals and moves the data to/from memory w/o CPU interaction DMA hardware generates an interrupt when the I/O transaction is complete

Programmed I/O Microprocessor Address, Data, Control Memory I/O Device CPU fetches/execute instructions to be executed to do the I/O CPU moves data from I/O device to processor and then to memory

Ex: Buffer transfer using Programmed I/O START: MOV BX, OFFSET BUFFER MOV DX, FFF8H ; set up I/O port MOV CX, COUNT ; set up byte count READB: IN AL, DX ; read byte MOV [BX], AL ; copy to buffer INC BX ; increment pointer LOOP READB ; decrement/test CX Simplified I/O Read Code Fragment Microprocessor Address, Data, Control Memory I/O Device

Direct Memory Access (DMA) Microprocessor Address, Data, Control Memory I/O Device DMA Controller

DMA (Detail) mp floats its bus interface pins AEN

Tying It All Together: Disk Read Example Operation: Read a block of 512 bytes from a floppy disk Communicate w/ the Floppy Disk Controller (FDC) Write Read Data command to FDC Tell the FDC to start Determine when operation is complete and/or has data ready Polling: Read the Status Register to find out when data is available and/or operation is complete Interrupt: Handle interrupt(s) from the FDC Transfer data from FDC to memory Programmed I/O: CPU reads each byte of data and writes the byte to memory DMA: DMA controller moves data from FDC to memory w/o involving the CPU

Next Time Lecture Topics: Memory Hierarchy Memory Taxonomy Register Files and SRAM Memory Organization Readings: Nothing new