Dpco Unit 3-Module
Dpco Unit 3-Module
3.0 INTRODUCTION
This unit covers fundamental aspects of computer architecture, including the basic functional units and
bus structures, the instruction execution cycle, performance metrics, algorithms for fixed-point and
floating-point arithmetic operations, addressing modes, instruction formats, and basic machine
instructions.
Input Unit
Output Unit
Storage Unit
Arithmetic Logic Unit (ALU)
Control Unit
Input device
Input units are used by the computer to read the data. The most commonly used input devices are
keyboards, mouse, joysticks, trackballs, microphones, etc.
However, the most well-known input device is a keyboard. Whenever a key is pressed, the
corresponding letter or digit is automatically translated into its corresponding binary code and
transmitted over a cable to either the memory or the processor.
Input unit connects the external environment with internal computer system. It provides data and
instructions to the computer system. Commonly used input devices are keyboard, mouse, magnetic
tape etc.
Input unit performs following tasks:
Accept the data and instructions from the outside environment.
Convert it into machine language.
Supply the converted data to computer system.
Central processing unit is an electronic circuitry within a computer that carries out the instructions
given by a computer program by performing the basic arithmetic, logical, control and input/output
(I/O) operations specified by the instructions.
Memory unit
The Memory unit can be referred to as the storage area in which programs are kept which are
running, and that contains data needed by the running programs.
The Memory unit can be categorized in two ways namely, primary memory and secondary memory.
It enables a processor to access running execution applications and services that are temporarily
stored in a specific memory location.
Primary storage is the fastest memory that operates at electronic speeds. Primary memory contains
a large number of semiconductor storage cells, capable of storing a bit of information. The word
length of a computer is between 16-64 bits.
It is also known as the volatile form of memory, means when the computer is shut down, anything
contained in RAM is lost.
Cache memory is also a kind of memory which is used to fetch the data very soon. They are highly
coupled with the processor.
The most common examples of primary memory are RAM and ROM.
Secondary memory is used when a large amount of data and programs have to be stored for a long-
term basis.
It is also known as the Non-volatile memory form of memory, means the data is stored permanently
irrespective of shut down.
The most common examples of secondary memory are magnetic disks, magnetic tapes, and optical
disks.
Arithmetic & logical unit
Most of all the arithmetic and logical operations of a computer are executed in the ALU (Arithmetic
and Logical Unit) of the processor. It performs arithmetic operations like addition, subtraction,
multiplication, division and also the logical operations like AND, OR, NOT operations.
Control unit
The control unit is a component of a computer's central processing unit that coordinates the
operation of the processor. It tells the computer's memory, arithmetic/logic unit and input and output
devices how to respond to a program's instructions.
The control unit is also known as the nerve center of a computer system.
Let's us consider an example of addition of two operands by the instruction given as Add LOCA,
RO. This instruction adds the memory location LOCA to the operand in the register RO and places
the sum in the register RO. This instruction internally performs several steps.
Output Unit
The primary function of the output unit is to send the processed results to the user. Output devices
display information in a way that the user can understand.
Output devices are pieces of equipment that are used to generate information or any other response
processed by the computer. These devices display information that has been held or generated
within a computer.
The most common example of an output device is a monitor.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
signals indicate the validity of data and address information. Command signals specify operations to be
performed. Typical control lines include:
Memory write: causes data on the bus to be written into the addressed location.
Memory read: causes data from the addressed location to be placed on the bus.
I/O write: causes data on the bus to be output to the addressed I/O port.
I/O read: causes data from the addressed I/O port to be placed on the bus.
Transfer ACK: indicates that data have been accepted from or placed on the bus.
Bus request: indicates that a module needs to gain control of the bus.
Bus grant: indicates that a requesting module has been granted control of the bus.
Interrupt request: indicates that an interrupt is pending.
Interrupt ACK: acknowledges that the pending interrupt has been recognized.
Clock: is used to synchronize operations.
Reset: initializes all modules.
Bus Structures
A bus is a group of lines that serves as a connecting path for several devices.
A bus may be lines or wires.
The lines carry data or address or control signal.
There are 2 types of bus structures:1) Single bus structure and 2) Multiple bus structure.
1) Single bus structure (Figure 3.3)
Bus can be used for only one transfer at a time; only 2 units can actively use the bus at any given
time.
Bus control lines are used to arbitrate multiple requests or use of the bus.
3.4 INSTRUCTIONS
The primary function of a computer system is to execute a program, sequence of instructions. These
instructions are stored in computer memory.
These instructions are executed to process data which are already loaded in the computer memory
through some input devices.
After processing the data, the result is either stored in the memory for further reference, or it is sent
to the outside world through some output port.
The computer works based on some given instruction. Let us consider an example:
Add LOCA, R0
This instruction adds the operands at memory location LOCA to the operand in the register R0 and places
the sum into the register [Link] seems that this instruction is done in one step, but actually it internally
performs several steps
First, the instruction is fetched from the memory into the processor. Next, the operand at LOCA is fetched
and added to the contents of [Link] above instruction can be written also as-
Load LOCA, R1
Add R1, R0
Machine language is a binary representation used for communication within a computer system.
Instructions used in machine language are called machine code.
Hexadecimal number
Computer can use binary numbers to read and write data. In binary number format for small value
also it requires large amount of bits.
So can use higher base that can be easily converted into binary.
All computer data sizes are multiples of 4, in that hexadecimal numbers are popular.
Base value of hexadecimal number is 16 and it is the power of 2.
So can convert by replacing each group of four binary digits by a single hexadecimal digit and vice
versa.
To avoid confusion between various numbers, can use subscript values for example Decimal
numbers with ten, Binary numbers with two, and Hexadecimal numbers with hex (Table 3.1). (If
there is no subscript, the default is base 10.)
MIPS Fields
1. R- Format
op Rs Rt rd Shamt funct
6 bit 5 bits 5 bits 5 bits 5 bits 6 bits
• op: Basic operation of the instruction, traditionally called the opcode.
• rs: The first register source operand.
• rt: The second register source operand.
• rd: The register destination operand. It gets the result of the operation.
• shamt: Shift amount.
• funct: Function. This field, often called the function code, selects the specific variant of the
operation in the op field.
2. I- Format
Op Rs Rt Constant address
6 bits 5 bits 5 bits 16 bits
Used by the immediate and data transfer instructions.
instructions for a CPU or a subset of instructions to enhance its performance in certain situations.
The instruction set provides commands to the processor, to tell it what it needs to do. The instruction set
consists of addressing modes, instructions, native data types, registers, memory, interrupt and exception
handling, and external I/O.
Examples of instruction set are
ADD- Add two numbers together.
COMPARE- Compare numbers.
IN- Input information from a device, e.g., keyboard.
JUMP- Jump to designated RAM address.
JUMP IF- Conditional statement that jumps to a designated RAM address.
LOAD- Load information from RAM to the CPU.
OUT- Output information to device, e.g., monitor.
STORE- Store information to RAM
CPU Organization
i) Single Accumulator
Result usually goes to the Accumulator
Accumulator has to be saved to memory quite often
ii) General Register
Registers hold operands thus reduce memory traffic
Register bookkeeping
iii) Stack
Operands and result are always in the stack
Basic Instruction Types
There are five types of instruction formats in a computer that are commonly used, namely:
1. Three-address instruction format.
2. Two-address instruction format.
3. one-address instruction format.
4. Zero-address instruction format.
5. One-and-half address instruction format.
Number of operands
Instruction sets may be categorized by the maximum number of operands explicitly specified in
instructions.
0- operand (zero-address machines), so called stack machines: All arithmetic operations take place using
the top one or two positions on the stack: push a, push b, add, pop c
1- operand (one-address machines), so called accumulator machines, include early computers and many
small microcontrollers: most instructions specify a single right operand (that is, constant, a register, or a
memory location), with the implicit accumulator as the left operand (and the destination if there is one):
load a, add b, store c.
2- operand- many CISC and RISC machines fall under this category:
CISC - move A to C; then add B to C.
RISC - Requiring explicit memory loads, the instructions would be: load a, reg1; load b, reg2; add reg1,
reg2; store reg2, c.
3- operand- It allows better reuse of data:
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Store R4, C
Add is a three-operand, or a three-address, instruction of the form
Add destination, source1, source2
The Store instruction is of the form
Store source, destination
where the source is a processor register and the destination is a memory location. Observe that in the Store
instruction the source and destination are specified in the reverse order from the Load instruction; this is a
commonly used convention.
The desired addition by using only two registers, R2 and R3, if one of the source registers is also used as
the destination for the result. In this case the addition would be performed as
Add R3, R2, R3 and the last instruction would become
Store R3, C
Advantages
Speed- RISC processors often achieve 2 to 4 times the performance of CISC processors using comparable
semiconductor technology and the same clock rates.
Simpler hardware- Because the instruction set of a RISC processor is so simple. It uses up much less chip
space and simple hardware requirements.
Shorter design cycle- Since RISC processors are simpler than corresponding CISC processors, they can
be designed more quickly, and can complete their work in 1 clock cycle
Step 1: The address in the program counter is moved to the memory address register (MAR), as this is the
only register which is connected to address lines of the system bus.
Step 2: The address in MAR is placed on the address bus, now the control unit issues a READ command
on the control bus, and the result appears on the data bus and is then copied into the memory buffer register
(MBR). Program counter is incremented by one, to get ready for the next instruction. (These two actions
Thus, a simple Fetch Cycle consists of three steps and four micro-operations. Symbolically, write this
sequence of events as follows:
t1:MARPC
t2:MBRMEMORY
PC (PC) + 1
t3: IR (MBR)
Here’I’’ is the instruction length. The notation (t1, t2, t3) represents successive time units. Assume that a
clock is available for timing purposes and it emits regularly spaced clock pulses. Each clock pulse defines
a time unit. Thus, all time units are of equal duration. Each micro- operation can be performed within the
time of a single time unit.
First time unit: Move the contents of the PC to MAR.
Second time unit: Move contents of memory location specified by MAR to MBR. Increment
content of PC by I.
Third time unit: Move contents of MBR to IR.
Note: Second and third micro-operations both take place during the second time unit.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
2. Indirect Cycles
Once an instruction is fetched, the next step is to fetch source operands. Source Operand is being fetched
by indirect addressing (it can be fetched by any addressing mode, here it’s done by indirect addressing).
Register-based operands need not be fetched. Once the opcode is executed, a similar process may be needed
to store the result in the main memory. Following micro-operations takes place:-
t1:MARIR (ADDRESS)
t2:MBRMEMORY
t3:IR (ADDRESS)(MBR(ADDRESS))
Step 1: The address field of the instruction is transferred to the MAR. This is used to fetch the address of
the operand.
Step 2: The address field of the IR is updated from the MBR.(So that it now contains a direct addressing
rather than indirect addressing)
Step 3: The IR is now in the state, as if indirect addressing has not been occurred.
Note: Now IR is ready for the execute cycle, but it skips that cycle for a moment to consider the Interrupt
Cycle.
3. Execute Cycle
The other three cycles (Fetch, Indirect and Interrupt) are simple and predictable. Each of them requires
simple, small and fixed sequence of micro-operation. In each case same micro-operation are repeated each
time around.
Execute Cycle is different from them. Like, for a machine with N different opcodes there are N different
sequence of micro-operations that can occur.
Let’s take a hypothetical example:-
Consider an add instruction:
ADD R, X
Here, this instruction adds the content of location X to register R. Corresponding micro-operation will be:
t1:MARIR (ADDRESS)
t2:MBR MEMORY
t3: R (R) + (MBR)
Begin with the IR containing the ADD instruction.
Step 1: The address portion of IR is loaded into the MAR.
Step 2: The address field of the IR is updated from the MBR, so the reference memory location is read.
Step 3: Now, the contents of R and MBR are added by the ALU.
Let’s take a complex example:-
ISZ X
Here, the content of location X is incremented by 1. If the result is 0, the next instruction will be skipped.
Corresponding sequence of micro-operation will be:
t1:MARIR (ADDRESS)
t2:MBR MEMORY
t3: MBR (MBR) + 1
t4:MEMORY (MBR) If
(MBR) = 0) then (PC 9PC) + 1)
Here, the PC is incremented if (MBR) = 0. This test (is MBR equal to zero or not) and action (PC is
incremented by 1) can be implemented as one micro-operation.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Note: This test and action micro-operation can be performed during the same time unit during which the
updated value MBR is stored back to memory.
4. The Interrupt Cycle
At the completion of the Execute Cycle, a test is made to determine whether any enabled interrupt has
occurred or not. If an enabled interrupt has occurred then Interrupt Cycle occurs. The nature of this cycle
varies greatly from one machine to another.
Let’s take a sequence of micro-operation:
t1:MAR (PC)
t2:MBR SAVE_ADDRESS
PCROUTINE_ADDRESS
t3:MEMORY (MBR)
Step 1: Contents of the PC is transferred to the MBR, so that they can be saved for return.
Step 2: MAR is loaded with the address at which the contents of the PC are to be saved. PC is loaded with
the address of the start of the interrupt-processing routine.
Step 3: MBR, containing the old value of PC, is stored in memory.
Note: In step 2, two actions are implemented as one micro-operation. However, most processor provide
multiple types of interrupts, it may take one or more micro-operation to obtain the save_address and the
routine_address before they are transferred to the MAR and PC respectively.
3.6 PERFORMANCE
Performance means the measure of accuracy, efficiency and speed of executing program instructions
by computer.
For best performance, it is necessary to design the compiler, the machine instruction set, and the
hardware in a coordinated way.
Processor circuits are controlled by a timing signal called clock. The processor divides the action to be
performed in basic steps, such that each step can be completed in one clock cycle.
Basic Performance Equation is given by:- T=((NXS)/R) , Where N= actual no. of instruction
executions , S= avg no. of basic step needed to execute one machine instruction , R- clock rate
(cycles/sec)
In order to achieve high performance, the T value should reduce which can be done by reducing N and
S, or by increasing R.
A Substantial improvement can also be done by overlapping the execution of successive instructions.
This concept is known as pipelining.
Sign Magnitude
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Here, MSB represents sign of the number. If MSB is 1, the number is negative and if MSB is 0,
number is positive.
Remaining bits represent magnitude of the number.
Example:
+6 = 0 0 0 0 0 1 1 0
-14 = 1 0 0 0 1 1 0 0
b) One’s complement representation
The 1’s complement of a binary number is the number that results when we change all one’s to
zeros and the zeros to one’s (NOT operation).
Example: Find 1’s complement of (11010100)2
11010100
Example: Assume number is using 32-bit format which reserve 1 bit for the sign, 15 bits for the
integer part and 16 bits for the fractional part.
Then, -43.625 is represented as following:
Where, 0 is used to represent + and 1 is used to represent. 000000000101011 is 15 bit binary value for
decimal 43 and 1010000000000000 is 16 bit binary value for fractional 0.625.
The advantage of using a fixed-point representation is performance and disadvantage is relatively limited
range of values that they can represent. So, it is usually inadequate for numerical analysis as it does not
allow enough numbers and accuracy. A number whose representation exceeds 32 bits would have to be
stored inexactly.
These are above smallest positive number and largest positive number which can be store in 32-bit
representation as given above format. Therefore, the smallest positive number is 2-16 ≈ 0.000015
approximate and the largest positive number is (215-1)+(1-2-16)=215(1-2-16) =32768, and gap between these
numbers is 2-16. We can move the radix point either left or right with the help of only integer field is 1.
3.7.3 FLOATING POINT REPRESENTATION
A designer of a floating-point representation must find a compromise between the size of the
fraction and the size of the exponent, because a fixed word size means we must take a bit from
one to add a bit to the other.
Fraction is the value, generally between 0 and1, placed in the fraction field. The fraction is also
called the mantissa.
Exponent is the numerical representation system of floating-point arithmetic, the value that is
placed in the exponent field.
Increasing the size of the fraction enhances the precision of the fraction, while increasing the size
of the exponent increases the range of numbers that can be represented.
Floating point numbers are usually a multiple of the size of a word.
Floating representation has three fields
i) Sign ii) Significant digits iii) Exponent
Example:
1 1 1 1 0 1. 1 0 0 0 1 1 0 1. 1 1 1 0 1 1 0 0 1 1 0 × 25
Normalized form
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
32 Bits
31 30 23 22 0
S Eʹ M
Double Precision
64 Bits
63 62 52 51 0
S Eʹ M
Double Precision
Bias for double precision format is 1023
Eʹ = E + 1023
= 10 + 1023
= (1033)10
= (1 0 0 0 0 0 0 1 0 0 1)2
Double precision is
0 10000001001 0 0 1 1 1 0 1 0 1 1 0 0 1……0
The carries are shown in parentheses, with the arrows showing how they are passed.
Binary addition, showing carries from right to left:
The rightmost bit adds 1 to 0, resulting in the sum of this bit being 1 and the carry out from this bit being
0. Hence, the operation for the second digit to the right is 0 + 1+ 1. This generates a 0 for this sum bit and
a carry out of 1. The third digit is the sum of 1 + 1 + 1, resulting in a carry out of 1 and a sum bit of 1. The
fourth bit is 1 +0 + 0, yielding a 1 sum and no carry.
When adding operands with different signs, overflow cannot occur. The reason is the sum must be no larger
than one of the operands. For example, -10+ 4=-6. Since the operands fit in 32 bits and the sum is no larger
than an operand, the sum must fit in 32 bits as well. Therefore, no overflow can occur when adding positive
and negative operands.
During subtract, but it’s just the opposite principle: when the signs of the operands are the same, overflow
cannot occur. To see this, remember that c - a = c+ (-a) because we subtract by negating the second operand
and then add. Therefore, when we subtract operands of the same sign we end up by adding operands of
different signs.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Adding or subtracting two 32-bit numbers can yield a result that needs 33 bits to be fully expressed.
The lack of a 33rd bit means that when overflow occurs, the sign bit is set with the value of the result
instead of the proper sign of the result. Since we need just one extra bit, only the sign bit can be wrong.
Hence, overflow occurs when adding two positive numbers and the sum is negative, or vice versa. This
false sum means a carry out occurred into the sign bit.
Overflow occurs in subtraction when we subtract a negative number from a positive number and get a
negative result, or when we subtract a positive number from a negative number and get a positive result.
Such a ridiculous result means a borrow occurred from the sign bit. Figure shows the combination of
operations, operands, and results that indicate an overflow.
Table 3.3 Overflow conditions for addition and subtraction
Unsigned integers are commonly used for memory addresses where overflows are ignored. The computer
designer must therefore provide a way to ignore overflow in some cases and to recognize it in others. The
MIPS solution is to have two kinds of arithmetic instructions to recognize the two choices:
Add (add), add immediate (addi), and subtract (sub) cause exceptions on overflow.
Add unsigned (addu), add immediate unsigned (addiu), and subtract unsigned (subu) do not cause
exceptions on overflow.
The computer designer must decide how to handle arithmetic overflows. Although some languages like C
and Java ignore integer overflow, languages like Ada and FORTRAN require that the program be notified.
The programmer or the programming environment must then decide what to do when overflow occurs.
MIPS detects overflow with an exception, also called an interrupt on many computers. An exception or
interrupt is essentially an unscheduled procedure call. The address of the instruction that overflowed is
saved in a register, and the computer jumps to a predefined address to invoke the appropriate routine for
that exception. The interrupted address is saved so that in some situations the program can continue after
corrective code is executed.
MIPS include a register called the exception program counter (EPC) to contain the address of the
instruction that caused the exception. The instruction move from system control (mfc0) is used to copy EPC
into a general-purpose register so that MIPS software has the option of returning to the offending
instruction via a jump register instruction.
In 4-bit full adder the input is from the right side (Figure 3.10)because the first cell traditionally
represents the least significant bit (LSB)
available in 2n gate delays, including the delay through the XOR gates on the Y input. Using the
implementation Cn ⊕ Cn−1 for overflow, this indicator is available after 2n + 2 gate delays. Two approaches
can be taken to reduce delay in adders. The first approach is to use the fastest possible electronic
technology. The second approach is to use a logic gate network called a carry-lookahead network.
Here the addition LSB = 1 + 1 produces a carry into the next bit. When the carry is added to the second bit
position, then only the addition takes place. Similarly to the third and fourth-bit position. This leads to
delay the next process; this delay time is known as carry propagation delay time.
To eliminate these delay time, one method of speeding up this process by eliminating inter stage carry
delay is called carry look ahead adder or fast adder. The carry look ahead adder is based on the principle
of looking at the lower order bits of the augend and addend to see if a higher order carry is to be generated.
It uses two functions
(i) Carry generate, Gi
(ii) Carry propagate, Pi
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
In this two binary variables carry propagate and a carry generate are defined as
Pi = Ai ⊕ Bi Carry propagate
Gi = Ai Bi Carry generate
The output sum and carry can respectively be expressed as
Si = Pi ⊕ Ci
Ci+1 = Gi + Pi Ci
Carry generate Gi produces a carry of 1 when both Ai and Bi are regardless of the input carry Ci. The
Boolean functions of the carry outputs of each stage can now be written as
C0 = input carry
C1 = G0 + P0 C0
C2 = G1 + P1 C1 = G1 + P1 G0 + P1 P0 G0
C3 = G2 + P2 C2 = G2 + P2 G1 + P2 P1 G0 + P2 P1 P0 C0
The three Boolean functions C1, C2 and C3 are implemented in the carry look generator shown in the
following figure 3.16.
In this, this circuit can add in less time because C3 does not have to wait for C2 and C1 to propagate and
also C3 is propagated at the same time as C1 and C2. This will gain in speed of operation is achieved at the
expense of additional complexity.
The construction of carry look ahead adder using carry look ahead generator is shown in figure 3.17.
Each sum output requires two exclusive OR gates. The output of the first exclusive OR gates generates Pi
and AND gate generates Gi. The carries are propagated through the carry look ahead generator and applied
to the second exclusive OR gate. All output carries are generated after a delay through two levels of gates.
Thus outputs S1 through S3 have equal propagation delay.
3.8.4 MULTIPLICATION
The multiplication is a complex operation than addition and subtraction.
Multiplying 1000ten by 1001ten:
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
The first operand is called the multiplicand and the second the multiplier. The final result is called the
product. Take the digits of the multiplier one at a time from right to left, multiplying the multiplicand by
the single digit of the multiplier, and shifting the intermediate product one digit to the left of the earlier
intermediate products.
The first observation is that the number of digits in the product is considerably larger than the number in
either the multiplicand or the multiplier. In fact, if we ignore the sign bits, the length of the multiplication
of an n-bit multiplicand and an m-bit multiplier is a product that is n + m bits long. That is, n + m bits are
required to represent all possible products. Hence, like add, multiply must cope with overflow because we
frequently want a 32-bit product as the result of multiplying two 32-bit numbers.
With only two choices, each step of the multiplication is simple:
Just place a copy of the multiplicand (1 X multiplicand) in the proper place if the multiplier digit is
a 1, or
Place 0 (0 X multiplicand) in the proper place if the digit is 0.
The Multiplicand register, ALU, and Product register are all 64 bits wide, with only the Multiplier register
containing 32 bits. The 32-bit multiplicand starts in the right half of the Multiplicand register and is shifted
left 1 bit on each step. The multiplier is shifted in the opposite direction at each step. The algorithm starts
with the product initialized to 0. Control decides when to shift the Multiplicand and Multiplier registers
and when to write new values into the Product register (Figure 3.18).
Sequential Version of the Multiplication Algorithm and Hardware
Let’s assume that the multiplier is in the 32-bit Multiplier register and that the 64-bit Product register is
initialized to 0. We will need to move the multiplicand left one digit each step, as it may be added to the
intermediate products. Over 32 steps, a 32-bit multiplicand would move 32 bits to the left. Hence, we need
a 64-bit Multiplicand register, initialized with the 32-bit multiplicand in the right half and zero in the left
half. This register is then shifted left 1 bit each step to align the multiplicand with the sum being
accumulated in the 64-bit Product register.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
The Multiplicand register, ALU, and Multiplier register are all 32 bits wide, with only the Product register
left at 64 bits. Now the product is shifted right. The separate Multiplier register also disappeared. The
multiplier is placed instead in the right half of the Product register (Figure 3.20).
The n partial products can then be added using a CSA tree (Figure 3.22).
Example: 1 0 1 1 × 1 1 0 1
1011
× 1101
1011 A
00000 B
101100 C
1011000 D
1001111 Resultant
0 1 0 1 1 S1
0 0 0 0 0 C1
Step 2: Add C and D (C+ D)
1 0 1 1 0 0 C
(+) 1 0 1 1 0 0 0 D
1 1 1 0 1 0 0 S2
0 0 1 0 0 0 0 C2
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
0 1 0 1 1 S1
0 0 0 0 0 C1
(+) 1 1 1 0 1 0 0 S2
1 1 1 1 1 1 1 S3
0 0 0 0 0 0 0 C3
1 1 1 1 1 1 1 S3
0 0 0 0 0 0 0 C3
(+) 0 0 1 0 0 0 0 C2
1 1 0 1 1 1 1 S4
0 1 0 0 0 0 0 C4
(1)
1 1 0 1 1 1 1 S4
(+) 0 1 0 0 0 0 0 C4
1 0 0 0 1 1 1 1 Result
Answer is 1 0 0 0 1 1 1 1
3.8.5 DIVISION
The example is dividing 1,001,010ten by 1000ten:
Divide’s two operands, called the dividend and divisor, and the result, called the quotient, are accompanied
by a second result, called the remainder. Here is another way to express the relationship between the
components:
Dividend = Quotient X Divisor + Remainder
where the remainder is smaller than the divisor.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Hardware Implementation consists of n+1 bit binary adder, shift, add and subtract control logic and
register A, B, and Q.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Divisor and Dividend are loaded into register B, Q and register A is set to zero initially (Figure 3.23).
Steps:
1. Shift A and Q Left ones binary position
2. Subtract divisor from A and store result in A (i.e) A A-B
3. If the sign bit of A is 1, set Q0 to 0 and add divisor back to A. Otherwise set Q0 to 1
4. Repeat steps 1, 2 and 3 n times.
Advantage
Full width comparisons required to deduce the new quotient digit.
Limitation
Slower- requires time because of restoration in each cycle
Example: Divide (10)10 by (3)10 using the restoring division algorithm
Solution:
Assume the Registers:
Register A=00000
Dividend Q = 1010
Divisor B= 0011(Append 0 to MSB of B while add/sub with accumulator A)
A=A-B 11110 0 1 0 0
A=A-B 0 0010 0 0 0 1
Shift 00100
0 0 1
A=A-B 00001
Fourth Cycle
0 0 1 1
Remainder
Quotient
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
A=A-B 11110 0 1 0 0
1 0 0
Shift 11100
Second Cycle
1 0 0 0
A=A+B 11111
0 0 0
Shift 11111
Third Cycle
A=A+B 00010 0 0 0 1
Shift 00100 0 0 1
0 0 1 1
Remainder Quotient
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
Examples:
X = 0.3 * 102 = 30
Y = 0.2 * 103 = 200
X + Y = (0.3 * 102-3 + 0.2) * 103 = 0.23 * 103 = 230
X - Y = (0.3 * 102-3 - 0.2) * 103 = ( - 0.17) * 103 = -170
X * Y = (0.3 * 0.2) * 102+3 = 0.06 * 105 = 6000
X , Y = (0.3 , 0.2) * 102-3 = 1.5 * 10-1 = 0.15
Phase 3-Addition: Next, the two significands are added together, taking into account their signs. Because
the signs may differ, the result may be 0. There is also the possibility of significand overflow by 1 digit. If
so, the significand of the result is shifted right and the exponent is incremented. An exponent overflow
could occur as a result; this would be reported and the operation halted.
Phase 4-Normalization: The final phase normalizes the result. Normalization consists of shifting
significand digits left until the most significant digit (bit, or 4 bits for base-16 exponent) is nonzero. Each
shift causes a decrement of the exponent and thus could cause an exponent underflow. Finally, the result
must be rounded off and then reported.
If the exponent of the product is within the proper range, the next step is to multiply the significands, taking
into account their signs. The multiplication is performed in the same way as for integers. In this case, we
are dealing with a sign magnitude representation, but the details are similar to those for twos complement
representation.
REGULATION: IFETCE R2023 ACADEMIC YEAR: 2025-2026
The product will be double the length of the multiplier and multiplicand. The extra bits will be lost during
rounding. After the product is calculated, the result is then normalized and rounded, as was done for
addition and subtraction (Figure 3.25). Note that normalization could result in exponent underflow.
In division, the first step is testing for 0. If the divisor is 0, an error report is issued, or the result is set to
infinity, depending on the implementation. A dividend of 0 results in 0. Next, the divisor exponent is
subtracted from the dividend exponent. This removes the bias, which must be added back in. Tests are then
made for exponent underflow or overflow. The next step is to divide the significands. This is followed with
the usual normalization and rounding (Figure 3.26).