Professional Documents
Culture Documents
DCO Presentation 5 PDF
DCO Presentation 5 PDF
DCO Presentation 5 PDF
• Many hardware systems use DMA including disk drive controllers, graphics
cards, network cards and sound cards.
• DMA is also used for intra-chip data transfer in multi-core processors, especially
in multiprocessor system-on-chips, where its processing element is equipped
with a local memory (often called scratchpad memory).
• DMA is used for transferring data between the local memory and the main
memory. Computers that have DMA channels can transfer data to and from
devices with much less CPU overhead than computers without a DMA channel
Copyright@ Amity University
Direct Memory Access (DMA)
• DMA is an essential feature of all modern computers, as it allows
devices to transfer data without subjecting the CPU to a heavy
overhead. Otherwise, the CPU would have to copy each piece of data
from the source to the destination, making itself unavailable for other
tasks.
• CPU can be utilized for other jobs during the process of DMA.
2. The DMA recognizes that the interrupt request is from the device it
is controlling.
5. The DMA stores the data into its data assembly register.
7. The DMA places the contents of its memory address register onto
the system bus along with a memory write request.
• Parallel Buses
The communication links across which computers—or parts of
computers—talk to one another may be either serial or parallel.
A parallel link transmits several streams of data (perhaps
representing particular bits of a stream of bytes) along multiple
channels (wires, printed circuit tracks, optical fibres, etc.)
• The start signal serves to prepare the receiving mechanism for the
reception and registration of a symbol and the stop signal serves to
bring the receiving mechanism to rest in preparation for the reception of
the next symbol.
END
2b
5
execute instructions
WRITE WRITE in the program that
END
3
3a occur before the
3b
next I/O command.
WRITE WRITE
The processor is
No Interrupts
kept busy the whole
Long I/O - The „next‟
1 4 5 2 4 5 3
time.
I/O command comes
Interrupts -Short I/O wait. before first I/O has
1 4 2a 5 2b 4 3a 5 3b completed.
Processor still needs
Interrupts -Long I/O wait. (More realistic!) to wait. Some time is
1 4 5 4 5
2 3
saved !
Copyright@ Amity University
An example
Busy Wait:
Consider a computer that can execute two
instructions that read the status register and check
the flag in 1 µs.
Input device transfers data at an average rate of 100
bytes per second – equivalent to one byte every
10,000 µs.
The CPU will check the flag 10,000 times between
each transfer.
Interrupt Driven:
CPU could use this time to perform other useful
processing.
If there is an interrupt:
Suspend operation of the program
Save its context
Set PC to start address of the interrupt handler
Process the interrupt
Restore the context of the original program and continue its
execution.
Define priorities
Low priority interrupts can be interrupted by higher priority
interrupts
When higher priority interrupt has been processed, processor
returns to previous interrupt
Daisy-Chain Priority
• Hardware solution
• Serial connection of all devices that request interrupts.
• Device with the highest priority takes first position, 2nd highest
takes 2nd position etc.
• Interrupt request line shared by all devices.
Copyright@ Amity University
Daisy-chain Priority Interrupt
A Serial Approach
INT
Interrupt Request CPU
PI
Priority In
. . Vector Address
Interrupt
request
from device S Q
RF . Priority Out
PO
Delay PI RF PO Enable
Open-collector 0 0 0 0
inverter
Interrupt request to 0 1 0 0
CPU
1 0 1 0
From: Computer System Architecture, Morris 1 1 0 1
Mano
Copyright@ Amity University
Parallel Priority Interrupt
Uses a register – whose bits are set separately by the
interrupt signal from each device.
Priority established according to the position of bits in
the interrupt register.
A mask register is used to control the status of each
interrupt request. Mask bits set programmatically.
Priority encoder generates low order bits of the VAD,
which is transferred to the CPU.
Encoder sets an interrupt status flip-flop IST whenever a
non-masked interrupt occurs.
Interrupt enable flip-flop provides overall control over the
interrupt system.
Copyright@ Amity University
Parallel Priority Interrupt Hardware
Interrupt
Register
Disk I0
0
Priority Encoder
Printer
I1 y
1
x
Reader
I2
From: Computer System Architecture, Morris
2 0
Keyboard 0
I3
3
0
0
0
0
IEN IST 0
Enable
1
2
Interrupt to CPU
Mano
3
INTACK from CPU
Mask
Register
Copyright@ Amity University
Priority Encoder
Circuit that implements the priority function.
Logic – if two or more inputs arrive at the same time, the
input having the highest priority will take precedence.
Inputs Outputs
I0 I1 I2 I3 d Y IST
1 d d d 0 0 1
0 1 d d 0 1 1
0 0 1 d 1 0 1
0 0 0 1 1 1 1
0 0 0 0 d d 0
Boolean functions
X = I‟0I‟1 Y = I‟0I1 + I‟0I‟2 IST = I0 + I1 + I2 + I3
Copyright@ Amity University
Interrupt Cycle
The Interrupt enable flip-flop (IEN) can be set or cleared
by program instructions.
A programmer can therefore allow interrupts (clear IEN)
or disallow interrupts (set IEN)
At the end of each instruction cycle the CPU checks IEN
and IST. If either is equal to zero, control continues with
the next instruction. If both = 1, the interrupt is handled.
Interrupt micro-operations:
SPSP – 1 (Decrement stack pointer)
M[SP] PCc Push PC onto stack
INTACK 1 Enable interrupt acknowledge
PC VAD Transfer vector address to PC
IEN 0 Disable further interrupts
Go to fetch next instruction
Copyright@ Amity University
Software Routines for handling Interrupts
Software routines used to service JMP DISK Program to service
interrupt requests and control interrupt magnetic disk.
hardware registers. JMP PRINTER
Each device has its own service program JMP READER Program to service
reached through a jump instruction stored line printer.
JMP KEYBOARD
at the assigned vector address.
Program to service
Example: character reader.
Keyboard sets interrupt bit whilst CPU
is executing instruction at location 749. Main program Program to service
At the end of the instruction, 750 is pushed Keyboard.
onto the stack, the VAD for the keyboard is
taken off the bus and placed into the PC.
Stack
Control is passed to the keyboard routine.
Once completed, PC is replaced with original
address of next instruction (750)
Bus Ready
of the devices during normal operation.
Time slice – fixed length time slice of Priority Encoder
bus time offered sequentially to each
processor in round robin fashion.
Polling – address of each device in
turn placed on polling lines. A device 2 X 4 Decoder
may activate bus busy if it is being polled.
LRU – Least recently used.
FIFO – First in first out.
Hardware for parallel arbitration
Rotating Daisy-chain – dynamic
extension of the daisy chain.
• In other cases the search word and all of the words in the memory are
shifted serially in synchronism; a single bit of the search word is then
compared to the same bit of all of the memory words using as many
single-bit coincidence circuits as there are words in the memory.
• Small parallel associative memories are used in cache memory and virtual
memory mapping applications.
Copyright@ Amity University
Associative Memory
• A type of memory closely associated with neural networks
– Autoassociative memory
– Hopfield net
The time required to find an item stored in memory can be reduced considerably if the
stored data item can be identified for access by the content of the data itself rather
than by its address. Memory that is accessed in this way is called content-addressable
memory (CAM) or associative memory.
CAMs are an outgrowth of RAM which is an integrated circuit that stores data
temporarily.
• Most operating systems have a form of memory management that caters for memory
needs beyond a computer system’s physical memory through the use of a Swap File.
• There is a need for such memory management as operating systems themselves occupy
a significant portion of physical memory.
• A Swap File is a file located on a computer’s hard disk drive (HDD) that acts as an
extension to physical memory. However, the HDD has much slower access times than
any of the forms of memory discussed above. Hence, information is swapped between
the main memory and the swap file to ensure that the more frequently used information is
located in the main memory for faster access speeds.
– hiding fragmentation.
Cache
Main
Memory CPU
Memory
(SRAM)
(DRAM)
= Bus connections
Copyright@ Amity University
Cache Memory
• This form of memory can be considered as an intermediary between the main physical RAM
and the CPU. The cache makes any data frequently used by CPU instantly available. If the
required information is not located in the cache, a fetch is made from the main memory.
• There are two levels of cache: Level 1 Cache (primary cache) and Level 2
Cache (secondary cache).
1. Level 1 cache is built directly on the CPU, just like the registers. It is small in size, ranging
anywhere between 2 kilobytes (KB) and 128KB. As this cache is closer to the CPU than
level 2 cache, its transfer speeds are much faster as a result.
2. Level 2 cache is usually situated in close proximity to, but off, the CPU chip. However,
there are certain systems where the cache is built directly onto the CPU itself as like the
level 1 cache. The size of level 2 cache ranges from 256KB to 2 megabytes (MB). Both
levels of cache use Static Random Access Memory (SRAM) to hold the data.
• As the microprocessor processes data, it looks first in the cache memory and if it
finds the data there (from a previous reading of data), it does not have to do the
more time-consuming reading of data from larger memory.
• L2 is usually a separate static RAM (SRAM) chip. The main RAM is usually a
dynamic RAM (DRAM) chip.
Copyright@ Amity University
Cache Memory