SlideShare a Scribd company logo
1 of 10
Dr. Prasenjit Dey

© Dr. Prasenjit Dey 2
Integer Division
Dividend = Quotient × Divisor + Remainder
Divisor
Quotient
Dividend
Remainder
174÷8 = 21(Q) , 6(R)
1<8
17>8
14>8
6<8
Divisor
Quotient Dividend
Remainder
(174)10 = (1010 1110)2
(8)10 = (1000)2
1010>1000
101<1000
1011>1000
111<1000-0
1110
-1000 1110>1000
110 110<1000
8 174
-0
17
-16
14
-8
6
0 2 1
1000 10101110
-1000
101
-0
1011
-1000
111
1 0 1 0 1

Implementation 1
© Dr. Prasenjit Dey 3
32bit ALU
Divisor
shift right
Remainder
write
Quotient
shift left
Control
32 bits
32 bits 32 bits

Restoring Division (Flowchart)
start
A = 0
M = divisor
Q = Dividend
cnt = n
Shift left A,Q
A = A-M
A<0?
Q0 = 1
Q0 = 0
A = A + M
cnt = cnt -1
Cnt=0 stop
YesNo
No Yes
© Dr. Prasenjit Dey 4
Restoration of A

Step-1:
First the registers are initialized with corresponding values (Q = Dividend, M = Divisor, A
= 0, n = number of bits in dividend)
Step-2:
Then the content of register A and Q is shifted left as a single unit
Step-3:
Then content of register M is subtracted from A and result is stored in A
Step-4:
Then the most significant bit of the A is checked if it is 0 the LSB of Q is set to 1 otherwise
if it is 1 the LSB of Q is set to 0 and value of register A is restored i.e the value of A before
the subtraction with M
Step-5:
Decrement the counter n
Step-6:
When n becomes zero, we get out of the loop otherwise we repeat from step 2
Step-7:
Finally, the register Q contain the quotient and register A contain remainder
Restoring Division (Algorithm)
© Dr. Prasenjit Dey 5

© Dr. Prasenjit Dey 6
Restoring Division (Example)
Action M A Q Count
initialize 00011 00000 1011 4
shift left AQ 00001 011_
A=A-M (00001 - 00011) = 11110 011_
Q[0]=0 and restore A (11110 + 00011) = 00001 0110 3
shift left AQ 00010 110_
A=A-M (00010 - 00011) = 11111 110_
Q[0]=0 and restore A (11111 + 00011) = 00010 1100 2
shift left AQ 00101 100_
A=A-M (00101 - 00011) = 00010 100_
Q[0]=1 00010 1001 1
shift left AQ 00101 001_
A=A-M (00101 - 00011) = 00010 001_
Q[0]=1 00010 0011 0
Dividend (Q) = (11)10 = (1011 )2
Divisor (M) = (3)10 = (00011)2

Drawback
 Division still takes:
 2 ALU cycles per bit position
 1 to check for divisibility (subtract)
 One to restore (if needed)
 Can reduce to 1 cycle per bit
 Called non-restoring division
 Avoids restore of remainder when test fails
© Dr. Prasenjit Dey

Non-Restoring Division (Flowchart)
start
A = 0
M = divisor
Q = Dividend
cnt = n
A<0?
Shift left A,Q
A = A-M
Shift left A,Q
A = A+M
cnt = cnt -1
Cnt=0 stop
YesNo
No Yes
A<0? A = A+M
No
Yes
A<0?
Q0 = 0
YesNo
Q0 = 1
© Dr. Prasenjit Dey 8
Step-1: First the registers are initialized with corresponding values (Q = Dividend,
M = Divisor, A = 0, n = number of bits in dividend)
Step-2: Check the sign bit of register A
 If it is 1 shift left content of AQ and perform A = A+M, otherwise shift left AQ and
perform A = A-M
Step-3: Again check the sign bit of register A
 If sign bit is 1 Q[0] become 0 otherwise Q[0] become 1
Step-4: Decrements value of cnt by 1
Step-5: If cnt not equal to zero go to Step 2 otherwise go to next step
Step-6: If sign bit of A is 1 then perform A = A+M
Step-7: Register Q contain quotient and register A contain remainder
Non-Restoring Division (Algorithm)
© Dr. Prasenjit Dey 9

© Dr. Prasenjit Dey 10
Non-Restoring Division (Example)
Dividend (Q) = (11)10 = (1011 )2
Divisor (M) = (3)10 = (00011)2
Action M A Q count
Start 00011 00000 1011 4
Left shift AQ 00001 011_
A=A-M (00001 - 00011) = 11110 011_
Q[0]=0 11110 0110 3
Left shift AQ 11100 110_
A=A+M (11100 + 00011) = 11111 110_
Q[0]=0 11111 1100 2
Left Shift AQ 11111 100_
A=A+M (11111 + 00011) = 00010 100_
Q[0]=1 00010 1001 1
Left Shift AQ 00101 001_
A=A-M (00101 - 00011) = 00010 001_
Q[0]=1 00010 0011 0

More Related Content

What's hot

Restoring and Non-Restoring division algo for CSE
Restoring and Non-Restoring division algo for CSERestoring and Non-Restoring division algo for CSE
Restoring and Non-Restoring division algo for CSEARoy10
 
Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithmGaurav Subham
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)Piyush Rochwani
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operationNikhil Pandit
 
Restoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania NisarRestoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania NisarSania Nisar
 
Floating point representation
Floating point representationFloating point representation
Floating point representationmissstevenson01
 
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil KawarePentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil KawareProf. Swapnil V. Kaware
 
Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptxSyed Zaid Irshad
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registersSanjeev Patel
 

What's hot (20)

Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
Restoring and Non-Restoring division algo for CSE
Restoring and Non-Restoring division algo for CSERestoring and Non-Restoring division algo for CSE
Restoring and Non-Restoring division algo for CSE
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
 
Protection mode
Protection modeProtection mode
Protection mode
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
Multiplication algorithm
Multiplication algorithmMultiplication algorithm
Multiplication algorithm
 
Floating point arithmetic
Floating point arithmeticFloating point arithmetic
Floating point arithmetic
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
Data representation
Data representationData representation
Data representation
 
Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)Booth’s algorithm.(a014& a015)
Booth’s algorithm.(a014& a015)
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operation
 
Restoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania NisarRestoring & Non-Restoring Division Algorithm By Sania Nisar
Restoring & Non-Restoring Division Algorithm By Sania Nisar
 
Floating point representation
Floating point representationFloating point representation
Floating point representation
 
Pentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil KawarePentium (80586) Microprocessor By Er. Swapnil Kaware
Pentium (80586) Microprocessor By Er. Swapnil Kaware
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Data Structure and Algorithms.pptx
Data Structure and Algorithms.pptxData Structure and Algorithms.pptx
Data Structure and Algorithms.pptx
 
Division algorithm
Division algorithmDivision algorithm
Division algorithm
 
Instruction codes and computer registers
Instruction codes and computer registersInstruction codes and computer registers
Instruction codes and computer registers
 
Instruction format
Instruction formatInstruction format
Instruction format
 

Similar to Binary division restoration and non restoration algorithm

Division method Non Restoring.ppt
Division method Non Restoring.pptDivision method Non Restoring.ppt
Division method Non Restoring.ppthimanshu2125cse1052
 
Data representation and Arithmetic Algorithms
Data representation and Arithmetic AlgorithmsData representation and Arithmetic Algorithms
Data representation and Arithmetic AlgorithmsMumthas Shaikh
 
Booth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxBooth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxSMohiuddin1
 
lecture 5 courseII (6).pptx
lecture 5 courseII (6).pptxlecture 5 courseII (6).pptx
lecture 5 courseII (6).pptxAYMENGOODKid
 
Number System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemNumber System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemdrpreetiwctm
 
3 d rotation about an arbitary axix
3 d rotation about an arbitary axix3 d rotation about an arbitary axix
3 d rotation about an arbitary axixMazharul Islam
 
Story of Number.ppt
Story of Number.pptStory of Number.ppt
Story of Number.pptshivas379526
 
15 regression basics
15 regression basics15 regression basics
15 regression basicsgaurav arora
 
Booth's Algorithm Fully Explained With Flow Chart PDF
Booth's Algorithm Fully Explained With Flow Chart PDFBooth's Algorithm Fully Explained With Flow Chart PDF
Booth's Algorithm Fully Explained With Flow Chart PDFParthdhwajendra Mishra
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Karthik Karunanithy
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Karthik Karunanithy
 
PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020Thyagharajan K.K.
 

Similar to Binary division restoration and non restoration algorithm (20)

Division method Non Restoring.ppt
Division method Non Restoring.pptDivision method Non Restoring.ppt
Division method Non Restoring.ppt
 
Data representation and Arithmetic Algorithms
Data representation and Arithmetic AlgorithmsData representation and Arithmetic Algorithms
Data representation and Arithmetic Algorithms
 
Booth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptxBooth's Multiplication Algorithm.pptx
Booth's Multiplication Algorithm.pptx
 
Ch_10.pptx.pdf
Ch_10.pptx.pdfCh_10.pptx.pdf
Ch_10.pptx.pdf
 
Booth's algorithm
Booth's algorithm Booth's algorithm
Booth's algorithm
 
lecture 5 courseII (6).pptx
lecture 5 courseII (6).pptxlecture 5 courseII (6).pptx
lecture 5 courseII (6).pptx
 
Chapter002math
Chapter002mathChapter002math
Chapter002math
 
Lecture_5-2.ppt
Lecture_5-2.pptLecture_5-2.ppt
Lecture_5-2.ppt
 
Number System 123.ppt is for binary number system
Number System 123.ppt is for binary number systemNumber System 123.ppt is for binary number system
Number System 123.ppt is for binary number system
 
CA UNIT II.pptx
CA UNIT II.pptxCA UNIT II.pptx
CA UNIT II.pptx
 
DC servo motor
DC servo motorDC servo motor
DC servo motor
 
3 d rotation about an arbitary axix
3 d rotation about an arbitary axix3 d rotation about an arbitary axix
3 d rotation about an arbitary axix
 
Story of Number.ppt
Story of Number.pptStory of Number.ppt
Story of Number.ppt
 
15 regression basics
15 regression basics15 regression basics
15 regression basics
 
Booth's Algorithm Fully Explained With Flow Chart PDF
Booth's Algorithm Fully Explained With Flow Chart PDFBooth's Algorithm Fully Explained With Flow Chart PDF
Booth's Algorithm Fully Explained With Flow Chart PDF
 
Dld lecture module 02
Dld lecture module 02Dld lecture module 02
Dld lecture module 02
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
 
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
Trial spm smk_st_george_taiping_2013_maths_paper1_2_[a]
 
PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020PPT 2 - CA unit II 22 7-2020
PPT 2 - CA unit II 22 7-2020
 
18-FSM.ppt
18-FSM.ppt18-FSM.ppt
18-FSM.ppt
 

More from Prasenjit Dey

Dynamic interconnection networks
Dynamic interconnection networksDynamic interconnection networks
Dynamic interconnection networksPrasenjit Dey
 
Machine Learning in Agriculture Module 6: classification
Machine Learning in Agriculture Module 6: classificationMachine Learning in Agriculture Module 6: classification
Machine Learning in Agriculture Module 6: classificationPrasenjit Dey
 
Machine Learning in Agriculture Module 3: linear regression
Machine Learning in Agriculture Module 3: linear regressionMachine Learning in Agriculture Module 3: linear regression
Machine Learning in Agriculture Module 3: linear regressionPrasenjit Dey
 
Machine learning in agriculture module 2
Machine learning in agriculture module 2Machine learning in agriculture module 2
Machine learning in agriculture module 2Prasenjit Dey
 
Machine Learning in Agriculture Module 1
Machine Learning in Agriculture Module 1Machine Learning in Agriculture Module 1
Machine Learning in Agriculture Module 1Prasenjit Dey
 
Support vector machine
Support vector machineSupport vector machine
Support vector machinePrasenjit Dey
 
Numerical on general pipelines
Numerical on general pipelinesNumerical on general pipelines
Numerical on general pipelinesPrasenjit Dey
 
General pipeline concepts
General pipeline conceptsGeneral pipeline concepts
General pipeline conceptsPrasenjit Dey
 
Evaluation of computer performance
Evaluation of computer performanceEvaluation of computer performance
Evaluation of computer performancePrasenjit Dey
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPSPrasenjit Dey
 
Page replacement and thrashing
Page replacement and thrashingPage replacement and thrashing
Page replacement and thrashingPrasenjit Dey
 
Register transfer and microoperations part 2
Register transfer and microoperations part 2Register transfer and microoperations part 2
Register transfer and microoperations part 2Prasenjit Dey
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Prasenjit Dey
 
Register transfer and microoperations part 1
Register transfer and microoperations part 1Register transfer and microoperations part 1
Register transfer and microoperations part 1Prasenjit Dey
 
Different types of memory and hardware designs of RAM and ROM
Different types of memory and hardware designs of RAM and ROMDifferent types of memory and hardware designs of RAM and ROM
Different types of memory and hardware designs of RAM and ROMPrasenjit Dey
 
Carry look ahead adder
Carry look ahead adder Carry look ahead adder
Carry look ahead adder Prasenjit Dey
 
Computer organization basics and number systems
Computer organization basics and number systemsComputer organization basics and number systems
Computer organization basics and number systemsPrasenjit Dey
 

More from Prasenjit Dey (19)

Dynamic interconnection networks
Dynamic interconnection networksDynamic interconnection networks
Dynamic interconnection networks
 
Machine Learning in Agriculture Module 6: classification
Machine Learning in Agriculture Module 6: classificationMachine Learning in Agriculture Module 6: classification
Machine Learning in Agriculture Module 6: classification
 
Machine Learning in Agriculture Module 3: linear regression
Machine Learning in Agriculture Module 3: linear regressionMachine Learning in Agriculture Module 3: linear regression
Machine Learning in Agriculture Module 3: linear regression
 
Machine learning in agriculture module 2
Machine learning in agriculture module 2Machine learning in agriculture module 2
Machine learning in agriculture module 2
 
Machine Learning in Agriculture Module 1
Machine Learning in Agriculture Module 1Machine Learning in Agriculture Module 1
Machine Learning in Agriculture Module 1
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Numerical on general pipelines
Numerical on general pipelinesNumerical on general pipelines
Numerical on general pipelines
 
General pipeline concepts
General pipeline conceptsGeneral pipeline concepts
General pipeline concepts
 
Evaluation of computer performance
Evaluation of computer performanceEvaluation of computer performance
Evaluation of computer performance
 
Instruction Set Architecture: MIPS
Instruction Set Architecture: MIPSInstruction Set Architecture: MIPS
Instruction Set Architecture: MIPS
 
Page replacement and thrashing
Page replacement and thrashingPage replacement and thrashing
Page replacement and thrashing
 
Addressing mode
Addressing modeAddressing mode
Addressing mode
 
Register transfer and microoperations part 2
Register transfer and microoperations part 2Register transfer and microoperations part 2
Register transfer and microoperations part 2
 
Instruction set (prasenjit dey)
Instruction set (prasenjit dey)Instruction set (prasenjit dey)
Instruction set (prasenjit dey)
 
Register transfer and microoperations part 1
Register transfer and microoperations part 1Register transfer and microoperations part 1
Register transfer and microoperations part 1
 
Different types of memory and hardware designs of RAM and ROM
Different types of memory and hardware designs of RAM and ROMDifferent types of memory and hardware designs of RAM and ROM
Different types of memory and hardware designs of RAM and ROM
 
Cache memory
Cache  memoryCache  memory
Cache memory
 
Carry look ahead adder
Carry look ahead adder Carry look ahead adder
Carry look ahead adder
 
Computer organization basics and number systems
Computer organization basics and number systemsComputer organization basics and number systems
Computer organization basics and number systems
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 

Binary division restoration and non restoration algorithm

  • 2.  © Dr. Prasenjit Dey 2 Integer Division Dividend = Quotient × Divisor + Remainder Divisor Quotient Dividend Remainder 174÷8 = 21(Q) , 6(R) 1<8 17>8 14>8 6<8 Divisor Quotient Dividend Remainder (174)10 = (1010 1110)2 (8)10 = (1000)2 1010>1000 101<1000 1011>1000 111<1000-0 1110 -1000 1110>1000 110 110<1000 8 174 -0 17 -16 14 -8 6 0 2 1 1000 10101110 -1000 101 -0 1011 -1000 111 1 0 1 0 1
  • 3.  Implementation 1 © Dr. Prasenjit Dey 3 32bit ALU Divisor shift right Remainder write Quotient shift left Control 32 bits 32 bits 32 bits
  • 4.  Restoring Division (Flowchart) start A = 0 M = divisor Q = Dividend cnt = n Shift left A,Q A = A-M A<0? Q0 = 1 Q0 = 0 A = A + M cnt = cnt -1 Cnt=0 stop YesNo No Yes © Dr. Prasenjit Dey 4 Restoration of A
  • 5.  Step-1: First the registers are initialized with corresponding values (Q = Dividend, M = Divisor, A = 0, n = number of bits in dividend) Step-2: Then the content of register A and Q is shifted left as a single unit Step-3: Then content of register M is subtracted from A and result is stored in A Step-4: Then the most significant bit of the A is checked if it is 0 the LSB of Q is set to 1 otherwise if it is 1 the LSB of Q is set to 0 and value of register A is restored i.e the value of A before the subtraction with M Step-5: Decrement the counter n Step-6: When n becomes zero, we get out of the loop otherwise we repeat from step 2 Step-7: Finally, the register Q contain the quotient and register A contain remainder Restoring Division (Algorithm) © Dr. Prasenjit Dey 5
  • 6.  © Dr. Prasenjit Dey 6 Restoring Division (Example) Action M A Q Count initialize 00011 00000 1011 4 shift left AQ 00001 011_ A=A-M (00001 - 00011) = 11110 011_ Q[0]=0 and restore A (11110 + 00011) = 00001 0110 3 shift left AQ 00010 110_ A=A-M (00010 - 00011) = 11111 110_ Q[0]=0 and restore A (11111 + 00011) = 00010 1100 2 shift left AQ 00101 100_ A=A-M (00101 - 00011) = 00010 100_ Q[0]=1 00010 1001 1 shift left AQ 00101 001_ A=A-M (00101 - 00011) = 00010 001_ Q[0]=1 00010 0011 0 Dividend (Q) = (11)10 = (1011 )2 Divisor (M) = (3)10 = (00011)2
  • 7.  Drawback  Division still takes:  2 ALU cycles per bit position  1 to check for divisibility (subtract)  One to restore (if needed)  Can reduce to 1 cycle per bit  Called non-restoring division  Avoids restore of remainder when test fails © Dr. Prasenjit Dey
  • 8.  Non-Restoring Division (Flowchart) start A = 0 M = divisor Q = Dividend cnt = n A<0? Shift left A,Q A = A-M Shift left A,Q A = A+M cnt = cnt -1 Cnt=0 stop YesNo No Yes A<0? A = A+M No Yes A<0? Q0 = 0 YesNo Q0 = 1 © Dr. Prasenjit Dey 8
  • 9. Step-1: First the registers are initialized with corresponding values (Q = Dividend, M = Divisor, A = 0, n = number of bits in dividend) Step-2: Check the sign bit of register A  If it is 1 shift left content of AQ and perform A = A+M, otherwise shift left AQ and perform A = A-M Step-3: Again check the sign bit of register A  If sign bit is 1 Q[0] become 0 otherwise Q[0] become 1 Step-4: Decrements value of cnt by 1 Step-5: If cnt not equal to zero go to Step 2 otherwise go to next step Step-6: If sign bit of A is 1 then perform A = A+M Step-7: Register Q contain quotient and register A contain remainder Non-Restoring Division (Algorithm) © Dr. Prasenjit Dey 9
  • 10.  © Dr. Prasenjit Dey 10 Non-Restoring Division (Example) Dividend (Q) = (11)10 = (1011 )2 Divisor (M) = (3)10 = (00011)2 Action M A Q count Start 00011 00000 1011 4 Left shift AQ 00001 011_ A=A-M (00001 - 00011) = 11110 011_ Q[0]=0 11110 0110 3 Left shift AQ 11100 110_ A=A+M (11100 + 00011) = 11111 110_ Q[0]=0 11111 1100 2 Left Shift AQ 11111 100_ A=A+M (11111 + 00011) = 00010 100_ Q[0]=1 00010 1001 1 Left Shift AQ 00101 001_ A=A-M (00101 - 00011) = 00010 001_ Q[0]=1 00010 0011 0