Module5 - Interrupts - Dma (Read-Only)
Module5 - Interrupts - Dma (Read-Only)
1
2 .
.
. .
.
Interrup i .
t
i+1 .
.
.
M
19
Dr. Ilavarasi A K, VIT Chennai
Sequence of Steps
• To initiate transfer, processor sends starting address, number of
words in the block, and direction of transfer.
• Starting address and word count are placed in the appropriate
registers.
• The control and status register signals the direction of transfer (read or
write).
• Processor puts the program that requested
transfer in blocked state and executes another
program.
• DMA controller performs the required process and sends an interrupt
signal on completion.
• Once a block of data has been transferred, controller sets “Done” to 1.
• When IE = 1, controller raises an interrupt after the transfer of a
20
block. Dr. Ilavarasi A K, VIT Chennai
Cycle Stealing and Burst Mode
• Memory can be access by both processor and DMA controllers
• Requests from DMA controller are given higher priority than processor requests.
• Among different DMA devices, top priority is given to high-speed peripherals.
• Since the processor originates most memory access cycles, the DMA(k)
controller can be said to steal memory cycles from processor – Cycle stealing
• DMA controller may also be given exclusive access to the main memory
without any interruption – Block or burst mode
• A conflict may arise if both the processor and a DMA controller or two
DMA controllers attempt to use the bus at the same time to access the main
memory.
• To resolve these conflicts, an arbitration procedure is implemented.
21
Dr. Ilavarasi A K, VIT Chennai
Bus Arbitration
• Device allowed to initiate data transfers on the bus at any given time
bus master
• When the current master relinquishes control of the bus, another
device can acquire the status.
• Bus arbitration–The process of selecting the next bus master and transferring
bus control to that device.
• Two approaches to bus arbitration:
• Centralized – Single bus arbiter performs the arbitration
• Distributed – All devices participate in the process of selection
22
Dr. Ilavarasi A K, VIT Chennai
Centralized Arbitration
• The bus arbiter may be the processor, or a separate unit connected to the
bus.
• A simple arrangement for bus arbitration using a daisy chain:
Bus-busy line
Bus-request line
Bus-grant
23
Dr. Ilavarasi A K, VIT Chennai
Centralized Arbitration
• The processor will be the bus master till it grants mastership to one of the
DMA controllers.
• A DMA controller indicates that it needs to become bus master by sending out a
bus-request signal (𝐵𝑅).
• The processor then sends out the bus-grant signal (𝐵𝐺 ) in a daisy-
chain arrangement.
• The DMA controller that requested to be bus master accepts the bus-
grant signal, waits for the bus-busy line (𝐵𝐵𝑆𝑌) to become inactive and
then assumes mastership of the bus.
• This DMA controller also activates the 𝐵𝐵𝑆𝑌 line again to
keep other DMA controllers from accessing the bus.
24
Dr. Ilavarasi A K, VIT Chennai
Centralized Arbitration
• Multiple DMA controllers may send out a bus-request signal at a time.
• The signal on the 𝐵𝑅 line is an OR of all the bus-request signals.
• First DMA controller on the daisy-chain gets granted the bus mastership.
• The devices can also be arranged in priority groups.
• The arbiter ensures that only one request is granted at a time,
based on
priority – 𝐵𝑅1 with the highest priority and 𝐵𝑅𝑝 with the lowest
• Rotating priority scheme could also be used.
• If 𝐵𝑅1 is granted first, then the priority becomes 2, 3, … , p, 1
25
Dr. Ilavarasi A K, VIT Chennai
Centralized Arbitration
26
Dr. Ilavarasi A K, VIT Chennai
Distributed Arbitration
1. Equal Responsibility:
1. All devices waiting to use the bus have equal responsibility in the arbitration process. No central
arbiter is present
Each device on the bus is assigned a unique 4-bit identification number
When devices want to use the bus, they assert the Start − arbitration signal.
And They place their ID numbers on the ID lines.
Determining Priority:
2. The code on the ID lines represents the request with the highest ID number.
3. In the example, devices A (0101) and B (0110) contend for the bus, and B, with a higher ID, gets
priority
Distributed Arbitration
• A transmits 0101 and B transmits 0110.
• The connection performs an OR operation,
so the code seen by the two devices will be
0111.
• Each device compares the pattern on the
arbitration lines to its own ID, starting from
the most significant bit.
• If it detects a difference at any bit position,
it disables drivers (makes the value 0) at
that bit position and all lower bits.
• This will ultimately cause the arbitration
lines to reflect the highest ID, namely, 0110.
28
Dr. Ilavarasi A K, VIT Chennai