SlideShare a Scribd company logo
Page 1
Direct Memory Access
By,
Sharmila Chidaravalli
Assistant Professor,
Department of CS&E,
AIeMS
Page 2
Introduction
The direct memory access (DMA) I/O technique provides
direct access to the memory while the microprocessor is
temporarily disabled.
• A DMA controller temporarily borrows the address bus, data
bus, and control bus from the microprocessor and transfers the
data bytes directly between an I/O port and a series of memory
locations.
• The DMA transfer is also used to do high-speed memory-to
memory transfers.
• Used in disk controllers, video/sound cards etc, or between
memory locations.
Page 3
Basic DMA operation
• Two control signals are used to request and acknowledge a
DMA transfer in the microprocessor-based system.
HOLD pin - is an input used to request a DMA action
HLDA pin - is an output that acknowledges the DMA action
Page 4
•The HOLD signal is a bus request signal which asks the
microprocessor to release control of the buses after the current bus
cycle.
•HOLD is sampled in any clocking cycle
•when the processor recognizes the hold, it stops executing software
and enters hold cycles
• The HLDA signal is a bus grant signal which indicates that the
microprocessor has indeed released control of its buses by placing
the buses at their high-impedance states.
• The HOLD input has a higher priority than the INTR or NMI
interrupt inputs.
Page 5
Basic DMA Definitions
Direct memory accesses normally occur between an I/O device
and memory without the use of the microprocessor.
DMA read - transfers data from the memory
to the I/O device
DMA write - transfers data from an I/O device
to memory
Memory & I/O are controlled simultaneously.
which is why the system contains separate memory and
I/O control signals
Page 6
A DMA read causes the MRDC and IOWC signals to activate
simultaneously.
-transferring data from memory to the I/O device
A DMA write causes the MWTC and IORC signals to both
activate.
The control Buses are available to all microprocessors in the Intel
family expect 8086/8088.
8086/8088 require a controller or circuit for control bus signal
generation.
Page 7
Data transfers are performed by the control circuit that is a part of the I/O device
interface called DMA controller
DMA controller can transfer data without intervention of the processor, but its
operation must be under the control of a program executed by the processor.
To initiate the transfer of a block words, the processor sends the starting address,
the number of words in the block and the direction of the transfer.
Data transfer speed is determined by speed of the memory device or a DMA
controller.
-if memory speed is 50 ns, DMA transfers occur at rates up to 1/50 ns or 20
M bytes per second
-if the DMA controller functions at a maximum rate of 15 MHz with 50 ns
memory, maximum transfer rate is 15 MHz because the DMA controller is
slower than the memory
In many cases, the DMA controller slows the speed of the system when transfers
occur.
Page 8
• DMA is implemented using a DMA controller
– DMA controller
• Acts as slave to processor
• Receives instructions from processor
– Processor gives details to the DMA controller
» I/O device number
» Main memory Starting address
» Number of bytes to transfer
» Direction of transfer (memory  I/O device, or
vice versa)
• On receiving this information, the DMA controller proceeds to
perform the requested operation.
• After completing, it informs the processor
Page 9
• Steps in a DMA operation
– Processor initiates the DMA controller
• Gives device number, memory buffer pointer, …
– Called channel initialization
• Once initialized, it is ready for data transfer
– When ready, I/O device informs the DMA controller
• DMA controller starts the data transfer process
– Obtains bus by going through bus arbitration
– Places memory address and appropriate control signals
– Completes transfer and releases the bus
– Updates memory address and count value
– If more to read, loops back to repeat the process
– Notify the processor when done
• Typically uses an interrupt
Page 10
Interrupts
By,
Sharmila Chidaravalli
Assistant Professor,
Department of CS&E,
AIeMS
Page 11
What Are Interrupts ?
Interrupts alter a program’s flow of control
∗ Behavior is similar to a procedure call
» Some significant differences between the two
• Interrupt causes transfer of control to an interrupt
service routine (ISR) or Interrupt Service Procedure
» ISR is also called a handler
• When the ISR is completed, the original program resumes
execution
• Interrupts provide an efficient way to handle unanticipated
events
Page 12
Page 13
Types of interrupts
∗ Software interrupts
∗ Hardware interrupts
∗ Exceptions
Page 14
Interrupt Vector Table
Page 15
The processor uses the interrupt vector to determine the address of
the ISR of the interrupting device.
In the 8088/8086 processor as well as in the 80386/80486/Pentium
processors operating in Real Mode (16-bit operation), the interrupt
vector is a pointer to the Interrupt Vector Table.
The Interrupt Vector Table occupies the address range from 00000H
to 003FFH (the first 1024 bytes in the memory map).
Each entry in the Interrupt Vector Table is 4 bytes long:
The first two represent the offset address and the last two the segment address
of the ISR.
The first 5 vectors are reserved by Intel to be used by the processor.
The vectors 5 to 255 are free to be used by the user.
Page 16
• Interrupt numbers range from 0 to 255
• Interrupt number acts as an index into the interrupt vector table
• Since each vector takes 4 bytes, interrupt number is multiplied by 4
to get the corresponding ISR pointer
Example
• For interrupt 2, the memory address is 2 ∗ 4 = 8H
• The first two bytes at 8H are taken as the offset value
• The next two bytes (i.e., at address AH) are used as the CS value
Page 17
Interrupt Types
Type 0: Divide error – Division overflow or division by zero
Type 1: Single step or Trap – After the execution of each instruction
when trap flag set
Type 2: NMI Hardware Interrupt – ‘1’ in the NMI pin
Type 3: One-byte Interrupt – INT3 instruction (used for
breakpoints)
Type 4: Overflow – INTO instruction with an overflow flag
Type 5: BOUND – Register contents out-of-bounds
Type 6: Invalid Opcode – Undefined opcode occurred in program
Type 7: Coprocessor not available – MSW indicates a coprocessor
Type 8: Double Fault – Two separate interrupts occur during the
same instruction
Type 9: Coprocessor Segment Overrun – Coprocessor call operand
exceeds FFFFH
Page 18
Interrupt Types
Type 10: Invalid Task State Segment – TSS invalid (probably not
initialized)
Type 11: Segment not present – Descriptor P bit indicates segment
not present or invalid
Type 12: Stack Segment Overrun – Stack segment not present or
exceeded
Type 13: General Protection – Protection violation in 286 (general
protection fault)
Type 14: Page Fault – 80386 and above
Type 16: Coprocessor Error – ERROR΄ = ‘0’ (80386 and above)
Type 17: Alignment Check – Word/Doubleword data addressed at
odd location (486 and above)
Type 18: Machine Check – Memory Management interrupt
(Pentium and above)
Page 19
Operation of a Real Mode Interrupt
Push Flags
Clear IF
Clear TF
Push CS
Push IP
Fetch ISR Address
Pop IP
Pop CS
Pop Flags
Mainline Program
ISR
Push Register
Pop Register
IRET
Page 20
Operation of a Protected Mode Interrupt
In the 80386/80486/Pentium processors operating in the Protected
Mode (32-bit operation), the interrupt vector is a pointer to the
Interrupt Descriptor Table.
The Interrupt Descriptor Table can be located anywhere in the
memory.
Its starting address is pointed by the Interrupt Descriptor Table Register
(IDTR).
Each entry in the Interrupt Vector Table is 8 bytes long:
Four bytes represent the 32-bit offset address, two the segment selector and
the rest information such as the privilege level.
The first 32 vectors are reserved by Intel to be used by the
processor.
The vectors 33 to 255 are free to be used by the user.
0
2
4
6
1
3
5
7 Offset (A31 - A16)
Offset (A15 - A0)
Segment Selector
00H01110PFThe protected mode
interrupt descriptor
Page 21
Exception Interrupts
Divide by zero error
CPU generates a type 0 interrupt whenever the div/idiv
instructions result in a quotient that is larger than the
destination specified or an attempt is made to divide by zero.
Single step Interrupt
∗ Useful in debugging
∗ To single step, Trap Flag (TF) should be set
∗ CPU automatically generates a type 1 interrupt after
executing each instruction if TF is set
∗ Type 1 ISR can be used to present the system state to
the user
Page 22
Exception Interrupts
There exists no instruction to directly set or reset trap flag.
TF=1 can be set by executing the following sequence of instructions:
PUSHF
MOV BP,SP
OR WORD PTR[BP+0],0100H
POPF
TF=0 can be set by executing the following sequence of instructions:
PUSHF
MOV BP,SP
AND WORD PTR[BP+0],0FEFFH
POPF
Page 23
Software Interrupts
Initiated by executing an instruction
INT, INTO, INT 3, BOUND
INT and INT3 behave in a similar way.
INT n:
- n is an integer from range 0 to 255
- Calls ISR located at vector n (n*4).
- The INT instruction requires two bytes of memory, opcode
plus n.
- Each interrupt type can be parameterized to provide
several services.
- For example, DOS interrupt service int 21H
provides more than 80 different services
∗ AH register is used to identify the required
service under int 21H.
Page 24
BOUND and INTO are both conditional.
BOUND:
Bound AX,DATA
AX is compared with DATA and DATA+1, if less than an
interrupt occurs.
AX is compared with DATA+2 and DATA+3, if greater than an
interrupt occurs.
INTO:
Checks the overflow flag (OF). If OF=1, the ISR is called.
IRET removes 6 bytes from the stack, 2 for IP, 2 for CS and 2 for
FLAGS.
Page 25
Hardware Interrupts
• Software interrupts are synchronous events
∗ Caused by executing the int
instruction
• Hardware interrupts are of hardware origin and
asynchronous in nature
∗ Typically caused by applying an
electrical signal to the processor chip
• Hardware interrupts can be
∗ Maskable (INTR)
∗ Non-maskable (NMI)
» Causes a type 2 interrupt
Page 26
Non-Maskable Interrupt
Non-maskable interrupt is triggered by applying an electrical signal to
the NMI pin of Pentium
∗ Processor always responds to this signal
∗ Cannot be disabled under program control
The non-maskable interrupt (NMI) is an edge-triggered input that
requests an interrupt on the positive edge (0-to-1 transition).
after a positive edge, the NMI pin must remain logic 1 until
recognized by the microprocessor
before the positive edge is recognized, NMI pin must be logic 0
for at least two clocking periods
The NMI input is often used for parity errors and other major faults,
such as power failures.
power failures are easily detected by monitoring the AC power
line and causing an NMI interrupt whenever AC power drops out .
Page 27
INTR and INTA
The INTR pin must be externally decoded to select a vector.
Any vector is possible, but the interrupt vectors between
20H and FFH are usually used (Intel reserves vectors
between 00H and 1FH).
INTA is an output of the microprocessor to signal the external
decoder to place the interrupt number on data bus connections
D7-D0.
The INTR pin is set by an external device (8259A) and cleared
in the ISR.
The input is automatically disabled by the microprocessor
once it is recognized and re-enabled by IRET or IRETD
instruction.
Page 28
INTR: Interrupt Request. Activated by a peripheral device to
interrupt the processor.
Level triggered. Activated with a logic 1.
INTA: Interrupt Acknowledge. Activated by the processor to
inform the interrupting device the interrupt request (INTR) is
accepted.
Level triggered. Activated with a logic 0.

More Related Content

What's hot

Direct memory access
Direct memory accessDirect memory access
Direct memory access
Roshan kumar sahu
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
prasadpawaskar
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
Poojith Chowdhary
 
Input output organization
Input output organizationInput output organization
Input output organizationabdulugc
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
MNM Jain Engineering College
 
Registers
RegistersRegisters
Registers
Sahil Bansal
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
shubham kuwar
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
AJAL A J
 
Direct memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA ControllerDirect memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA Controller
Muhammed Afsal Villan
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
Vijay Kumar
 
Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)
Page Maker
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
saurav kumar
 
Interface
InterfaceInterface
Interface
Siddique Ibrahim
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086
Jismy .K.Jose
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
Balakrishna Chowdary
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory Access
Sanjay Saluth
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
deval patel
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transfer
priya Nithya
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
Siddhi Viradiya
 

What's hot (20)

Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
8086 micro processor
8086 micro processor8086 micro processor
8086 micro processor
 
Input output organization
Input output organizationInput output organization
Input output organization
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
 
Registers
RegistersRegisters
Registers
 
Direct memory access
Direct memory accessDirect memory access
Direct memory access
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
 
Direct memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA ControllerDirect memory access (dma) with 8257 DMA Controller
Direct memory access (dma) with 8257 DMA Controller
 
Interrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.kInterrupts on 8086 microprocessor by vijay kumar.k
Interrupts on 8086 microprocessor by vijay kumar.k
 
Direct Memory Access(DMA)
Direct Memory Access(DMA)Direct Memory Access(DMA)
Direct Memory Access(DMA)
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Interface
InterfaceInterface
Interface
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086Minimum mode and Maximum mode Configuration in 8086
Minimum mode and Maximum mode Configuration in 8086
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Direct Memory Access
Direct Memory AccessDirect Memory Access
Direct Memory Access
 
Memory & I/O interfacing
Memory & I/O  interfacingMemory & I/O  interfacing
Memory & I/O interfacing
 
Asynchronous data transfer
Asynchronous data transferAsynchronous data transfer
Asynchronous data transfer
 
bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)bus and memory tranfer (computer organaization)
bus and memory tranfer (computer organaization)
 

Similar to Direct Memory Access & Interrrupts

Timing n interrupt.pptx
Timing n interrupt.pptxTiming n interrupt.pptx
Timing n interrupt.pptx
JasaRChoudhary
 
8555046.ppt
8555046.ppt8555046.ppt
8555046.ppt
ssuser1b065a
 
Ec 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsEc 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsMerin Jesuraj
 
Assembly programming
Assembly programmingAssembly programming
Assembly programming
Omar Sanchez
 
Input output accessing
Input output accessingInput output accessing
Input output accessing
ankitraosingh
 
UNIT 2 8086 System Bus Structure.pptx
UNIT 2 8086 System Bus Structure.pptxUNIT 2 8086 System Bus Structure.pptx
UNIT 2 8086 System Bus Structure.pptx
Gowrishankar C
 
Ch 01 os8e
Ch 01  os8eCh 01  os8e
Ch 01 os8e
Syed Faisal
 
Computer organization
Computer organizationComputer organization
Computer organization
Rvishnupriya2
 
Computer organization
Computer organization Computer organization
Computer organization
vishnu973656
 
8086 – CPU –Pin Diagram.pptx
8086 – CPU –Pin Diagram.pptx8086 – CPU –Pin Diagram.pptx
8086 – CPU –Pin Diagram.pptx
5G8Rajendra
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
BASKARS53
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptx
GobinathAECEJRF1101
 
COA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptxCOA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptx
Ruhul Amin
 
I/O Channel IBM 370
I/O Channel IBM 370I/O Channel IBM 370
I/O Channel IBM 370
Äkshäý M S
 
The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...
Sindhu Mani
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
Anjaan Gajendra
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
JavedIqbal549896
 

Similar to Direct Memory Access & Interrrupts (20)

Timing n interrupt.pptx
Timing n interrupt.pptxTiming n interrupt.pptx
Timing n interrupt.pptx
 
8555046.ppt
8555046.ppt8555046.ppt
8555046.ppt
 
Ec 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applicationsEc 1303 microprocessor_its_applications
Ec 1303 microprocessor_its_applications
 
Assembly programming
Assembly programmingAssembly programming
Assembly programming
 
Input output accessing
Input output accessingInput output accessing
Input output accessing
 
UNIT 2 8086 System Bus Structure.pptx
UNIT 2 8086 System Bus Structure.pptxUNIT 2 8086 System Bus Structure.pptx
UNIT 2 8086 System Bus Structure.pptx
 
Important questions
Important questionsImportant questions
Important questions
 
Ch 01 os8e
Ch 01  os8eCh 01  os8e
Ch 01 os8e
 
Computer organization
Computer organizationComputer organization
Computer organization
 
Computer organization
Computer organization Computer organization
Computer organization
 
8086 – CPU –Pin Diagram.pptx
8086 – CPU –Pin Diagram.pptx8086 – CPU –Pin Diagram.pptx
8086 – CPU –Pin Diagram.pptx
 
Important questions
Important questionsImportant questions
Important questions
 
UNIT 2.pptx
UNIT 2.pptxUNIT 2.pptx
UNIT 2.pptx
 
EC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptxEC 8691 Microprocessor and Microcontroller.pptx
EC 8691 Microprocessor and Microcontroller.pptx
 
COA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptxCOA-Unit5-ppt2.pptx
COA-Unit5-ppt2.pptx
 
I/O Channel IBM 370
I/O Channel IBM 370I/O Channel IBM 370
I/O Channel IBM 370
 
The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...The primary purpose of memory interfacing is to facilitate the transfer of da...
The primary purpose of memory interfacing is to facilitate the transfer of da...
 
Bca examination 2015 csa
Bca examination 2015 csaBca examination 2015 csa
Bca examination 2015 csa
 
Lecture 9.pptx
Lecture 9.pptxLecture 9.pptx
Lecture 9.pptx
 
Bc0040
Bc0040Bc0040
Bc0040
 

More from SharmilaChidaravalli

NUMPY
NUMPY NUMPY
DBMS SQL
DBMS SQLDBMS SQL
Dms introduction Sharmila Chidaravalli
Dms introduction Sharmila ChidaravalliDms introduction Sharmila Chidaravalli
Dms introduction Sharmila Chidaravalli
SharmilaChidaravalli
 
Assembly code
Assembly codeAssembly code
Assembly code
SharmilaChidaravalli
 
8255 Introduction
8255 Introduction8255 Introduction
8255 Introduction
SharmilaChidaravalli
 
System Modeling & Simulation Introduction
System Modeling & Simulation  IntroductionSystem Modeling & Simulation  Introduction
System Modeling & Simulation Introduction
SharmilaChidaravalli
 
Travelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & BoundTravelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & Bound
SharmilaChidaravalli
 
Bellman ford algorithm -Shortest Path
Bellman ford algorithm -Shortest PathBellman ford algorithm -Shortest Path
Bellman ford algorithm -Shortest Path
SharmilaChidaravalli
 

More from SharmilaChidaravalli (8)

NUMPY
NUMPY NUMPY
NUMPY
 
DBMS SQL
DBMS SQLDBMS SQL
DBMS SQL
 
Dms introduction Sharmila Chidaravalli
Dms introduction Sharmila ChidaravalliDms introduction Sharmila Chidaravalli
Dms introduction Sharmila Chidaravalli
 
Assembly code
Assembly codeAssembly code
Assembly code
 
8255 Introduction
8255 Introduction8255 Introduction
8255 Introduction
 
System Modeling & Simulation Introduction
System Modeling & Simulation  IntroductionSystem Modeling & Simulation  Introduction
System Modeling & Simulation Introduction
 
Travelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & BoundTravelling Salesperson Problem-Branch & Bound
Travelling Salesperson Problem-Branch & Bound
 
Bellman ford algorithm -Shortest Path
Bellman ford algorithm -Shortest PathBellman ford algorithm -Shortest Path
Bellman ford algorithm -Shortest Path
 

Recently uploaded

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
obonagu
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
bhadouriyakaku
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
nikitacareer3
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 

Recently uploaded (20)

一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.pptPROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
PROJECT FORMAT FOR EVS AMITY UNIVERSITY GWALIOR.ppt
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptxTOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
TOP 10 B TECH COLLEGES IN JAIPUR 2024.pptx
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 

Direct Memory Access & Interrrupts

  • 1. Page 1 Direct Memory Access By, Sharmila Chidaravalli Assistant Professor, Department of CS&E, AIeMS
  • 2. Page 2 Introduction The direct memory access (DMA) I/O technique provides direct access to the memory while the microprocessor is temporarily disabled. • A DMA controller temporarily borrows the address bus, data bus, and control bus from the microprocessor and transfers the data bytes directly between an I/O port and a series of memory locations. • The DMA transfer is also used to do high-speed memory-to memory transfers. • Used in disk controllers, video/sound cards etc, or between memory locations.
  • 3. Page 3 Basic DMA operation • Two control signals are used to request and acknowledge a DMA transfer in the microprocessor-based system. HOLD pin - is an input used to request a DMA action HLDA pin - is an output that acknowledges the DMA action
  • 4. Page 4 •The HOLD signal is a bus request signal which asks the microprocessor to release control of the buses after the current bus cycle. •HOLD is sampled in any clocking cycle •when the processor recognizes the hold, it stops executing software and enters hold cycles • The HLDA signal is a bus grant signal which indicates that the microprocessor has indeed released control of its buses by placing the buses at their high-impedance states. • The HOLD input has a higher priority than the INTR or NMI interrupt inputs.
  • 5. Page 5 Basic DMA Definitions Direct memory accesses normally occur between an I/O device and memory without the use of the microprocessor. DMA read - transfers data from the memory to the I/O device DMA write - transfers data from an I/O device to memory Memory & I/O are controlled simultaneously. which is why the system contains separate memory and I/O control signals
  • 6. Page 6 A DMA read causes the MRDC and IOWC signals to activate simultaneously. -transferring data from memory to the I/O device A DMA write causes the MWTC and IORC signals to both activate. The control Buses are available to all microprocessors in the Intel family expect 8086/8088. 8086/8088 require a controller or circuit for control bus signal generation.
  • 7. Page 7 Data transfers are performed by the control circuit that is a part of the I/O device interface called DMA controller DMA controller can transfer data without intervention of the processor, but its operation must be under the control of a program executed by the processor. To initiate the transfer of a block words, the processor sends the starting address, the number of words in the block and the direction of the transfer. Data transfer speed is determined by speed of the memory device or a DMA controller. -if memory speed is 50 ns, DMA transfers occur at rates up to 1/50 ns or 20 M bytes per second -if the DMA controller functions at a maximum rate of 15 MHz with 50 ns memory, maximum transfer rate is 15 MHz because the DMA controller is slower than the memory In many cases, the DMA controller slows the speed of the system when transfers occur.
  • 8. Page 8 • DMA is implemented using a DMA controller – DMA controller • Acts as slave to processor • Receives instructions from processor – Processor gives details to the DMA controller » I/O device number » Main memory Starting address » Number of bytes to transfer » Direction of transfer (memory  I/O device, or vice versa) • On receiving this information, the DMA controller proceeds to perform the requested operation. • After completing, it informs the processor
  • 9. Page 9 • Steps in a DMA operation – Processor initiates the DMA controller • Gives device number, memory buffer pointer, … – Called channel initialization • Once initialized, it is ready for data transfer – When ready, I/O device informs the DMA controller • DMA controller starts the data transfer process – Obtains bus by going through bus arbitration – Places memory address and appropriate control signals – Completes transfer and releases the bus – Updates memory address and count value – If more to read, loops back to repeat the process – Notify the processor when done • Typically uses an interrupt
  • 10. Page 10 Interrupts By, Sharmila Chidaravalli Assistant Professor, Department of CS&E, AIeMS
  • 11. Page 11 What Are Interrupts ? Interrupts alter a program’s flow of control ∗ Behavior is similar to a procedure call » Some significant differences between the two • Interrupt causes transfer of control to an interrupt service routine (ISR) or Interrupt Service Procedure » ISR is also called a handler • When the ISR is completed, the original program resumes execution • Interrupts provide an efficient way to handle unanticipated events
  • 13. Page 13 Types of interrupts ∗ Software interrupts ∗ Hardware interrupts ∗ Exceptions
  • 15. Page 15 The processor uses the interrupt vector to determine the address of the ISR of the interrupting device. In the 8088/8086 processor as well as in the 80386/80486/Pentium processors operating in Real Mode (16-bit operation), the interrupt vector is a pointer to the Interrupt Vector Table. The Interrupt Vector Table occupies the address range from 00000H to 003FFH (the first 1024 bytes in the memory map). Each entry in the Interrupt Vector Table is 4 bytes long: The first two represent the offset address and the last two the segment address of the ISR. The first 5 vectors are reserved by Intel to be used by the processor. The vectors 5 to 255 are free to be used by the user.
  • 16. Page 16 • Interrupt numbers range from 0 to 255 • Interrupt number acts as an index into the interrupt vector table • Since each vector takes 4 bytes, interrupt number is multiplied by 4 to get the corresponding ISR pointer Example • For interrupt 2, the memory address is 2 ∗ 4 = 8H • The first two bytes at 8H are taken as the offset value • The next two bytes (i.e., at address AH) are used as the CS value
  • 17. Page 17 Interrupt Types Type 0: Divide error – Division overflow or division by zero Type 1: Single step or Trap – After the execution of each instruction when trap flag set Type 2: NMI Hardware Interrupt – ‘1’ in the NMI pin Type 3: One-byte Interrupt – INT3 instruction (used for breakpoints) Type 4: Overflow – INTO instruction with an overflow flag Type 5: BOUND – Register contents out-of-bounds Type 6: Invalid Opcode – Undefined opcode occurred in program Type 7: Coprocessor not available – MSW indicates a coprocessor Type 8: Double Fault – Two separate interrupts occur during the same instruction Type 9: Coprocessor Segment Overrun – Coprocessor call operand exceeds FFFFH
  • 18. Page 18 Interrupt Types Type 10: Invalid Task State Segment – TSS invalid (probably not initialized) Type 11: Segment not present – Descriptor P bit indicates segment not present or invalid Type 12: Stack Segment Overrun – Stack segment not present or exceeded Type 13: General Protection – Protection violation in 286 (general protection fault) Type 14: Page Fault – 80386 and above Type 16: Coprocessor Error – ERROR΄ = ‘0’ (80386 and above) Type 17: Alignment Check – Word/Doubleword data addressed at odd location (486 and above) Type 18: Machine Check – Memory Management interrupt (Pentium and above)
  • 19. Page 19 Operation of a Real Mode Interrupt Push Flags Clear IF Clear TF Push CS Push IP Fetch ISR Address Pop IP Pop CS Pop Flags Mainline Program ISR Push Register Pop Register IRET
  • 20. Page 20 Operation of a Protected Mode Interrupt In the 80386/80486/Pentium processors operating in the Protected Mode (32-bit operation), the interrupt vector is a pointer to the Interrupt Descriptor Table. The Interrupt Descriptor Table can be located anywhere in the memory. Its starting address is pointed by the Interrupt Descriptor Table Register (IDTR). Each entry in the Interrupt Vector Table is 8 bytes long: Four bytes represent the 32-bit offset address, two the segment selector and the rest information such as the privilege level. The first 32 vectors are reserved by Intel to be used by the processor. The vectors 33 to 255 are free to be used by the user. 0 2 4 6 1 3 5 7 Offset (A31 - A16) Offset (A15 - A0) Segment Selector 00H01110PFThe protected mode interrupt descriptor
  • 21. Page 21 Exception Interrupts Divide by zero error CPU generates a type 0 interrupt whenever the div/idiv instructions result in a quotient that is larger than the destination specified or an attempt is made to divide by zero. Single step Interrupt ∗ Useful in debugging ∗ To single step, Trap Flag (TF) should be set ∗ CPU automatically generates a type 1 interrupt after executing each instruction if TF is set ∗ Type 1 ISR can be used to present the system state to the user
  • 22. Page 22 Exception Interrupts There exists no instruction to directly set or reset trap flag. TF=1 can be set by executing the following sequence of instructions: PUSHF MOV BP,SP OR WORD PTR[BP+0],0100H POPF TF=0 can be set by executing the following sequence of instructions: PUSHF MOV BP,SP AND WORD PTR[BP+0],0FEFFH POPF
  • 23. Page 23 Software Interrupts Initiated by executing an instruction INT, INTO, INT 3, BOUND INT and INT3 behave in a similar way. INT n: - n is an integer from range 0 to 255 - Calls ISR located at vector n (n*4). - The INT instruction requires two bytes of memory, opcode plus n. - Each interrupt type can be parameterized to provide several services. - For example, DOS interrupt service int 21H provides more than 80 different services ∗ AH register is used to identify the required service under int 21H.
  • 24. Page 24 BOUND and INTO are both conditional. BOUND: Bound AX,DATA AX is compared with DATA and DATA+1, if less than an interrupt occurs. AX is compared with DATA+2 and DATA+3, if greater than an interrupt occurs. INTO: Checks the overflow flag (OF). If OF=1, the ISR is called. IRET removes 6 bytes from the stack, 2 for IP, 2 for CS and 2 for FLAGS.
  • 25. Page 25 Hardware Interrupts • Software interrupts are synchronous events ∗ Caused by executing the int instruction • Hardware interrupts are of hardware origin and asynchronous in nature ∗ Typically caused by applying an electrical signal to the processor chip • Hardware interrupts can be ∗ Maskable (INTR) ∗ Non-maskable (NMI) » Causes a type 2 interrupt
  • 26. Page 26 Non-Maskable Interrupt Non-maskable interrupt is triggered by applying an electrical signal to the NMI pin of Pentium ∗ Processor always responds to this signal ∗ Cannot be disabled under program control The non-maskable interrupt (NMI) is an edge-triggered input that requests an interrupt on the positive edge (0-to-1 transition). after a positive edge, the NMI pin must remain logic 1 until recognized by the microprocessor before the positive edge is recognized, NMI pin must be logic 0 for at least two clocking periods The NMI input is often used for parity errors and other major faults, such as power failures. power failures are easily detected by monitoring the AC power line and causing an NMI interrupt whenever AC power drops out .
  • 27. Page 27 INTR and INTA The INTR pin must be externally decoded to select a vector. Any vector is possible, but the interrupt vectors between 20H and FFH are usually used (Intel reserves vectors between 00H and 1FH). INTA is an output of the microprocessor to signal the external decoder to place the interrupt number on data bus connections D7-D0. The INTR pin is set by an external device (8259A) and cleared in the ISR. The input is automatically disabled by the microprocessor once it is recognized and re-enabled by IRET or IRETD instruction.
  • 28. Page 28 INTR: Interrupt Request. Activated by a peripheral device to interrupt the processor. Level triggered. Activated with a logic 1. INTA: Interrupt Acknowledge. Activated by the processor to inform the interrupting device the interrupt request (INTR) is accepted. Level triggered. Activated with a logic 0.