CS304PC:Computer Organization
and Architecture (R18 II(I sem))
Department of computer science and engineering
(AI/ML)
Session 21
by
Asst.Prof.M.Gokilavani
VITS
2/13/2023 Department of CSE (AI/ML) 1
TEXTBOOK:
• 1. Computer System Architecture – M. Moris Mano, Third Edition,
Pearson/PHI.
REFERENCES:
• Computer Organization – Car Hamacher, Zvonks Vranesic, Safea
Zaky, Vth Edition, McGraw Hill.
• Computer Organization and Architecture – William Stallings Sixth
Edition, Pearson/PHI.
• Structured Computer Organization – Andrew S. Tanenbaum, 4th
Edition, PHI/Pearson.
2/13/2023 Department of CSE (AI/ML) 2
Unit III
Data Representation: Data types ,Complements, fixed point
Representations, Floating point representation.
Computer Arithmetic: Addition and subtraction,
multiplication Algorithms, Division Algorithms, Floating-point
Arithmetic operations, Decimal Arithmetic unit, Decimal
Arithmetic operations.
2/13/2023 Department of CSE (AI/ML) 3
Topics covered in session 21
2/13/2023 Department of CSE (AI/ML) 4
• Addition and subtraction
• Multiplication Algorithms
• Division Algorithms
• Floating-point Arithmetic operations
• Decimal Arithmetic unit
• Decimal Arithmetic operations.
Division Algorithm
• Division of two fixed-point binary numbers in sign-magnitude
representation is done with manually by processing of successive
compare, shift and subtract operations.
2/13/2023 Department of CSE (AI/ML) 5
Block diagram of Division operation
2/13/2023 Department of CSE (AI/ML) 6
Rules for Division method
• First, the bits of the dividend are examined from left to right, until the set of
bits examined represents a number greater that or equal to the divisor: this is
referred to as the divisor being able to divide the number.
• Until this event occurs, o’s are placed in the quotient from left to right.
• When the event occurs, a 1 is placed in th quotient and the divisor is
subtracted from the partial dividend. The result is referred to as a partial
remainder.
• The division follows a cyclic pattern. At each cycle, additional bits from the
dividend are appended to the partial remainder until the result is greater than
or equal to the divisor.
• Th divisor is subtracted from this number to produce a new partial
remainder. The process continues until all th bits of the dividend are
exhausted.
2/13/2023 Department of CSE (AI/ML) 7
2/13/2023 Department of CSE (AI/ML) 8
Unsigned Binary Division Algorithm
Algorithm for unsigned binary division
• Step 1: Initialize A,Q and M registers to Zero, dividend and divisor
respectively and counter to n where n is the number of bits in the
dividend.
• Step 2: Shift A,Q left on binary position.
• Step 3: Subtract M from A placing answer back in A. If sign of A is 1,
set Q0 to zero and add M back to A (restore A). If sign of A is 0, set
Q0 to 1.
• Step 4: Decrease counter; if counter > 0, repeat process from step 2
else stop the process. The final remainder will be in A and Quotient
will be in Q.
2/13/2023 Department of CSE (AI/ML) 9
2/13/2023 Department of CSE (AI/ML) 10
Signed Binary Division Algorithm
• Step 1: Initialize A,Q and M register to zero, dividend and divisor
respectively and count to number of bits in dividend.
• Step 2: Check sign of A;
• If A<0 (bn-1 is 1)
• Shift A,Q left on binary position.
• Subtract content of M to A and store back in A.
• Step 3: if sign of A is 0, set Q0 to 1 else set Q0 to 0.
• Step 4: Decreased counter. If counter > 0, repeat process from step 2
else go to step 5.
• Step 5: if A≥0 i.e. positive, content of A is remainder else add content
of M to A to get th remainder. The quotient will be in Q.
2/13/2023 Department of CSE (AI/ML) 11
2/13/2023 Department of CSE (AI/ML) 12
2/13/2023 Department of CSE (AI/ML) 13
Division Overflow
• In a computer system, the division operation can lead to a quotient with an
overflow because the registers cannot hold a number that exceeds the
standard length. To understand this better, consider a system with a standard
5-bit register.
• One register is used to hold the divisor and the other to hold the dividend. In
case the quotient consists of 6 bits, 5 bits of the quotient will be stored in a
5-bit register. Therefore, the overflow bit needs a flip-flop to store the sixth
bit.
• The divide overflow condition occurs in case the high-order half bits of the
dividend comprises a number that is greater than or equal to the divisor.
• One other point that needs to be considered in the division is that it is
advisable to avoid division by zero. The overflow condition is generally
detected when a flip-flop is set. This flip-flop is known as DVF.
2/13/2023 Department of CSE (AI/ML) 14
Topics to be covered in next session 22
• Floating-point Arithmetic operations
2/13/2023 Department of CSE (AI/ML) 15
Thank you!!!

CS304PC:Computer Organization and Architecture Session 21 Division Algorithm.pptx

  • 1.
    CS304PC:Computer Organization and Architecture(R18 II(I sem)) Department of computer science and engineering (AI/ML) Session 21 by Asst.Prof.M.Gokilavani VITS 2/13/2023 Department of CSE (AI/ML) 1
  • 2.
    TEXTBOOK: • 1. ComputerSystem Architecture – M. Moris Mano, Third Edition, Pearson/PHI. REFERENCES: • Computer Organization – Car Hamacher, Zvonks Vranesic, Safea Zaky, Vth Edition, McGraw Hill. • Computer Organization and Architecture – William Stallings Sixth Edition, Pearson/PHI. • Structured Computer Organization – Andrew S. Tanenbaum, 4th Edition, PHI/Pearson. 2/13/2023 Department of CSE (AI/ML) 2
  • 3.
    Unit III Data Representation:Data types ,Complements, fixed point Representations, Floating point representation. Computer Arithmetic: Addition and subtraction, multiplication Algorithms, Division Algorithms, Floating-point Arithmetic operations, Decimal Arithmetic unit, Decimal Arithmetic operations. 2/13/2023 Department of CSE (AI/ML) 3
  • 4.
    Topics covered insession 21 2/13/2023 Department of CSE (AI/ML) 4 • Addition and subtraction • Multiplication Algorithms • Division Algorithms • Floating-point Arithmetic operations • Decimal Arithmetic unit • Decimal Arithmetic operations.
  • 5.
    Division Algorithm • Divisionof two fixed-point binary numbers in sign-magnitude representation is done with manually by processing of successive compare, shift and subtract operations. 2/13/2023 Department of CSE (AI/ML) 5
  • 6.
    Block diagram ofDivision operation 2/13/2023 Department of CSE (AI/ML) 6
  • 7.
    Rules for Divisionmethod • First, the bits of the dividend are examined from left to right, until the set of bits examined represents a number greater that or equal to the divisor: this is referred to as the divisor being able to divide the number. • Until this event occurs, o’s are placed in the quotient from left to right. • When the event occurs, a 1 is placed in th quotient and the divisor is subtracted from the partial dividend. The result is referred to as a partial remainder. • The division follows a cyclic pattern. At each cycle, additional bits from the dividend are appended to the partial remainder until the result is greater than or equal to the divisor. • Th divisor is subtracted from this number to produce a new partial remainder. The process continues until all th bits of the dividend are exhausted. 2/13/2023 Department of CSE (AI/ML) 7
  • 8.
    2/13/2023 Department ofCSE (AI/ML) 8 Unsigned Binary Division Algorithm
  • 9.
    Algorithm for unsignedbinary division • Step 1: Initialize A,Q and M registers to Zero, dividend and divisor respectively and counter to n where n is the number of bits in the dividend. • Step 2: Shift A,Q left on binary position. • Step 3: Subtract M from A placing answer back in A. If sign of A is 1, set Q0 to zero and add M back to A (restore A). If sign of A is 0, set Q0 to 1. • Step 4: Decrease counter; if counter > 0, repeat process from step 2 else stop the process. The final remainder will be in A and Quotient will be in Q. 2/13/2023 Department of CSE (AI/ML) 9
  • 10.
  • 11.
    Signed Binary DivisionAlgorithm • Step 1: Initialize A,Q and M register to zero, dividend and divisor respectively and count to number of bits in dividend. • Step 2: Check sign of A; • If A<0 (bn-1 is 1) • Shift A,Q left on binary position. • Subtract content of M to A and store back in A. • Step 3: if sign of A is 0, set Q0 to 1 else set Q0 to 0. • Step 4: Decreased counter. If counter > 0, repeat process from step 2 else go to step 5. • Step 5: if A≥0 i.e. positive, content of A is remainder else add content of M to A to get th remainder. The quotient will be in Q. 2/13/2023 Department of CSE (AI/ML) 11
  • 12.
  • 13.
  • 14.
    Division Overflow • Ina computer system, the division operation can lead to a quotient with an overflow because the registers cannot hold a number that exceeds the standard length. To understand this better, consider a system with a standard 5-bit register. • One register is used to hold the divisor and the other to hold the dividend. In case the quotient consists of 6 bits, 5 bits of the quotient will be stored in a 5-bit register. Therefore, the overflow bit needs a flip-flop to store the sixth bit. • The divide overflow condition occurs in case the high-order half bits of the dividend comprises a number that is greater than or equal to the divisor. • One other point that needs to be considered in the division is that it is advisable to avoid division by zero. The overflow condition is generally detected when a flip-flop is set. This flip-flop is known as DVF. 2/13/2023 Department of CSE (AI/ML) 14
  • 15.
    Topics to becovered in next session 22 • Floating-point Arithmetic operations 2/13/2023 Department of CSE (AI/ML) 15 Thank you!!!