0% found this document useful (0 votes)
407 views

Multiplication by Shift & Add Algorithm

The document describes a flowchart for multiplying two binary numbers using bit shifting and addition. It initializes a count register and product register, then shifts and adds the multiplicand depending on the most significant bit of the multiplier until the count reaches 0. An example calculation of 5 x 5 in binary is shown step-by-step. Finally, an assembly language program to implement the multiplication algorithm is listed.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
407 views

Multiplication by Shift & Add Algorithm

The document describes a flowchart for multiplying two binary numbers using bit shifting and addition. It initializes a count register and product register, then shifts and adds the multiplicand depending on the most significant bit of the multiplier until the count reaches 0. An example calculation of 5 x 5 in binary is shown step-by-step. Finally, an assembly language program to implement the multiplication algorithm is listed.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

FLOWCHART

START SET NO OF BITS OF MULTIPLIER AS COUNT (R4) SET INITIAL PRODUCT AS 0000 0000 (R6) CHECK MSB OF MULTIPLIER IS MSB=0 No

Yes

SHIFT PRODUCT TO LEFT AND ADD MULTIPLICAND TO IT

SHIFT PRODUCT TO LEFT

SHIFT MULTIPLIER TO LEFT TO OBTAIN NEW MSB

DECREMENT R4

No

IS R4=0 Yes STOP

pdfMachine Is a pdf writer that produces quality PDF files with ease! Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across nearly all Windows platforms, if you can print from a windows application you can use pdfMachine. Get yours now!

EXAMPLE
Q) 05 x 05 (0101 x 0101) STEPS:Initial Product: Multiplier MSB- 0 Initial Product: Multiplier MSB- 1 Initial Product: 0000 0000 + (after rotation) 0101 0000 0101 Multiplier MSB- 0 Initial Product: Multiplier MSB- 1 Initial Product: 0001 0100 + (after rotation) 0101 0001 1001 0000 1010 (after rotation) Count: 01 Count: 02 0000 0000 (after rotation) Count: 03 0000 0000 Count: 04

Count: 00

ANSWER: 0001 1001= 19H= 25 (decimal)!!!

pdfMachine Is a pdf writer that produces quality PDF files with ease! Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across nearly all Windows platforms, if you can print from a windows application you can use pdfMachine. Get yours now!

PROGRAM
org 4100h mov r4,#04h mov r6,#00h mov r0,31h mov r1,32h mov a,r1 swap a mov r1,a clr c mov a,r1 rlc a mov r1,a jc l1 sjmp l2 mov a,r6 clr c rlc a add a,r0 mov r6,a sjmp l4 mov a,r6 clr c rlc a mov r6,a djnz r4,l3 sjmp hlt

l3:

l1:

l2:

l4: hlt:

pdfMachine Is a pdf writer that produces quality PDF files with ease! Produce quality PDF files in seconds and preserve the integrity of your original documents. Compatible across nearly all Windows platforms, if you can print from a windows application you can use pdfMachine. Get yours now!

You might also like