SlideShare a Scribd company logo
Unit 3
Addition and Subtraction with signed
magnitude data
• When signed numbers are added or
subtracted, we find that there are eight
different conditions to consider, depending
on the sign of the numbers and the operation
performed.
• These conditions are listed in the first column
of table 10-1.
• The other columns in the table show the
actual operation to be performed with the
magnitude of the number
If sign is different
for add=subtract
If sign is different
for subtract=add
Remember
• The two magnitude are subtracted if the
signs are different for an add operation or
identical for a subtract operation.
• The last column is needed to prevent a negative
zero.
• In other words, when two equal numbers are
subtracted, the result should be +0 not -0.
• Addition(subtraction) algorithm : when the signs
of A and B are identical ,and the two magnitudes
and attach the sign of A to the result.
• When the sign of A and B are different ,compare
the magnitudes and subtract number from the
larger.
• Choose the sign of the result to be the same as A
if A>B or the complement of the sign of A if A<B.
• If the two magnitude are equal, subtract B from
A and make the sign of the result positive.
Hardware Implementation
• To implement the two arithmetic operations
with hardware, it is first necessary that the
two numbers be stored in register.
• Let A and B be two registers that hold the
magnitude of the numbers, and As and Bs be
two flip-flops that hold the corresponding signs.
• The result of the operation may be transferred into A
and As.
• Thus A and As together form an accumulator register.
Fig 10-1 shows a block diagram of the hardware for
implementing the addition and subtraction
operation.
It consists of register A and B and sign flip-flop As
and Bs
Subtraction is done by adding A to the 2’s
complement of B
The output carry is transferred to flip-flop Where it
can be checked to determine the relative
magnitude of the two numbers.
The add-overflow flip-flop AVF holds the overflow
bit when A and B are added.
The A register provides other micro operations that
may be needed when we specify the sequence of
steps in the algorithm.
• The addition of A plus B is done through the
parallel adder.
• The S(sum) output of the adder is applied to
the input of the A register.
• The complementer provides an output of B or
the complement of B depending on the state
of the mode control M.
• When M=0,the output of B is transferred to
the adder, the input carry is 0,and the output
of the adder is equal to the sum of A+B.
• When M=1,the 1’s complement of B is applied
to the adder, the input carry is 1,and the
output S=A+B’+1
• This is equal to A plus 2’s complement of
Which is equivalent to the subtraction A-B.
Flow chart
• The flow chart for the hardware algorithm is
presented in fig 10-2.
• The two sings As and Bs are compared by an
exclusive-OR gate.
• If the output of the gate is 0,the signs are
identical ;if it is 1,the signs are different.
• For an add operation identical signs dictate that
the magnitude be added.
• For a subtract operation, different sign dictate
that the magnitude be added
Sign bit of A
and B
A=B
XOR
As(sign bit) Bs(sign bit) output
0 0 0 (add)
0 1 1(subtract)
1 0 1(subtract)
1 1 0 (add)
1. Example for Addition A+B
A=12
B=-10 we can write as (+A)+(-B)
A>B +(12-10)
A+B= (12)+(-10)=2
2 in binary =0010
Sign bit of 12= 1
Sing bit of 10=-1
So subtraction is performed
A+(B’+1)=1100+2’s complement of B
B=1010 ,2’s complement of B=0110
EA=A+(B’+1)= 1100+0110=10010
E=1 and A=0010
E=1 so A>=B and As=0
Final answer is in A=2
Sign of 2 is positive because As=0
2. Example for Addition A+B
A=12
B=10 we can write as (+A)+(+B)
A>B +(12+10)
A+B= (+12)+(+10)=22
22 in binary =10110
Sign bit of 12= 1
Sing bit of 10=1
1 XOR 1=0
So addition is performed
A+B=1100+1010=10110
E=1 and A=0110
AVF=E=1 (overflow)
As=0 positive
• The magnitude are added with a micro operation E A<-
A+B, where E A is a register that combines E and A.
• The carry in E after the addition constitute an
overflow if it is equal to 1.
• The value of E is transferred into the add-overflow
flip-flop AVE.
• The two magnitude are subtracted if the signs are
different for an add operation or identical for a
subtract operation.
• The magnitude are subtracted by adding A to the 2’s
complement of B
• No overflow can occur if the numbers are subtracted
so AVF is cleared to 0.
• A 1 in E indicates that A>=B and the number in A is the
correct result.
• If this number is zero, the sign As must be made
positive to avoid a negative zero.
• A 0 in E indicates that A<B. for this case it is
necessary to take 2’s complement of the value in
A.
• This operation can be done with one micro
operation A<-A’+1.
• However we assume that A register has circuit for
micro operations complement and increment, so
the 2’s complement is obtained from these two
micro operations.
• In other paths of the flowchart, the sign of the
result is the same as the sign of A, so no change
in As is required.
• However, when A<B the sign of the result is the
complement of the original sign of A.
it is necessary to complement As to obtain the
correct sign.
The final result is found in register A and its sign
in As.
The value in AVF provides an overflow
indication.
The final value of E is immaterial.
Multiplication Algorithms
• Multiplication of two fixed-point binary
numbers in signed-magnitude representation
is done with paper and pencil by a process of
successive shift and add operations.
• This process is best illustrative with a
numerical example.
Multiplication Algorithm
• The process consists of looking at successive bits
of the multiplier, least significant bit first.
• If the multiplier bit is 1,the multiplicand is
copied down; otherwise ,zeros are copied down.
• The number copied down in successive lines are
shifted one position to the left from the previous
number.
• Finally, the numbers are added and their sum
forms the product.
• The sign of the product is determined from the
signs of the multiplicand and multiplier.
• If they are alike, the sign of the product is
positive.
• If they are unlike, the sign of the product is
negative
EXMAPLE
Multiplier : Q=10011=19
Multiplicand : B=10111=23
19*23=437
437 in binary : 0001 1011 0101
• 2018
• Draw flow chart of multiplication process(6
marks)
Example Multiplicand
Multiplier
• A=10011 =19
• B=10111=23
• A x B=19x23=437 = 110110101
Hardware for multiply operation
• Initially, the multiplicand is in register B and the multiplier
in Q.
• The sum of A and B forms a partial product which is
transferred to the EA register
• Both partial product and multiplier are shifted to the right.
• This shift will be denoted by the statement shr EAQ to
designate the right shift.
• The least significant bit of A is shifted into the most
significant position Q, the bit from E is shifted into the most
significant position of A, and 0 is shifted into E.
• After the shift one bit of the partial product is shifted into
Q, pushing the multiplier bits one position to the right.
• In this manner, the rightmost flip flop in register Q,
designated by Qn, will hold the bit of the multiplier, which
must be inspected next.
Booth Multiplication Algorithm
• Booth algorithm gives a procedure
for multiplying binary integers in signed 2’s
complement representation in efficient way,
i.e., less number of additions/subtractions
required.
• AC and the appended bit Qn+1 are initially
cleared to 0 and the sequence counter SC is
set to a number n equal to the number of bits
in the multiplier.
• The two bits of the multiplier in Qn and Qn+1
are inspected.
• If the two bits are equal to 10,it means that
the first 1 in a string of 1’s has been
encountered.
• This requires a subtraction of the multiplicand
from the partial product in AC.
• If the two bits are equal to 01,it means that
the first 0 in a string of 0’s has been
encountered.
• This requires the addition of the multiplicand
to the partial product in AC.
• When the two bits are equal, the partial
product does not change.
• An overflow cannot occur because the
addition and subtraction of the multiplicand
follow each other.
• As a consequence, the two numbers that are
added always have opposite signs, a condition
that excludes an overflow.
• The next step is to shift right the partial
product and the multiplier (including bit
Qn+1).
• this is an arithmetic shift right(ashr) operation
which shifts AC and QR to the right and leaves
the sign bit in AC unchanged.
• The sequence counter is decremented and the
computational loop is repeated n times.
Note
• Subtraction = Qn=-1
• Addition = Qn=1
Booth Multiplication Example
Multiplier : QR=10011=2’s complement of(10011)=
01101=13
Multiplicand : BR=10111=2’s complement of
(10111)=01001=9
-13*-9=117
117 in binary : 00011 10101
The 10 bit product appears in AC and QR and is
positive.
The final value of Qn+1 is the original sign bit of the
multiplier and should not be taken as part of the
product.
2015
• Explain function of booths algorithm and
multiply (+15)x(-13) using general
multiplication algorithm of Booth
algorithm.(6.5 marks)
Multiplicand : BR=01111 (+15)
Multiplier : QR=01101=2’s complement of
(01101)=10011= (-13)
15*-13=-195
195 in binary : 11000011
195 in binary (2’s complement): 11001 11101
The 5 bit product appears in AC and QR and is
positive.
The final value of Qn+1 is the original sign bit of
the multiplier and should not be taken as part
of the product.
Assume 5 bit register
10011
01100
11011
2014
Show step by step multiplication process using
Booth algorithm when the following binary
numbers are multiplied. Assume 5 bit registers
that hold singed numbers:
1. (+5)x(-3)
Multiplicand : BR=00101 (+5)
Multiplier : QR=00011=2’s complement of
(00011)=11101= (-3)
+5*-3=-15
15 in binary : 0000 1111
15 in binary (2’s complement): 1111 0001
The 5 bit product appears in AC and QR and is
positive.
The final value of Qn+1 is the original sign bit of
the multiplier and should not be taken as part
of the product.
Assume 5 bit register
11101
11110
01111
2014
Show step by step multiplication process using
Booth algorithm when the following binary
numbers are multiplied. Assume 5 bit registers
that hold singed numbers:
(-5)x(-3)
Multiplicand : BR=000101=2’s complement of
(000101)=111011(-5)
Multiplier : QR=00011=2’s complement of
(00011)=11101= (-3)
-5*-3=+15
15 in binary : 0000 1111
The 5 bit product appears in AC and QR and is
positive.
The final value of Qn+1 is the original sign bit of
the multiplier and should not be taken as part
of the product.
11101
11110
11111
2019
Multiply using Booth algorithm (+19)x(-11)
2016
Using Booths algorithm, illustrate the sequence
of steps in a tabular fashion, when 11101 is
multiplied with 10111.
Multiplicand : BR=11101=2’s complement
of(11101)= 00011=3
Multiplier : QR=10111=2’s complement of
(10111)=01001=9
-3*-9=27
27 in binary : 11011
The 5 bit product appears in AC and QR and is
positive.
The final value of Qn+1 is the original sign bit of
the multiplier and should not be taken as part
of the product.
10111
01110
10111
Array Multiplier in Digital Logic
• An array multiplier is a digital combinational
circuit used for multiplying two binary
numbers by employing an array of full adders
and half adders.
• This array is used for the nearly simultaneous
addition of the various product terms
involved.
• To form the various product terms, an array of
AND gates is used before the Adder array.
• The multiplicand bits are b1 and b0, the
multiplier bits are a1 and a0, and the product
is c3c2c1c0
• The first partial product is formed by
multiplying a0 by b1,b0.
• The multiplication of two bits such as a0 and
b0 produces a 1 if both bits are 1;otherwise,it
produces a 0.
• This is identical to an AND operation and can
be implemented with an AND gate.
• As shown in diagram first partial product is
formed by means of two AND gates.
• The second partial product is formed by
multiplying a1 by b1b0 and is shifted one
position to the left.
• The two partial product are added with two
half-adder circuit.
• Least significant bit of product does not have
to go through an adder since it is formed by
the output of the first AND gate.
1 , 2 bit adder
2 bit by 2 bit array multiplier
Note
• For j multiplier bits and k multiplicand bits we
need jxk AND gates and (j-1) k bit adders to
produce a product of j+k bits
• Example : j=2 and k=2
• 2x2=4 AND gates
• 2-1=1 2 bit adder
• 2+2=4 bits product (c3 c2 c1 c0)
• A second example, consider a multiplier circuit
that multiplies a binary number of four bits
with a number of three bits.
• let the multiplicand be represented by
b3b2b1b0 and the multiplier by a2a1a0.
• Since k=4 and j=3,we need 12 AND gates and
two(j-1=3-1=2) 4 bit adders to produce a
product of seven bits.
• The logic diagram of the multiplier is shown in
fig (next slide).
12 AND gates
2 , 4 bit full
adder
Example
Division Algorithm
• The divisor B consists of five bits and the
dividend A, of ten bits.
• The five most significant bits of the dividend
are compared with the divisor.
• Since the 5-bit number is smaller than B, we
try again by taking the six most significant bits
of A and compare this number with B.
• The 6th bit number is greater than B, so we
place a 1 for the quotient bit in the sixth
position above the dividend.
• The divisor is then shifted once to the right
and subtracted from the dividend.
• The difference is called the partial reminder
because the division could have stopped here
to obtain a quotient of 1 and a remainder
equal to partial reminder.
• The process is continued by comparing a
partial remainder with the divisor.
• If the partial remainder is greater than or
equal to the divisor, the quotient bit is equal
to 1.
• the divisor is then shifted right and
subtracted from the partial remainder.
• If the partial remainder is smaller than the
divisor, the quotient bit is 0 and no
subtraction is needed.
• The divisor is shifted once to the right in any
case.
• Note that the result gives both a quotient and
a remainder.
6
Explanation
• 163/11=14 as quotient and 9 as remainder
Hardware Implementation
Hardware Implementation
• Instead of shifting the divisor to the right, the
dividend, or partial remainder, is shifted to
the left, thus leaving the two numbers in the
required relative position.
• Subtraction may be achieved by adding A to
the 2’s complement of B.
• The divisor is stored in the B register and the
double-length dividend is stored in register A and
Q.
• The divided is shifted to the left and the divisor is
subtracted by adding it’s 2’s complement value.
• The information about the relative magnitude is
available in E
• If E=1,it signifies that A>=B.
• A quotient bit 1 is inserted into Qn and the partial
remainder is shifted to the left to repeat the
process.
• If E=0, it signifies that A<B so the quotient in Qn
remains a 0(inserted during the shift).
• The value of the B is then added to restore the
partial remainder in A to its previous value
• The partial remainder is shifted to the left and
the process is repeated again unit all five
quotient bits are formed.
• Note while the partial remainder is shifted
left, the quotient bits are shifted also and
after five shifts, the quotient is in Q and the
final remainder is in A.
• Divisor B=10001
• Dividend A = 01110
Hardware Implementation
2019
• What is the need of input output interface(5
marks)
Input-Output Interface
• Input-output interface provides a method for
transferring information between internal
storage and external I/O devices
• Peripherals connected to a computer need
special communication links for interfacing
them with the central processing unit.
• The purpose of the communication link is to
resolve the differences that exist between the
central computer and each peripheral.
• The major difference are:
To resolve these differences, computer systems
include special hardware components between
CPU and peripherals to supervise and
synchronize all input and output transfers.
These components are called interface units.
I/O Bus and Interface Modules
• A typical communication link between the
processor and several peripherals is shown in
diagram.
I/O Bus and Interface Modules
• The I/O bus consists of data lines, address
lines, and control lines.
• Each peripheral device has associated with it
an interface unit.
• Each interface decodes the address and
control received from the I/O bus, interprets
them for the peripheral, and provides signals
for the peripheral controller.
• Each peripheral has its own controller that
operates that particular devices.
• For example: the printer controller controls
the paper montion, the print timing, and the
selection of printing characters.
• A controller may be physically integrated with
the peripheral.
• I/O bus from the processor is attached to all
peripheral interface.
• To communicate with a particular device, the
processor places a device address on the
address lines.
• Each interface attached to the I/O bus
contains an address decoder that monitor the
address lines.
• When the interface detects its own address,
it activates the path between the bus lines
and the device that it controls.
• All peripherals whose address does not
correspond to the address in the bus are
disabled by their interface.
Four types of commands that an interface may
receive :
1. Control command
2. Status command
3. Data output command
4. Data input command
1. Control command
• A control command is issued to activate the
peripheral and to inform it what to do.
• For example, a magnetic tape unit may be
instructed to backspace the tape by one
record, to rewind the tape, or to start the tape
moving in the forward direction.
• The particular control command issued
depends on the peripheral, and each
peripheral receives its own distinguished
sequence of control commands, depending on
its mode of operation.
2. Status command
A status command is used to test various status
conditions in the interface and the
peripheral.
For example: the computer may wish to check
the status of the peripheral before a transfer
is initiated.
During the transfer, one or more errors may
occur which are detected by the interface.
These errors are designed by setting bits in a
status register that the processor can read at
certain intervals.
3.Data output
• A data output command causes the interface to
respond by transferring data from the bus into one of
its registers.
• Consider an example with a tape unit.
• The computer starts the tape moving by issuing a
control command.
• The processor then monitors the status of the tape by
means of a status command.
• When the tape is in the correct position, the processor
issues a data output command.
• The interface responds to the address and command
and transfers the information from the data lines in the
bus to its buffer register.
• The interface then communicates with the tape
controller and sends the data to be stored on tape.
The data input command is the opposite of
data output.
The interface receives an item of data from the
peripheral and places it in its buffer register.
The processor checks if data are available by
means of a status command and then issue a
data input command.
The interface places the data on the data lines,
where they are accepted by the processor.
4.Data input
2016
• What is the difference between isolated I/O
and memory mapped I/O? What are the
advantage and disadvantage of each?(2.5
marks)
Isolated versus Memory Mapped I/O
• As a CPU needs to communicate with the various
memory and input-output devices (I/O) as we
know data between the processor and these
devices flow with the help of the system bus.
• There are three ways in which system bus can be
allotted to them :
1. Separate set of address, control and data bus to
I/O and memory.
2. Have common bus (data and address) for I/O
and memory but separate control lines.
3. Have common bus (data, address, and control)
for I/O and memory.
• In first case it is simple because both have
different set of address space and instruction
but require more buses.
1. Isolated I/O
Then we have Isolated I/O in which we Have
common bus(data and address) for I/O and
memory but separate read and write control lines
for I/O.
So when CPU decode instruction then if data is for
I/O then it places the address on the address line
and set I/O read or write control line on due to
which data transfer occurs between CPU and I/O.
As the address space of memory and I/O is
isolated and the name is so.
The address for I/O here is called ports.
Here we have different read-write instruction for
both I/O and memory
Isolated I/O has 2
separate address
space for Memory
and I/O
2. Memory Mapped I/O
• In this case every bus is common due to which
the same set of instructions work for memory
and I/O.
• Hence we manipulate I/O same as memory
and both have same address space, due to
which addressing capability of memory
become less because some part is occupied by
the I/O.
There is no separate IN,OUT and MOV
Instruction used to manipulate the memory can be used for I/O
devices.
Isolated I/O has 1
address space for
Memory and I/O
2019
Asynchronous Data Transfer
• The transmitter transmits the data byte at any
instance of time.
• Only 1 byte is send at a time
• There is ideal time between 2 data bytes.
• Transmitter and receiver operates at different
clock frequencies.
• Example : Processor can send data any time to
I/O and vice versa because clock frequency of
both are different .
Asynchronous Data Transfer
• Asynchronous data transfer between two
independent units requires that control
signals be transmitted between the
communicating units to indicate the time at
which data is being transmitted.
• One way of achieving this is by means of a
strobe pulse supplied by one of the units to
indicate to the other unit when the transfer
has to occur.
• Another method commonly used is to
accompany each data item being transferred
with a control signal that indicates the
presence of data in the bus.
• The unit receiving the data item responds
with another control signal to acknowledge
receipt of the data.
• This type of agreement between two
independent units is referred to as a
handshaking
Strobe Control
• The strobe may be activated by either the source
or the destination unit
• Diagram shows a source-initiated transfer.
• The data bus carries the binary information from
source unit to the destination unit.
• The strobe is a single line that informs the
destination unit when a valid data word is
available in the bus
Control signal
Only valid data
The source unit first places the data on the data bus
The information on the data bus and the strobe
signal remain in the active state for a sufficient time
period to allow the destination unit to receive the
data
The destination uses falling edge of the strobe pulse
to transfer the contents of the data bus into one of
its internal registers.
Place the data on data
bus
EXPLANATION
Previous slide shows a data transfer initiated by
the destination unit.
In this case, destination unit activates the
strobe pulse, informing the source to provide
the data bus.
The source unit responds by placing the
requested binary information on the data bus.
The data must be valid and remain in the bus
long enough for the destination unit to accept
it.
EXPLANATION
The falling edge of the strobe pulse can be used
again to trigger a destination register
The destination unit then disables the strobe.
The source removes the data from the bus after
a predetermined time interval .
Handshaking
• The Dis-advantage of the strobe is that the
source unit that initiates the transfer has no way
of knowing whether the destination unit has
actually received the data item that was placed
in the bus.
• Similarly, a destination unit that initiates the
transfer has no way of knowing whether the
source unit has actually placed the data on the
bus.
• The handshake method solves this problem by
introducing a second chance control signal that
provides a reply to the unit that initiates the
transfer
Two wire control:
One control line is the same direction as the
data flow in the bus from the source to the
destination.
It is used by source unit to inform the
destination unit whether there are valid data
in the bus.
The other control line is in the other direction
from the destination to the source.
It is used by the destination unit to inform the
source whether it can accept data.
Source-initiated transfer using
handshaking
1. The source unit initiates the transfer by
placing the data on the bus and enabling its
data valid signal.
2. The data accepted signal is activated by the
destination unit after it accept the data from
the bus.
3. The source unit then disables its data valid
signal, which invalidates the data on the bus.
4. The destination unit then disables its data
accepted and the system goes into its initial
state.
The source does not send the next data item
until after the destination unit shows its
readiness to accept new data by disabling its
data accepted signal.
Destination initiated transfer using
handshaking
• The destination-initiated transfer using
handshaking lines is shown in diagram :
• The name of the signal generated by the
destination unit has been changed to ready
for data to reflect its new meaning.
• The source unit in this case does not place
data on the bus until after it receives the
ready for data signal from the destination
unit.
• From there on, the handshaking procedure
follows the same pattern as in the source-
initiated case.
1. The destination unit initiates the transfer by
enabling its ready for data signal
2. The source places the data on the bus and
enabling its data valid signal
3. The destination unit accept the data from
bus and then disables its ready for data signal
4. The source unit then disables its data valid
signal and invalidates the data on bus.
Mode of Transfer
• Data transfer between the central computer
and I/O devices may be handled in a variety of
modes.
• Some mode use the CPU as an intermediate
path; others transfer the data directly to and
from the memory unit.
Mode of Transfer
• Data transfer to and from peripherals may be
handled in one of the three possible modes:
1. Programmed I/O
2. Interrupt initiated I/O
3. Direct memory access(DMA)
1. Programmed I/O
• In the program I/O method, the CPU stays in a
program loop until the I/O unit indicates that
it is ready for data transfer.
• This is time consuming process since it keeps
the processor busy needlessly.
• When the interface determines that the
device is ready for data transfer, it generates
an interrupt request to the computer.
• Transfer of data under programmed I/O is
between CPU and peripheral.
Example of Programmed I/O
• Example of data transfer from an I/O device
through an interface into CPU is shown in fig.
• The device transfers bytes of data one at a time
as they are available
• When a byte of data is available, the device
places it in the I/O bus and enables its data valid
line.
• The interface accepts the byte into its data
register and enable the data accepted line.
• The interface sets a bit in the status register that
we will refer to as an F or flag bit.
• The device can now disable the data valid line,
but it will not transfer another byte until the data
accepted line is disabled by the interface.
• A program is written for the computer to
check the flag in the status register to
determine if a byte has been placed in the
data register by the I/O device.
• This is done by reading the status register into
a CPU register and checking the value of the
flag bit.
• If the flag is equal to 1,the CPU reads the
data from the data register.
• The flag bit is then cleared to 0 by enabling
the CPU or the interface, depending on how
the interface circuits are designed.
• Ones the flag is cleared, the interface
disables the data accepted line and the
device can then transfer the next data byte.
Transfer of each byte requires three
instruction
1. Read the status register
2. Check the status of the flag bit and branch to
step 1 if not set or to step 3 if set
3. Read the data register
Flowchart for CPU program
to input data
2. Interrupt initiated I/O
• An alternative to the CPU constantly monitor
the flag is to let the interface inform the
computer when it is ready to transfer data.
• This mode of transfer uses the interrupt
facility
• While the CPU is running a program, it does
not check the flag.
• However when the flag is set, the computer is
interrupted from the current program and is
informed of the fact that the flag has been
set.
• The CPU deviates from what it is doing to
take care of input or output transfer.
• After the transfer is completed, the computer
returns to the previous program to continue
what it was doing before the interrupt.
2016
• Explain in details Daisy chain priority
interrupt scheme(5 marks)
2015
Explain the difference between the daisy chain
priority and parallel priority interrupt. Draw the
diagram to explain their working?(6.5 marks)
• To summarize, when I/O devices are ready for I/O
transfer, they generate an interrupt request signal
to the computer.
• The CPU receives this signal, suspends the
current instructions it is executing and then
moves forward to service that transfer request.
• But what if multiple devices generate interrupts
simultaneously.
• In that case, we have to have a way to decide
which interrupt is to be serviced first.
• In other words, we have to set a priority among
all the devices for systemic interrupt servicing.
Priority Interrupts | (Daisy Chaining)
• The concept of defining the priority among
devices so as to know which one is to be
serviced first in case of simultaneous requests
is called priority interrupt system.
• This could be done with either software or
hardware methods.
HARDWARE METHOD –Daisy-Chaining
• This method establishes priority consists of a
serial connection of all devices that request
an interrupt.
• The device with then highest priority is
placed in the first position, followed by
lower-priority devices up to the device with
the lower priority, which is placed last in the
chain.
• The interrupt request line is common to all
devices and forms a wired logic connection.
Daisy-Chaining Priority
• A device with a 0 in its PI(Priority Input) input
generates a 0 in its P0(Priority Output) output to
inform the next-lower priority device that the
acknowledge signal has been blocked.
• A device that is requesting an interrupt and has
a 1 in its PI input will intercept the acknowledge
signal by placing a 0 in its P0 output.
• If the device does not have pending interrupts, it
transmits the acknowledge signal to the next
device by placing a 1 in its P0 output
• Thus the device with PI=1 and PO=0 is the
one with the highest priority that is
requesting an interrupt, and this device
places its VAD on the data bus.
• The daisy chain arrangement gives the highest
priority to the device that receives the
interrupt acknowledge signal from the CPU.
• The farther the device is from the first
position, the lower is its priority.
Parallel Priority Interrupt
• The parallel priority interrupt method uses a
register whose bits are set separately by the
interrupt signal from each device.
• Priority is established according to the position
of the bits in the register
• In addition to the interrupt register, the circuit
may include a mask register whose purpose is to
control the status of each interrupt request
• The mask register can be programmed to disable
lower-priority interrupts while a higher-priority
device is being served.
• It can also provide a facility that allows a high-
priority device to interrupt the CPU while a low-
priority device is being serviced.
• The magnetic disk, being a high-speed device is
given a highest priority.
• The printer has the next priority, followed by a
character reader and a keyboard.
• The mask register has the same number of bits as
the interrupt register
• By means of program instructions, it is possible to
set or reset any bit in the mask register.
• Each interrupted bit and its corresponding mask
bit are applied to an AND gate to produce the
four inputs to a priority encoder.
• In this way a interrupt is recognized only if its
corresponding mask bit is set to 1 by the
program.
Priority interrupt hardware
High speed of data transfer
Low speed
of data
transfer
Interrupt
Status
• Suppose keyboard and disk interrupts for CPU
now mask bit of both keyboard and disk will
be set to 1
• AND operation is performed with values of
interrupt register and mask register
• Disk= 1.1=1
• Keyboard=1.1=1
• But as Disk has high priority over keyboard so
disk interrupt’s and get the CPU.
The logic of the priority encoder is such that if
two or more inputs arrive at the same time, the
input having the highest priority will take
precedence.
The truth table of a four input priority encoder is
given in previous slide.
The x’s in the table designate don’t care
conditions.
Input I0 has the highest priority; so regardless
of the value of other inputs, when this input is
1, the output generates an output xy=00.
• I1 has the next priority level.
• The output 01 if I1=1 provided that
I0=0,regardless of the values of the other two
low-priority inputs.
• The output for I2 is generated only if highest-
priority inputs are 0, and so on down the
priority level.
• The interrupt status IST is set only when one
or more inputs are equal to 1.
• If all inputs are 0,IST is cleared to 0 and the
other outputs of the encoder are not used so
they are marked with don’t care conditions.
• This is because the vector address is not
transferred to the CPU when IST=0.
• The Boolean function listed in the table
specify the internal logic of the encoder.
Interrupt Cycle
• The interrupt enable flip flop IEN can be set or cleared
by program instructions.
• When IEN is cleared, the interrupt request coming
from IST is neglected by the CPU.
• The program-controlled IEN but allows the
programmer to choose weather to use the interrupt
facility.
• If an instruction to clear IEN has been inserted in the
program, it means that the user does not want his
program to be interrupted.
• An instruction is set IEN indicates that the interrupt
facility will be used while the current program is
running.
• The output of the priority encoder is used to
form part of the vector address for each
interrupt source.
• The other bits of the vector address can be
assigned any value
• For example, the vector address can be
formed by appending six zeros to the x and y
output of the encoder.
• With this choice the interrupt vector for the
four I/O devices are assigned binary numbers
0,1,2 and 3
2018
• What is DMA? Draw and explain DMA controller
in details (12.5 marks)
2019
• Discuss DMA. Discuss controller and DMA
transfer with block diagram?(6.5marks)
2016
Explain DMA transfer in a computer system
2015
Explain DMA control with the help of block
diagram(6 marks)
2014
Explain DMA. Discuss DMA controller using
suitable block diagram(7.5 marks)
DMA
• The transfer of data between a fast storage
device such as magnetic disk and memory is
often limited by the speed of the CPU
• Speed of CPU is fast and speed of I/O devices are
slow.
• Removing the CPU from the path and letting the
peripheral device manage the memory buses
directly would improve the speed of transfer.
• The CPU may be placed in the idle state in a
variety of ways so that CPU can perform other
important task.
• One common method extensively used in
microprocessor is to disable the buses
through special control signals.
• Two control signals in the CPU that facilitate
the DMA transfer.
• The bus request(BR) input is used by the DMA
controller to request the CPU grant the control
of buses.
• When this input is active, the CPU terminates
the execution of the current instruction and
places the address bus, data bus and read and
write lines into a high impedance state.
• CPU activates the bus grant (BG) output to
inform the external DMA that the buses are in
high impedance state.
• The DMA that originate the bus request can
now take control of buses to conduct memory
transfer without processor intervention.
• When the DMA terminates the transfer, it
disables the bus request line.
• The CPU disables the bus grant, takes control
of the buses, and return to its normal
operation.
CPU bus signals for DMA transfer
DMA Controller
• The DMA controller needs the usual circuit of an
interface to communicate with the CPU and I/O
device.
• In addition, it needs an address register, a word
count register and a set of address lines.
• The address register and address lines are used
for direct communication with the memory.
• The word count register specifies the number of
words that must be transferred.
• The data transfer may be done directly between
the device and memory under control of the
DMA.
Block diagram of DMA controller
EXPLANATION
• The register in the DMA are selected by the CPU
through the address bus by enabling the DS and
RS inputs.
• The RD and WR inputs are bidirectional
• When the BG(bus grant) input is 0, the CPU can
communicate with the DMA register through the
data bus to read from or write to the DMA
register
• When BG=1, the CPU has relinquished the buses
and the DMA can communicate directly with the
memory by specifying an address in the address
bus and activating the RD or WR control.
• The DMA controller has three registers: an
address register, a word count register and a
control register.
• The address register contains an address to
specify the desired location in memory.
• The address bits go through bus buffers into
the address bus
• The address register is incremented after each
word that is transferred to memory.
• The word count register holds the number of
words to be transferred.
• This register is decremented by one after each
word transfer and internally tested for zero.
• The control register specifies the mode of
transfer.
• All register in the DMA appear to the CPU as I/O
interface register.
• Thus the CPU can read from or write into the
DMA registers under program control via the data
bus.
• DMA is first initialized by the CPU.
• After that, the DMA starts and continue to
transfer data between memory and peripheral
unit until an entire block is transferred .
• The CPU initializes the DMA by sending the
following information through the data bus:
1. The starting address of the memory block
where data are available or where data are to
be stored(for write).
2. The word count, which is the number of
words in the memory block.
3. Control to specify the mode of transfer such
as read or write.
4. A control to start the DMA transfer.
• The starting address is stored in the address
register.
• The word count is stored in the word count
register.
• Control information in the control register
• Once the DMA is initialized, the CPU stops
communicating with the DMA unless it
receive an interrupt signal or if it wants to
check how many words have been transferred.
DMA transfer in a computer system
Explanation
• The CPU communicate with the DMA through the
address and data buses as with any interface unit.
• The DMA has its own address, which activates
the DS and RS lines.
• The CPU initializes the DMA through the data
bus.
• Ones the DMA receives the start control
command, it can start transfer between the
peripheral devices and the memory.
• When the peripheral device sends a DMA
request, the DMA controller activates the BR
line, informing the CPU to relinquish the buses.
• The CPU responds with its BG line, informing
the DMA that its buses are disabled.
• The DMA then puts the current value of its
address register into the address bus, initiates
the RD or WR signal, and sends a DMA
acknowledge to the peripheral device.
• RD and WR lines in the DMA controller are
bidirectional.
• The direction of transfer depends on the
status of the BG line.
• When BG=0, the RD and WR are input lines
allowing the CPU to communicate with the
internal DMA registers.
• When BG=1, the RD and WR are output lines
from the DMA controller to the random-access
memory to specify the read or write operation
for the data.
• When the peripheral device receives a DMA
acknowledge, it puts a word in the data bus(for
write) or receive a word from the data bus(for
read).
• Thus the DMA controls the read or write
operations and supplies the address for the
memory
• For each word that is transferred, the DMA
increments its address register and
decrements its word count register.
• If the word count register reaches zero, the
DMA stops any further transaction and
removes its bus request.
• It also informs the CPU of the termination by
means of an interrupt.
• When the CPU responds to the interrupt, it
reads the content of the word count register.
• The zero value of this register indicates that
all the words were transferred successfully.
• The CPU can read this register at any time to
check the number of words already
transferred.

More Related Content

Similar to COA(Unit_3.pptx)

Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithm
Gaurav Subham
 
Addition and subtraction with signed magnitude data (mano
Addition and subtraction with signed magnitude data (manoAddition and subtraction with signed magnitude data (mano
Addition and subtraction with signed magnitude data (mano
cs19club
 
Arithmetic Unit Addition Subtraction Multiplication and Division
Arithmetic Unit Addition Subtraction Multiplication and DivisionArithmetic Unit Addition Subtraction Multiplication and Division
Arithmetic Unit Addition Subtraction Multiplication and Division
RNShukla7
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
Shankar Gangaju
 
Arithmetic Microoperation.pdf
Arithmetic Microoperation.pdfArithmetic Microoperation.pdf
Arithmetic Microoperation.pdf
HarshitJ4
 
Ch_10.pptx.pdf
Ch_10.pptx.pdfCh_10.pptx.pdf
Ch_10.pptx.pdf
SujanTimalsina5
 
UNIT-3 Complete PPT.pptx
UNIT-3 Complete PPT.pptxUNIT-3 Complete PPT.pptx
UNIT-3 Complete PPT.pptx
Medicaps University
 
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
ssuser9dbd7e
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
michaelaaron25322
 
6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted
subisugadevan
 
Arithmetic Logic
Arithmetic LogicArithmetic Logic
Arithmetic Logic
janani thirupathi
 
18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx
takix43466
 
IS 151 Lecture 9
IS 151 Lecture 9IS 151 Lecture 9
IS 151 Lecture 9
wajanga
 
COMPUTER ORGANIZATION NOTES Unit 6
COMPUTER ORGANIZATION NOTES Unit 6COMPUTER ORGANIZATION NOTES Unit 6
COMPUTER ORGANIZATION NOTES Unit 6
Dr.MAYA NAYAK
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
Sanjay Saluth
 
Bit shift operators
Bit shift operatorsBit shift operators
Bit shift operators
alldesign
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptx
ssuser2efca7
 
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
MtikuTadesse
 
Arithmetic Operations
Arithmetic OperationsArithmetic Operations
Arithmetic Operations
gueste99d9a
 
Arithmetic Process in Computer Systems
Arithmetic Process in Computer SystemsArithmetic Process in Computer Systems
Arithmetic Process in Computer Systems
S N M P Simamora
 

Similar to COA(Unit_3.pptx) (20)

Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithm
 
Addition and subtraction with signed magnitude data (mano
Addition and subtraction with signed magnitude data (manoAddition and subtraction with signed magnitude data (mano
Addition and subtraction with signed magnitude data (mano
 
Arithmetic Unit Addition Subtraction Multiplication and Division
Arithmetic Unit Addition Subtraction Multiplication and DivisionArithmetic Unit Addition Subtraction Multiplication and Division
Arithmetic Unit Addition Subtraction Multiplication and Division
 
Computer organization and architecture lab manual
Computer organization and architecture lab manual Computer organization and architecture lab manual
Computer organization and architecture lab manual
 
Arithmetic Microoperation.pdf
Arithmetic Microoperation.pdfArithmetic Microoperation.pdf
Arithmetic Microoperation.pdf
 
Ch_10.pptx.pdf
Ch_10.pptx.pdfCh_10.pptx.pdf
Ch_10.pptx.pdf
 
UNIT-3 Complete PPT.pptx
UNIT-3 Complete PPT.pptxUNIT-3 Complete PPT.pptx
UNIT-3 Complete PPT.pptx
 
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
 
Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...Computer organization algorithms like addition and subtraction and multiplica...
Computer organization algorithms like addition and subtraction and multiplica...
 
6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted
 
Arithmetic Logic
Arithmetic LogicArithmetic Logic
Arithmetic Logic
 
18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx18CSC203J_COA_Unit 2 final.pptx
18CSC203J_COA_Unit 2 final.pptx
 
IS 151 Lecture 9
IS 151 Lecture 9IS 151 Lecture 9
IS 151 Lecture 9
 
COMPUTER ORGANIZATION NOTES Unit 6
COMPUTER ORGANIZATION NOTES Unit 6COMPUTER ORGANIZATION NOTES Unit 6
COMPUTER ORGANIZATION NOTES Unit 6
 
Arithmetic circuits
Arithmetic circuitsArithmetic circuits
Arithmetic circuits
 
Bit shift operators
Bit shift operatorsBit shift operators
Bit shift operators
 
module 1_class_numbers.pptx
module 1_class_numbers.pptxmodule 1_class_numbers.pptx
module 1_class_numbers.pptx
 
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
2 Computer Arithmetic_hhbyhbjhhjjjjjb41.pptx
 
Arithmetic Operations
Arithmetic OperationsArithmetic Operations
Arithmetic Operations
 
Arithmetic Process in Computer Systems
Arithmetic Process in Computer SystemsArithmetic Process in Computer Systems
Arithmetic Process in Computer Systems
 

More from Thapar Institute

Digital Electronics Unit_4_new.pptx
Digital Electronics Unit_4_new.pptxDigital Electronics Unit_4_new.pptx
Digital Electronics Unit_4_new.pptx
Thapar Institute
 
Digital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptxDigital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptx
Thapar Institute
 
Digital Electronics Unit_2.pptx
Digital Electronics Unit_2.pptxDigital Electronics Unit_2.pptx
Digital Electronics Unit_2.pptx
Thapar Institute
 
Digital Electronics Unit_1.pptx
Digital Electronics Unit_1.pptxDigital Electronics Unit_1.pptx
Digital Electronics Unit_1.pptx
Thapar Institute
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
Thapar Institute
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
Thapar Institute
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
Thapar Institute
 
Web Technology Part 3
Web Technology Part 3Web Technology Part 3
Web Technology Part 3
Thapar Institute
 
Web Technology Part 2
Web Technology Part 2Web Technology Part 2
Web Technology Part 2
Thapar Institute
 
Web Technology Part 1
Web Technology Part 1Web Technology Part 1
Web Technology Part 1
Thapar Institute
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
Thapar Institute
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
Thapar Institute
 
COA (Unit_4.pptx)
COA (Unit_4.pptx)COA (Unit_4.pptx)
COA (Unit_4.pptx)
Thapar Institute
 
COA (Unit_2.pptx)
COA (Unit_2.pptx)COA (Unit_2.pptx)
COA (Unit_2.pptx)
Thapar Institute
 
COA (Unit_1.pptx)
COA (Unit_1.pptx)COA (Unit_1.pptx)
COA (Unit_1.pptx)
Thapar Institute
 
Software Testing Introduction (Part 4))
 Software Testing Introduction (Part 4)) Software Testing Introduction (Part 4))
Software Testing Introduction (Part 4))
Thapar Institute
 
Software Testing Introduction (Part 3)
 Software Testing Introduction (Part 3) Software Testing Introduction (Part 3)
Software Testing Introduction (Part 3)
Thapar Institute
 
Software Testing Introduction (Part 2)
Software Testing Introduction (Part 2)Software Testing Introduction (Part 2)
Software Testing Introduction (Part 2)
Thapar Institute
 
Software Testing Introduction (Part 1)
Software Testing Introduction (Part 1)Software Testing Introduction (Part 1)
Software Testing Introduction (Part 1)
Thapar Institute
 

More from Thapar Institute (19)

Digital Electronics Unit_4_new.pptx
Digital Electronics Unit_4_new.pptxDigital Electronics Unit_4_new.pptx
Digital Electronics Unit_4_new.pptx
 
Digital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptxDigital Electronics Unit_3.pptx
Digital Electronics Unit_3.pptx
 
Digital Electronics Unit_2.pptx
Digital Electronics Unit_2.pptxDigital Electronics Unit_2.pptx
Digital Electronics Unit_2.pptx
 
Digital Electronics Unit_1.pptx
Digital Electronics Unit_1.pptxDigital Electronics Unit_1.pptx
Digital Electronics Unit_1.pptx
 
C Language Part 1
C Language Part 1C Language Part 1
C Language Part 1
 
Compiler Design Introduction
Compiler Design Introduction Compiler Design Introduction
Compiler Design Introduction
 
Web Technology Part 4
Web Technology Part 4Web Technology Part 4
Web Technology Part 4
 
Web Technology Part 3
Web Technology Part 3Web Technology Part 3
Web Technology Part 3
 
Web Technology Part 2
Web Technology Part 2Web Technology Part 2
Web Technology Part 2
 
Web Technology Part 1
Web Technology Part 1Web Technology Part 1
Web Technology Part 1
 
TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
 
CSS Introduction
CSS Introduction CSS Introduction
CSS Introduction
 
COA (Unit_4.pptx)
COA (Unit_4.pptx)COA (Unit_4.pptx)
COA (Unit_4.pptx)
 
COA (Unit_2.pptx)
COA (Unit_2.pptx)COA (Unit_2.pptx)
COA (Unit_2.pptx)
 
COA (Unit_1.pptx)
COA (Unit_1.pptx)COA (Unit_1.pptx)
COA (Unit_1.pptx)
 
Software Testing Introduction (Part 4))
 Software Testing Introduction (Part 4)) Software Testing Introduction (Part 4))
Software Testing Introduction (Part 4))
 
Software Testing Introduction (Part 3)
 Software Testing Introduction (Part 3) Software Testing Introduction (Part 3)
Software Testing Introduction (Part 3)
 
Software Testing Introduction (Part 2)
Software Testing Introduction (Part 2)Software Testing Introduction (Part 2)
Software Testing Introduction (Part 2)
 
Software Testing Introduction (Part 1)
Software Testing Introduction (Part 1)Software Testing Introduction (Part 1)
Software Testing Introduction (Part 1)
 

Recently uploaded

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 

Recently uploaded (20)

Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 

COA(Unit_3.pptx)

  • 2. Addition and Subtraction with signed magnitude data • When signed numbers are added or subtracted, we find that there are eight different conditions to consider, depending on the sign of the numbers and the operation performed. • These conditions are listed in the first column of table 10-1. • The other columns in the table show the actual operation to be performed with the magnitude of the number
  • 3. If sign is different for add=subtract If sign is different for subtract=add
  • 4. Remember • The two magnitude are subtracted if the signs are different for an add operation or identical for a subtract operation.
  • 5. • The last column is needed to prevent a negative zero. • In other words, when two equal numbers are subtracted, the result should be +0 not -0. • Addition(subtraction) algorithm : when the signs of A and B are identical ,and the two magnitudes and attach the sign of A to the result. • When the sign of A and B are different ,compare the magnitudes and subtract number from the larger. • Choose the sign of the result to be the same as A if A>B or the complement of the sign of A if A<B. • If the two magnitude are equal, subtract B from A and make the sign of the result positive.
  • 6. Hardware Implementation • To implement the two arithmetic operations with hardware, it is first necessary that the two numbers be stored in register. • Let A and B be two registers that hold the magnitude of the numbers, and As and Bs be two flip-flops that hold the corresponding signs. • The result of the operation may be transferred into A and As. • Thus A and As together form an accumulator register.
  • 7.
  • 8. Fig 10-1 shows a block diagram of the hardware for implementing the addition and subtraction operation. It consists of register A and B and sign flip-flop As and Bs Subtraction is done by adding A to the 2’s complement of B The output carry is transferred to flip-flop Where it can be checked to determine the relative magnitude of the two numbers. The add-overflow flip-flop AVF holds the overflow bit when A and B are added. The A register provides other micro operations that may be needed when we specify the sequence of steps in the algorithm.
  • 9. • The addition of A plus B is done through the parallel adder. • The S(sum) output of the adder is applied to the input of the A register. • The complementer provides an output of B or the complement of B depending on the state of the mode control M. • When M=0,the output of B is transferred to the adder, the input carry is 0,and the output of the adder is equal to the sum of A+B. • When M=1,the 1’s complement of B is applied to the adder, the input carry is 1,and the output S=A+B’+1
  • 10. • This is equal to A plus 2’s complement of Which is equivalent to the subtraction A-B.
  • 11. Flow chart • The flow chart for the hardware algorithm is presented in fig 10-2. • The two sings As and Bs are compared by an exclusive-OR gate. • If the output of the gate is 0,the signs are identical ;if it is 1,the signs are different. • For an add operation identical signs dictate that the magnitude be added. • For a subtract operation, different sign dictate that the magnitude be added
  • 12. Sign bit of A and B A=B
  • 13. XOR As(sign bit) Bs(sign bit) output 0 0 0 (add) 0 1 1(subtract) 1 0 1(subtract) 1 1 0 (add)
  • 14. 1. Example for Addition A+B A=12 B=-10 we can write as (+A)+(-B) A>B +(12-10) A+B= (12)+(-10)=2 2 in binary =0010 Sign bit of 12= 1 Sing bit of 10=-1 So subtraction is performed
  • 15. A+(B’+1)=1100+2’s complement of B B=1010 ,2’s complement of B=0110 EA=A+(B’+1)= 1100+0110=10010 E=1 and A=0010 E=1 so A>=B and As=0 Final answer is in A=2 Sign of 2 is positive because As=0
  • 16. 2. Example for Addition A+B A=12 B=10 we can write as (+A)+(+B) A>B +(12+10) A+B= (+12)+(+10)=22 22 in binary =10110 Sign bit of 12= 1 Sing bit of 10=1 1 XOR 1=0 So addition is performed
  • 17. A+B=1100+1010=10110 E=1 and A=0110 AVF=E=1 (overflow) As=0 positive
  • 18. • The magnitude are added with a micro operation E A<- A+B, where E A is a register that combines E and A. • The carry in E after the addition constitute an overflow if it is equal to 1. • The value of E is transferred into the add-overflow flip-flop AVE. • The two magnitude are subtracted if the signs are different for an add operation or identical for a subtract operation. • The magnitude are subtracted by adding A to the 2’s complement of B • No overflow can occur if the numbers are subtracted so AVF is cleared to 0. • A 1 in E indicates that A>=B and the number in A is the correct result. • If this number is zero, the sign As must be made positive to avoid a negative zero.
  • 19. • A 0 in E indicates that A<B. for this case it is necessary to take 2’s complement of the value in A. • This operation can be done with one micro operation A<-A’+1. • However we assume that A register has circuit for micro operations complement and increment, so the 2’s complement is obtained from these two micro operations. • In other paths of the flowchart, the sign of the result is the same as the sign of A, so no change in As is required. • However, when A<B the sign of the result is the complement of the original sign of A.
  • 20. it is necessary to complement As to obtain the correct sign. The final result is found in register A and its sign in As. The value in AVF provides an overflow indication. The final value of E is immaterial.
  • 21. Multiplication Algorithms • Multiplication of two fixed-point binary numbers in signed-magnitude representation is done with paper and pencil by a process of successive shift and add operations. • This process is best illustrative with a numerical example.
  • 23. • The process consists of looking at successive bits of the multiplier, least significant bit first. • If the multiplier bit is 1,the multiplicand is copied down; otherwise ,zeros are copied down. • The number copied down in successive lines are shifted one position to the left from the previous number. • Finally, the numbers are added and their sum forms the product. • The sign of the product is determined from the signs of the multiplicand and multiplier. • If they are alike, the sign of the product is positive. • If they are unlike, the sign of the product is negative
  • 24. EXMAPLE Multiplier : Q=10011=19 Multiplicand : B=10111=23 19*23=437 437 in binary : 0001 1011 0101
  • 25. • 2018 • Draw flow chart of multiplication process(6 marks)
  • 26.
  • 28. • A=10011 =19 • B=10111=23 • A x B=19x23=437 = 110110101
  • 29. Hardware for multiply operation • Initially, the multiplicand is in register B and the multiplier in Q. • The sum of A and B forms a partial product which is transferred to the EA register • Both partial product and multiplier are shifted to the right. • This shift will be denoted by the statement shr EAQ to designate the right shift. • The least significant bit of A is shifted into the most significant position Q, the bit from E is shifted into the most significant position of A, and 0 is shifted into E. • After the shift one bit of the partial product is shifted into Q, pushing the multiplier bits one position to the right. • In this manner, the rightmost flip flop in register Q, designated by Qn, will hold the bit of the multiplier, which must be inspected next.
  • 30.
  • 31. Booth Multiplication Algorithm • Booth algorithm gives a procedure for multiplying binary integers in signed 2’s complement representation in efficient way, i.e., less number of additions/subtractions required.
  • 32.
  • 33. • AC and the appended bit Qn+1 are initially cleared to 0 and the sequence counter SC is set to a number n equal to the number of bits in the multiplier. • The two bits of the multiplier in Qn and Qn+1 are inspected. • If the two bits are equal to 10,it means that the first 1 in a string of 1’s has been encountered. • This requires a subtraction of the multiplicand from the partial product in AC. • If the two bits are equal to 01,it means that the first 0 in a string of 0’s has been encountered.
  • 34. • This requires the addition of the multiplicand to the partial product in AC. • When the two bits are equal, the partial product does not change. • An overflow cannot occur because the addition and subtraction of the multiplicand follow each other. • As a consequence, the two numbers that are added always have opposite signs, a condition that excludes an overflow.
  • 35. • The next step is to shift right the partial product and the multiplier (including bit Qn+1). • this is an arithmetic shift right(ashr) operation which shifts AC and QR to the right and leaves the sign bit in AC unchanged. • The sequence counter is decremented and the computational loop is repeated n times.
  • 36. Note • Subtraction = Qn=-1 • Addition = Qn=1
  • 37. Booth Multiplication Example Multiplier : QR=10011=2’s complement of(10011)= 01101=13 Multiplicand : BR=10111=2’s complement of (10111)=01001=9 -13*-9=117 117 in binary : 00011 10101 The 10 bit product appears in AC and QR and is positive. The final value of Qn+1 is the original sign bit of the multiplier and should not be taken as part of the product.
  • 38.
  • 39.
  • 40. 2015 • Explain function of booths algorithm and multiply (+15)x(-13) using general multiplication algorithm of Booth algorithm.(6.5 marks)
  • 41. Multiplicand : BR=01111 (+15) Multiplier : QR=01101=2’s complement of (01101)=10011= (-13) 15*-13=-195 195 in binary : 11000011 195 in binary (2’s complement): 11001 11101 The 5 bit product appears in AC and QR and is positive. The final value of Qn+1 is the original sign bit of the multiplier and should not be taken as part of the product.
  • 42. Assume 5 bit register 10011 01100 11011
  • 43. 2014 Show step by step multiplication process using Booth algorithm when the following binary numbers are multiplied. Assume 5 bit registers that hold singed numbers: 1. (+5)x(-3)
  • 44. Multiplicand : BR=00101 (+5) Multiplier : QR=00011=2’s complement of (00011)=11101= (-3) +5*-3=-15 15 in binary : 0000 1111 15 in binary (2’s complement): 1111 0001 The 5 bit product appears in AC and QR and is positive. The final value of Qn+1 is the original sign bit of the multiplier and should not be taken as part of the product.
  • 45. Assume 5 bit register 11101 11110 01111
  • 46. 2014 Show step by step multiplication process using Booth algorithm when the following binary numbers are multiplied. Assume 5 bit registers that hold singed numbers: (-5)x(-3)
  • 47. Multiplicand : BR=000101=2’s complement of (000101)=111011(-5) Multiplier : QR=00011=2’s complement of (00011)=11101= (-3) -5*-3=+15 15 in binary : 0000 1111 The 5 bit product appears in AC and QR and is positive. The final value of Qn+1 is the original sign bit of the multiplier and should not be taken as part of the product.
  • 49. 2019 Multiply using Booth algorithm (+19)x(-11)
  • 50. 2016 Using Booths algorithm, illustrate the sequence of steps in a tabular fashion, when 11101 is multiplied with 10111.
  • 51. Multiplicand : BR=11101=2’s complement of(11101)= 00011=3 Multiplier : QR=10111=2’s complement of (10111)=01001=9 -3*-9=27 27 in binary : 11011 The 5 bit product appears in AC and QR and is positive. The final value of Qn+1 is the original sign bit of the multiplier and should not be taken as part of the product.
  • 53. Array Multiplier in Digital Logic • An array multiplier is a digital combinational circuit used for multiplying two binary numbers by employing an array of full adders and half adders. • This array is used for the nearly simultaneous addition of the various product terms involved. • To form the various product terms, an array of AND gates is used before the Adder array.
  • 54. • The multiplicand bits are b1 and b0, the multiplier bits are a1 and a0, and the product is c3c2c1c0 • The first partial product is formed by multiplying a0 by b1,b0. • The multiplication of two bits such as a0 and b0 produces a 1 if both bits are 1;otherwise,it produces a 0. • This is identical to an AND operation and can be implemented with an AND gate. • As shown in diagram first partial product is formed by means of two AND gates.
  • 55. • The second partial product is formed by multiplying a1 by b1b0 and is shifted one position to the left. • The two partial product are added with two half-adder circuit. • Least significant bit of product does not have to go through an adder since it is formed by the output of the first AND gate.
  • 56. 1 , 2 bit adder
  • 57. 2 bit by 2 bit array multiplier
  • 58. Note • For j multiplier bits and k multiplicand bits we need jxk AND gates and (j-1) k bit adders to produce a product of j+k bits • Example : j=2 and k=2 • 2x2=4 AND gates • 2-1=1 2 bit adder • 2+2=4 bits product (c3 c2 c1 c0)
  • 59. • A second example, consider a multiplier circuit that multiplies a binary number of four bits with a number of three bits. • let the multiplicand be represented by b3b2b1b0 and the multiplier by a2a1a0. • Since k=4 and j=3,we need 12 AND gates and two(j-1=3-1=2) 4 bit adders to produce a product of seven bits. • The logic diagram of the multiplier is shown in fig (next slide).
  • 60.
  • 61. 12 AND gates 2 , 4 bit full adder
  • 63. Division Algorithm • The divisor B consists of five bits and the dividend A, of ten bits. • The five most significant bits of the dividend are compared with the divisor. • Since the 5-bit number is smaller than B, we try again by taking the six most significant bits of A and compare this number with B. • The 6th bit number is greater than B, so we place a 1 for the quotient bit in the sixth position above the dividend. • The divisor is then shifted once to the right and subtracted from the dividend.
  • 64. • The difference is called the partial reminder because the division could have stopped here to obtain a quotient of 1 and a remainder equal to partial reminder. • The process is continued by comparing a partial remainder with the divisor. • If the partial remainder is greater than or equal to the divisor, the quotient bit is equal to 1. • the divisor is then shifted right and subtracted from the partial remainder.
  • 65. • If the partial remainder is smaller than the divisor, the quotient bit is 0 and no subtraction is needed. • The divisor is shifted once to the right in any case. • Note that the result gives both a quotient and a remainder.
  • 66. 6
  • 67.
  • 68. Explanation • 163/11=14 as quotient and 9 as remainder
  • 70. Hardware Implementation • Instead of shifting the divisor to the right, the dividend, or partial remainder, is shifted to the left, thus leaving the two numbers in the required relative position. • Subtraction may be achieved by adding A to the 2’s complement of B.
  • 71. • The divisor is stored in the B register and the double-length dividend is stored in register A and Q. • The divided is shifted to the left and the divisor is subtracted by adding it’s 2’s complement value. • The information about the relative magnitude is available in E • If E=1,it signifies that A>=B. • A quotient bit 1 is inserted into Qn and the partial remainder is shifted to the left to repeat the process. • If E=0, it signifies that A<B so the quotient in Qn remains a 0(inserted during the shift).
  • 72. • The value of the B is then added to restore the partial remainder in A to its previous value • The partial remainder is shifted to the left and the process is repeated again unit all five quotient bits are formed. • Note while the partial remainder is shifted left, the quotient bits are shifted also and after five shifts, the quotient is in Q and the final remainder is in A.
  • 73. • Divisor B=10001 • Dividend A = 01110
  • 75.
  • 76. 2019 • What is the need of input output interface(5 marks)
  • 77. Input-Output Interface • Input-output interface provides a method for transferring information between internal storage and external I/O devices • Peripherals connected to a computer need special communication links for interfacing them with the central processing unit. • The purpose of the communication link is to resolve the differences that exist between the central computer and each peripheral.
  • 78. • The major difference are:
  • 79. To resolve these differences, computer systems include special hardware components between CPU and peripherals to supervise and synchronize all input and output transfers. These components are called interface units.
  • 80. I/O Bus and Interface Modules • A typical communication link between the processor and several peripherals is shown in diagram.
  • 81. I/O Bus and Interface Modules • The I/O bus consists of data lines, address lines, and control lines. • Each peripheral device has associated with it an interface unit. • Each interface decodes the address and control received from the I/O bus, interprets them for the peripheral, and provides signals for the peripheral controller. • Each peripheral has its own controller that operates that particular devices.
  • 82. • For example: the printer controller controls the paper montion, the print timing, and the selection of printing characters. • A controller may be physically integrated with the peripheral. • I/O bus from the processor is attached to all peripheral interface. • To communicate with a particular device, the processor places a device address on the address lines. • Each interface attached to the I/O bus contains an address decoder that monitor the address lines.
  • 83. • When the interface detects its own address, it activates the path between the bus lines and the device that it controls. • All peripherals whose address does not correspond to the address in the bus are disabled by their interface. Four types of commands that an interface may receive : 1. Control command 2. Status command 3. Data output command 4. Data input command
  • 84. 1. Control command • A control command is issued to activate the peripheral and to inform it what to do. • For example, a magnetic tape unit may be instructed to backspace the tape by one record, to rewind the tape, or to start the tape moving in the forward direction. • The particular control command issued depends on the peripheral, and each peripheral receives its own distinguished sequence of control commands, depending on its mode of operation.
  • 85. 2. Status command A status command is used to test various status conditions in the interface and the peripheral. For example: the computer may wish to check the status of the peripheral before a transfer is initiated. During the transfer, one or more errors may occur which are detected by the interface. These errors are designed by setting bits in a status register that the processor can read at certain intervals.
  • 86. 3.Data output • A data output command causes the interface to respond by transferring data from the bus into one of its registers. • Consider an example with a tape unit. • The computer starts the tape moving by issuing a control command. • The processor then monitors the status of the tape by means of a status command. • When the tape is in the correct position, the processor issues a data output command. • The interface responds to the address and command and transfers the information from the data lines in the bus to its buffer register. • The interface then communicates with the tape controller and sends the data to be stored on tape.
  • 87. The data input command is the opposite of data output. The interface receives an item of data from the peripheral and places it in its buffer register. The processor checks if data are available by means of a status command and then issue a data input command. The interface places the data on the data lines, where they are accepted by the processor. 4.Data input
  • 88. 2016 • What is the difference between isolated I/O and memory mapped I/O? What are the advantage and disadvantage of each?(2.5 marks)
  • 89. Isolated versus Memory Mapped I/O • As a CPU needs to communicate with the various memory and input-output devices (I/O) as we know data between the processor and these devices flow with the help of the system bus. • There are three ways in which system bus can be allotted to them : 1. Separate set of address, control and data bus to I/O and memory. 2. Have common bus (data and address) for I/O and memory but separate control lines. 3. Have common bus (data, address, and control) for I/O and memory.
  • 90. • In first case it is simple because both have different set of address space and instruction but require more buses.
  • 91. 1. Isolated I/O Then we have Isolated I/O in which we Have common bus(data and address) for I/O and memory but separate read and write control lines for I/O. So when CPU decode instruction then if data is for I/O then it places the address on the address line and set I/O read or write control line on due to which data transfer occurs between CPU and I/O. As the address space of memory and I/O is isolated and the name is so. The address for I/O here is called ports. Here we have different read-write instruction for both I/O and memory
  • 92. Isolated I/O has 2 separate address space for Memory and I/O
  • 93. 2. Memory Mapped I/O • In this case every bus is common due to which the same set of instructions work for memory and I/O. • Hence we manipulate I/O same as memory and both have same address space, due to which addressing capability of memory become less because some part is occupied by the I/O.
  • 94. There is no separate IN,OUT and MOV Instruction used to manipulate the memory can be used for I/O devices. Isolated I/O has 1 address space for Memory and I/O
  • 95.
  • 96.
  • 97. 2019
  • 98. Asynchronous Data Transfer • The transmitter transmits the data byte at any instance of time. • Only 1 byte is send at a time • There is ideal time between 2 data bytes. • Transmitter and receiver operates at different clock frequencies. • Example : Processor can send data any time to I/O and vice versa because clock frequency of both are different .
  • 99. Asynchronous Data Transfer • Asynchronous data transfer between two independent units requires that control signals be transmitted between the communicating units to indicate the time at which data is being transmitted. • One way of achieving this is by means of a strobe pulse supplied by one of the units to indicate to the other unit when the transfer has to occur.
  • 100. • Another method commonly used is to accompany each data item being transferred with a control signal that indicates the presence of data in the bus. • The unit receiving the data item responds with another control signal to acknowledge receipt of the data. • This type of agreement between two independent units is referred to as a handshaking
  • 101. Strobe Control • The strobe may be activated by either the source or the destination unit • Diagram shows a source-initiated transfer. • The data bus carries the binary information from source unit to the destination unit. • The strobe is a single line that informs the destination unit when a valid data word is available in the bus Control signal Only valid data
  • 102. The source unit first places the data on the data bus The information on the data bus and the strobe signal remain in the active state for a sufficient time period to allow the destination unit to receive the data The destination uses falling edge of the strobe pulse to transfer the contents of the data bus into one of its internal registers.
  • 103. Place the data on data bus
  • 104. EXPLANATION Previous slide shows a data transfer initiated by the destination unit. In this case, destination unit activates the strobe pulse, informing the source to provide the data bus. The source unit responds by placing the requested binary information on the data bus. The data must be valid and remain in the bus long enough for the destination unit to accept it.
  • 105. EXPLANATION The falling edge of the strobe pulse can be used again to trigger a destination register The destination unit then disables the strobe. The source removes the data from the bus after a predetermined time interval .
  • 106. Handshaking • The Dis-advantage of the strobe is that the source unit that initiates the transfer has no way of knowing whether the destination unit has actually received the data item that was placed in the bus. • Similarly, a destination unit that initiates the transfer has no way of knowing whether the source unit has actually placed the data on the bus. • The handshake method solves this problem by introducing a second chance control signal that provides a reply to the unit that initiates the transfer
  • 107. Two wire control: One control line is the same direction as the data flow in the bus from the source to the destination. It is used by source unit to inform the destination unit whether there are valid data in the bus. The other control line is in the other direction from the destination to the source. It is used by the destination unit to inform the source whether it can accept data.
  • 109. 1. The source unit initiates the transfer by placing the data on the bus and enabling its data valid signal. 2. The data accepted signal is activated by the destination unit after it accept the data from the bus. 3. The source unit then disables its data valid signal, which invalidates the data on the bus. 4. The destination unit then disables its data accepted and the system goes into its initial state.
  • 110. The source does not send the next data item until after the destination unit shows its readiness to accept new data by disabling its data accepted signal.
  • 111. Destination initiated transfer using handshaking • The destination-initiated transfer using handshaking lines is shown in diagram :
  • 112.
  • 113. • The name of the signal generated by the destination unit has been changed to ready for data to reflect its new meaning. • The source unit in this case does not place data on the bus until after it receives the ready for data signal from the destination unit. • From there on, the handshaking procedure follows the same pattern as in the source- initiated case.
  • 114. 1. The destination unit initiates the transfer by enabling its ready for data signal 2. The source places the data on the bus and enabling its data valid signal 3. The destination unit accept the data from bus and then disables its ready for data signal 4. The source unit then disables its data valid signal and invalidates the data on bus.
  • 115.
  • 116. Mode of Transfer • Data transfer between the central computer and I/O devices may be handled in a variety of modes. • Some mode use the CPU as an intermediate path; others transfer the data directly to and from the memory unit.
  • 117. Mode of Transfer • Data transfer to and from peripherals may be handled in one of the three possible modes: 1. Programmed I/O 2. Interrupt initiated I/O 3. Direct memory access(DMA)
  • 118. 1. Programmed I/O • In the program I/O method, the CPU stays in a program loop until the I/O unit indicates that it is ready for data transfer. • This is time consuming process since it keeps the processor busy needlessly. • When the interface determines that the device is ready for data transfer, it generates an interrupt request to the computer. • Transfer of data under programmed I/O is between CPU and peripheral.
  • 119. Example of Programmed I/O • Example of data transfer from an I/O device through an interface into CPU is shown in fig. • The device transfers bytes of data one at a time as they are available • When a byte of data is available, the device places it in the I/O bus and enables its data valid line. • The interface accepts the byte into its data register and enable the data accepted line. • The interface sets a bit in the status register that we will refer to as an F or flag bit. • The device can now disable the data valid line, but it will not transfer another byte until the data accepted line is disabled by the interface.
  • 120. • A program is written for the computer to check the flag in the status register to determine if a byte has been placed in the data register by the I/O device. • This is done by reading the status register into a CPU register and checking the value of the flag bit. • If the flag is equal to 1,the CPU reads the data from the data register. • The flag bit is then cleared to 0 by enabling the CPU or the interface, depending on how the interface circuits are designed.
  • 121. • Ones the flag is cleared, the interface disables the data accepted line and the device can then transfer the next data byte.
  • 122. Transfer of each byte requires three instruction 1. Read the status register 2. Check the status of the flag bit and branch to step 1 if not set or to step 3 if set 3. Read the data register
  • 123. Flowchart for CPU program to input data
  • 124. 2. Interrupt initiated I/O • An alternative to the CPU constantly monitor the flag is to let the interface inform the computer when it is ready to transfer data. • This mode of transfer uses the interrupt facility • While the CPU is running a program, it does not check the flag. • However when the flag is set, the computer is interrupted from the current program and is informed of the fact that the flag has been set.
  • 125. • The CPU deviates from what it is doing to take care of input or output transfer. • After the transfer is completed, the computer returns to the previous program to continue what it was doing before the interrupt.
  • 126. 2016 • Explain in details Daisy chain priority interrupt scheme(5 marks) 2015 Explain the difference between the daisy chain priority and parallel priority interrupt. Draw the diagram to explain their working?(6.5 marks)
  • 127. • To summarize, when I/O devices are ready for I/O transfer, they generate an interrupt request signal to the computer. • The CPU receives this signal, suspends the current instructions it is executing and then moves forward to service that transfer request. • But what if multiple devices generate interrupts simultaneously. • In that case, we have to have a way to decide which interrupt is to be serviced first. • In other words, we have to set a priority among all the devices for systemic interrupt servicing. Priority Interrupts | (Daisy Chaining)
  • 128. • The concept of defining the priority among devices so as to know which one is to be serviced first in case of simultaneous requests is called priority interrupt system. • This could be done with either software or hardware methods.
  • 129. HARDWARE METHOD –Daisy-Chaining • This method establishes priority consists of a serial connection of all devices that request an interrupt. • The device with then highest priority is placed in the first position, followed by lower-priority devices up to the device with the lower priority, which is placed last in the chain. • The interrupt request line is common to all devices and forms a wired logic connection.
  • 130.
  • 131. Daisy-Chaining Priority • A device with a 0 in its PI(Priority Input) input generates a 0 in its P0(Priority Output) output to inform the next-lower priority device that the acknowledge signal has been blocked. • A device that is requesting an interrupt and has a 1 in its PI input will intercept the acknowledge signal by placing a 0 in its P0 output. • If the device does not have pending interrupts, it transmits the acknowledge signal to the next device by placing a 1 in its P0 output
  • 132. • Thus the device with PI=1 and PO=0 is the one with the highest priority that is requesting an interrupt, and this device places its VAD on the data bus. • The daisy chain arrangement gives the highest priority to the device that receives the interrupt acknowledge signal from the CPU. • The farther the device is from the first position, the lower is its priority.
  • 133. Parallel Priority Interrupt • The parallel priority interrupt method uses a register whose bits are set separately by the interrupt signal from each device. • Priority is established according to the position of the bits in the register • In addition to the interrupt register, the circuit may include a mask register whose purpose is to control the status of each interrupt request • The mask register can be programmed to disable lower-priority interrupts while a higher-priority device is being served. • It can also provide a facility that allows a high- priority device to interrupt the CPU while a low- priority device is being serviced.
  • 134. • The magnetic disk, being a high-speed device is given a highest priority. • The printer has the next priority, followed by a character reader and a keyboard. • The mask register has the same number of bits as the interrupt register • By means of program instructions, it is possible to set or reset any bit in the mask register. • Each interrupted bit and its corresponding mask bit are applied to an AND gate to produce the four inputs to a priority encoder. • In this way a interrupt is recognized only if its corresponding mask bit is set to 1 by the program.
  • 135. Priority interrupt hardware High speed of data transfer Low speed of data transfer Interrupt Status
  • 136. • Suppose keyboard and disk interrupts for CPU now mask bit of both keyboard and disk will be set to 1 • AND operation is performed with values of interrupt register and mask register • Disk= 1.1=1 • Keyboard=1.1=1 • But as Disk has high priority over keyboard so disk interrupt’s and get the CPU.
  • 137.
  • 138. The logic of the priority encoder is such that if two or more inputs arrive at the same time, the input having the highest priority will take precedence. The truth table of a four input priority encoder is given in previous slide. The x’s in the table designate don’t care conditions. Input I0 has the highest priority; so regardless of the value of other inputs, when this input is 1, the output generates an output xy=00.
  • 139. • I1 has the next priority level. • The output 01 if I1=1 provided that I0=0,regardless of the values of the other two low-priority inputs. • The output for I2 is generated only if highest- priority inputs are 0, and so on down the priority level. • The interrupt status IST is set only when one or more inputs are equal to 1. • If all inputs are 0,IST is cleared to 0 and the other outputs of the encoder are not used so they are marked with don’t care conditions.
  • 140. • This is because the vector address is not transferred to the CPU when IST=0. • The Boolean function listed in the table specify the internal logic of the encoder.
  • 141. Interrupt Cycle • The interrupt enable flip flop IEN can be set or cleared by program instructions. • When IEN is cleared, the interrupt request coming from IST is neglected by the CPU. • The program-controlled IEN but allows the programmer to choose weather to use the interrupt facility. • If an instruction to clear IEN has been inserted in the program, it means that the user does not want his program to be interrupted. • An instruction is set IEN indicates that the interrupt facility will be used while the current program is running.
  • 142. • The output of the priority encoder is used to form part of the vector address for each interrupt source. • The other bits of the vector address can be assigned any value • For example, the vector address can be formed by appending six zeros to the x and y output of the encoder. • With this choice the interrupt vector for the four I/O devices are assigned binary numbers 0,1,2 and 3
  • 143. 2018 • What is DMA? Draw and explain DMA controller in details (12.5 marks) 2019 • Discuss DMA. Discuss controller and DMA transfer with block diagram?(6.5marks) 2016 Explain DMA transfer in a computer system 2015 Explain DMA control with the help of block diagram(6 marks) 2014 Explain DMA. Discuss DMA controller using suitable block diagram(7.5 marks)
  • 144. DMA • The transfer of data between a fast storage device such as magnetic disk and memory is often limited by the speed of the CPU • Speed of CPU is fast and speed of I/O devices are slow. • Removing the CPU from the path and letting the peripheral device manage the memory buses directly would improve the speed of transfer. • The CPU may be placed in the idle state in a variety of ways so that CPU can perform other important task.
  • 145. • One common method extensively used in microprocessor is to disable the buses through special control signals. • Two control signals in the CPU that facilitate the DMA transfer. • The bus request(BR) input is used by the DMA controller to request the CPU grant the control of buses. • When this input is active, the CPU terminates the execution of the current instruction and places the address bus, data bus and read and write lines into a high impedance state.
  • 146. • CPU activates the bus grant (BG) output to inform the external DMA that the buses are in high impedance state. • The DMA that originate the bus request can now take control of buses to conduct memory transfer without processor intervention. • When the DMA terminates the transfer, it disables the bus request line. • The CPU disables the bus grant, takes control of the buses, and return to its normal operation.
  • 147. CPU bus signals for DMA transfer
  • 148. DMA Controller • The DMA controller needs the usual circuit of an interface to communicate with the CPU and I/O device. • In addition, it needs an address register, a word count register and a set of address lines. • The address register and address lines are used for direct communication with the memory. • The word count register specifies the number of words that must be transferred. • The data transfer may be done directly between the device and memory under control of the DMA.
  • 149. Block diagram of DMA controller
  • 150. EXPLANATION • The register in the DMA are selected by the CPU through the address bus by enabling the DS and RS inputs. • The RD and WR inputs are bidirectional • When the BG(bus grant) input is 0, the CPU can communicate with the DMA register through the data bus to read from or write to the DMA register • When BG=1, the CPU has relinquished the buses and the DMA can communicate directly with the memory by specifying an address in the address bus and activating the RD or WR control.
  • 151. • The DMA controller has three registers: an address register, a word count register and a control register. • The address register contains an address to specify the desired location in memory. • The address bits go through bus buffers into the address bus • The address register is incremented after each word that is transferred to memory. • The word count register holds the number of words to be transferred.
  • 152. • This register is decremented by one after each word transfer and internally tested for zero. • The control register specifies the mode of transfer. • All register in the DMA appear to the CPU as I/O interface register. • Thus the CPU can read from or write into the DMA registers under program control via the data bus. • DMA is first initialized by the CPU. • After that, the DMA starts and continue to transfer data between memory and peripheral unit until an entire block is transferred .
  • 153. • The CPU initializes the DMA by sending the following information through the data bus: 1. The starting address of the memory block where data are available or where data are to be stored(for write). 2. The word count, which is the number of words in the memory block. 3. Control to specify the mode of transfer such as read or write. 4. A control to start the DMA transfer.
  • 154. • The starting address is stored in the address register. • The word count is stored in the word count register. • Control information in the control register • Once the DMA is initialized, the CPU stops communicating with the DMA unless it receive an interrupt signal or if it wants to check how many words have been transferred.
  • 155. DMA transfer in a computer system
  • 156. Explanation • The CPU communicate with the DMA through the address and data buses as with any interface unit. • The DMA has its own address, which activates the DS and RS lines. • The CPU initializes the DMA through the data bus. • Ones the DMA receives the start control command, it can start transfer between the peripheral devices and the memory. • When the peripheral device sends a DMA request, the DMA controller activates the BR line, informing the CPU to relinquish the buses.
  • 157. • The CPU responds with its BG line, informing the DMA that its buses are disabled. • The DMA then puts the current value of its address register into the address bus, initiates the RD or WR signal, and sends a DMA acknowledge to the peripheral device. • RD and WR lines in the DMA controller are bidirectional. • The direction of transfer depends on the status of the BG line.
  • 158. • When BG=0, the RD and WR are input lines allowing the CPU to communicate with the internal DMA registers. • When BG=1, the RD and WR are output lines from the DMA controller to the random-access memory to specify the read or write operation for the data. • When the peripheral device receives a DMA acknowledge, it puts a word in the data bus(for write) or receive a word from the data bus(for read). • Thus the DMA controls the read or write operations and supplies the address for the memory
  • 159. • For each word that is transferred, the DMA increments its address register and decrements its word count register. • If the word count register reaches zero, the DMA stops any further transaction and removes its bus request. • It also informs the CPU of the termination by means of an interrupt. • When the CPU responds to the interrupt, it reads the content of the word count register.
  • 160. • The zero value of this register indicates that all the words were transferred successfully. • The CPU can read this register at any time to check the number of words already transferred.