Date post: | 24-May-2015 |
Category: |
Engineering |
Upload: | saif-al-kalbani |
View: | 1,625 times |
Download: | 6 times |
1
MULTIPLICATION ALGORITHMS
Project of Option ACode for Multiplication of unsigned numbers and Booth’s Algorithm
Presented by:Saif Al Kalbani 39579
01-01-2014
ECCE6292Special Topics in Computer EngineeringFall 2013
Sultan Qaboos UniversityCollege of Engineering
Department of Electrical and Computer Engineering
2
Outline
Introduction Requirements Design choices Selection Flowchart for multiplication of Unsigned
Numbers Flowchart for Booth’s algorithm Demo for Multiplication of unsigned
Numbers Demo for Booth’s algorithm Conclusion
3
Requirement
Selection of Multiplication/Devision Algorithm
Write a program Input to be DECIMAL Display a trace of steps (As it was in the
class) Must not crash on invalid inputs
4
Design
Language C++
Algorithm Multiplication of unsigned Numbers Booth’s Algorithm
Sequential Development as per the flow chart Outputs of each stage was invistigated
5
FLOW CHART
Multiplication of Unsigned Numbers
6
Flow Chart
Request
user for
Multiplicand
Check if it is valid inpu
t
Check if it is positive
Discardinput
NO NO
7
Flow Chart
Determin
e the Size of
each
Initiate
arrays for A, Q and M
Initialize A to 0’s
8
Flow Chart
Convert to
Boolean
Input
that to Q and M
Initiate the Header
9
Flow Chart
Initialize C
Show the
initial value
of C,A,Q and M
Initiate the Counter
10
Flow Chart
Check Qo
Add A,M
Show the results
Shift C,A,Q
Show the results
YES
NO
11
Flow Chart
Check the counter if 0
Show the results
END
Check Qo
12
Flow Chart
StartC,A 0
M MultiplicandQ Multiplier
Count n
Q0=1?
C,A A+M
Shift C,A,QCount Count-1
Count=0?
END
NOYES
NO
YES
13
FLOW CHART
Booth’s Algorithm
14
Flow Chart
Request
user for
Multiplicand
Check if it is valid inpu
t
Check if it is positiveDiscard
input
NO
Put signs in
registers
Convert to Positive
NO
15
Flow Chart
Determin
e the Size of
each
Initiate
arrays for A, Q and M
Initialize
A,Q,M to 0’s
16
Flow Chart
Convert to Boolean
Check
sign=0
Input that to Q and M
Initiate
the Header
Convert to 2’s
complement
NO
17
Flow Chart
Initialize Q-1
Show the
initial value of A,Q,Q-1 and M
Initiate the Counter
18
Flow Chart
CheckQo,Q-1
Add A,M
Show the results
Shift A,Q,Q-1
Show the results
01
00 OR 11
Sub A,M (Add A,-
M)
10
19
Flow Chart
Check the counter if 0
Show the results
END
Check
Qo,Q
-1
20
Flow Chart
StartQ-1,A 0
M MultiplicandQ Multiplier
Count n
Q0,Q-1=?
A A+M
Arithmetic ShiftA,Q,Q-1
Count Count-1
Count=0?
END
11 OR 00
01
NO
YES
A A-M
10
21
Conclusion
Multiplication Algorithms Program Developed Checks to avoid Crash Arrays for the operands and others Functions for Efficiency Loops for Manipulation and Show
22
Thank You
Q&A