Module-4-23CS302
Module-4-23CS302
Starting address
Word count
Direct Memory Access
Mai
Process n
memor
or
y
System bus
• DMA controller requests the control of the bus by asserting the Bus Request (BR) line.
• In response, the processor activates the Bus-Grant1 (BG1) line, indicating that the
controller may use the bus when it is free.
• BBSY signal is 0, it indicates that the bus is busy. When BBSY becomes 1, the DMA
controller which asserted BR can acquire control of the bus.
Centralized Bus Arbitration
B BS Y
BR
Processo
r
DMA DMA
controller controller
BG1 1 BG2 2
Distributed arbitration
⚫All devices waiting to use the bus share the responsibility of
carrying out the arbitration process.
⚫Each device is assigned a 4-bit ID number.
⚫All the devices are connected using 5 lines, 4 arbitration lines
to transmit the ID, and one line for the Start-Arbitration signal.
⚫To request the bus a device:
⚫Asserts the Start-Arbitration signal.
⚫Places its 4-bit ID number on the arbitration lines.
Arbitration process:
• Each device compares the pattern that appears on the arbitration lines to its own
ID, starting with MSB.
• If it detects a difference, it transmits 0s on the arbitration lines for that and all lower
bit positions.
• Device A compares its ID 5 with a pattern 0101 to pattern 0111.
• It detects a difference at bit position 2, as a result, it transmits a pattern 0100 on the
arbitration lines.
• The pattern that appears on the arbitration lines is the logical-OR of 0100 and 0110,
which is 0110.
• This pattern is the same as the device ID of B, and hence B has won the arbitration.
Fundamental Concepts
Mai
Proces Cac memo
n
sor he ry
● Write hit:
▪ Cache has a replica of the contents of the main memory.
▪ Contents of the cache and the main memory may be updated simultaneously.
This is the write-through protocol.
▪ Update the contents of the cache, The contents of the main memory are updated
when this block is replaced. This is write-back or copy-back protocol.
Cache miss
● If the data is not present in the cache, then a Read miss or Write miss
occurs.
● Read miss:
▪ Block of words containing this requested word is transferred from the
memory.
▪ After the block is transferred, the desired word is forwarded to the processor.
▪ The desired word may also be forwarded to the processor as soon as it is
transferred without waiting for the entire block to be transferred. This is called
load-through or early-restart.
● Write-miss:
▪ Write-through protocol is used, then the contents of the main memory are
updated directly.
▪ If write-back protocol is used, the block containing the
addressed word is first brought into the cache. The desired word
is overwritten with new information.
Mapping functions
Block 4095
Performance considerations
AB DB AB DB AB DB AB DB AB DB AB DB
R R R R R R R R R R R R
Modul Modul Modul Modul Modul Modul
k
e 0 e i en- 1 e 0 e i e2 - 1
◼ Hit rate
◼ Miss penalty
◼ Hit rate can be improved by increasing block size, while
keeping cache size constant
◼ Block sizes that are neither very small nor very large give
best results.
◼ Miss penalty can be reduced if load-through approach is
used when loading new blocks into cache.
Other Performance Enhancements
Write buffer
◼ Write-through:
● Each write operation involves writing to the main memory.
● If the processor has to wait for the write operation to be complete, it slows
down the processor.
● Processor does not depend on the results of the write operation.
● Write buffer can be included for temporary storage of write requests.
● Processor places each write request into the buffer and continues execution.
● If a subsequent Read request references data which is still in the write
buffer, then this data is referenced in the write buffer.
◼ Write-back:
● Block is written back to the main memory when it is replaced.
● If the processor waits for this write to complete, before reading the new
block, it is slowed down.
● Fast write buffer can hold the block to be written, and the new
block can be read first.
Other Performance Enhancements
(Contd.,)
Prefetching
● New data are brought into the processor when they are first
needed.
● Processor has to wait before the data transfer is complete.
● Prefetch the data into the cache before they are actually
needed, or a before a Read miss occurs.
● Prefetching can be accomplished through software by
including a special instruction in the machine language of
the processor.
▪ Inclusion of prefetch instructions increases the length of the
programs.
● Prefetching can also be accomplished using hardware:
▪ Circuitry that attempts to discover patterns in
memory references and then prefetches according
to this pattern.
Arithmetic
Multiplication
Multiplication of unsigned numbers
Multiplicand
0 m3 0 m2 0 m1 0 m0
(PP0)
q0
0
PP1 p0
q1
0
PP2 p1
q2
0
PP3 p2
q3
0
,
p7 p6 p5 p4 p3
Shift right
C a a q q
n - 1 0 n - 1 0
Multiplier Q
Add/Noadd
control
n-bit
Adder
MUX Control
sequencer
0 0
m m
n - 1 0
Multiplicand M
Sequential multiplication (contd..)
M
1 1 0 1
Initial configuration
0 0 0 0 0 1 0 1 1
C A Q
0 1 1 0 1 1 0 1 1 Add
Shift First cycle
0 0 1 1 0 1 1 0 1
1 0 0 1 1 1 1 0 1 Add
Shift Second cycle
0 1 0 0 1 1 1 1 0
0 1 0 0 1 1 1 1 0 No add
Shift Third cycle
0 0 1 0 0 1 1 1 1
1 0 0 0 1 1 1 1 1 Add
Shift Fourth cycle
0 1 0 0 0 1 1 1 1
Product
Signed Multiplication
Signed Multiplication
1 0 0 1 1 ( - 13)
0 1 0 1 1 ( + 11)
1 1 1 1 1 1 0 0 1 1
1 1 1 1 1 0 0 1 1
Sign extension is
shown in blue 0 0 0 0 0 0 0 0
1 1 1 0 0 1 1
0 0 0 0 0 0
1 1 0 1 1 1 0 0 0 1 ( - 143 )
0 0 1 0 1 1 0 0 1 1 1 0 1 0 1 1 0 0
0 + 1 -1 + 1 0 - 1 0 +1 0 0 - 1 +1 - 1 + 1 0 - 1 0 0
0 1 1 0 1 ( + 13) 0 1 1 0 1
X1 1 0 1 0 (- 6 ) 0 - 1 +1 - 1 0
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 1 1
0 0 0 0 1 1 0 1
1 1 1 0 0 1 1
0 0 0 0 0 0
1 1 1 0 1 1 0 0 1 0 ( - 78 )
Multiplier
Version of multiplicand
selected by biti
Bit i Bit i -1
0 0 0 X M
0 1 +1 X M
1 0 −1 X M
1 1 0 X M
an an-1 a0 qn-1 q0
Dividend Q
A Quotient
Setting
0 mn-1 m0
Divisor M
Shift 0 0 0 1 0 0 0 0 1
Subtract 1 1 1 0 1 0 0 1
Set q0 1 1 1 1 1 Fourth cycle
Restore 1 1
0 0 0 1 0 0 0 1 0
Remainder Quotient
Shift 1 1 1 0 0 0 0 0
Add 0 0 0 1 1 Second cycle
Set q 1 1 1 1 1 0 0 0 0
0
Shift 1 1 1 1 0 0 0 0
1 1 1 1 1 Add 0 0 0 1 1 Third cycle
Restore
0 0 0 1 1 Set q 0 0 0 0 1 0 0 0 1
remainder 0
Add 0 0 0 1 0
Remainder Shift 0 0 0 1 0 0 0 1
Subtract 1 1 1 0 1 Fourth cycle
Set q 1 1 1 1 1 0 0 1 0
0
Quotient
A nonrestoring-division example.
IEEE standard for floating point numbers
IEEE standard for floating point numbers
IEEE standard for floating point numbers
IEEE standard for floating point numbers
IEEE standard for floating point numbers
Example