Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Multiplying in assembly

Status
Not open for further replies.

panda1234

Full Member level 2
Joined
Jan 22, 2015
Messages
125
Helped
4
Reputation
8
Reaction score
4
Trophy points
18
Activity points
1,172
Hi,
I want to know how to multiply two 64bit number in part of 32 bit?suppose A has two parts AH&AL and B has two parts BH&BL
How Multiply these numbers?
 

Hi,

How do you multiply 123 x 456 in decimal?

either
Code:
123 x 400 = 49200
123 x 50  =  6150  
123 x 6   =   738
-----------------------
            56088

or 
4----, 1 x 4, shift 4 times left
-8---, 2 x 4, shift 3 times left
-12--, 3 x 4, shift 2 times left
-5---, 1 x 5, shift 3 times left
-10--, 2 x 5, shift 2 times left
--15-, 3 x 5, shift 1 times left
--6--, 1 x 6, shift 2 times left
--12-, 2 x 6, shift 1 times left
---18, 3 x 6, no shift
--------
56088
 

Here is the math involved for doing the 64x64-bit multiplication on a 32-bit machine. How you write software to do this is not my forte, I'm a hardware guy.
Code:
For 64-bit multiply with 32-bit inputs resulting in 128-bit result:
AHAL x BHBL

(AH x BH) << 64
(AH x BL) << 32
(AL x BH) << 32
(AL x BL) << 0

A simple testcase 8-bit by 8-bit multiplication for 4 bit values of AH=1001, AL=1100, BH=0010, and BL=0101.
(AH x BH) << 8 = 1001 x 0010 << 8 = 0001001000000000
(AH x BL) << 4 = 1001 x 0101 << 4 = 0000001011010000
(AL x BH) << 4 = 1100 x 0010 << 4 = 0000000110000000
(AL x BL) << 0 = 1100 x 0101 << 0 = 0000000000111100
----------------------------------------------------
                                    0001011010001100
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top