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.

Can anybody tell me about 2's complement multipliers ?

Status
Not open for further replies.

narasimha_80

Newbie level 5
Newbie level 5
Joined
Nov 29, 2005
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,368
Hello,

I want to implement 8 bit 2's complement multipliers ( for fractional number multiplication ) in VHDL. Can anybody suggest me some algorithms or send me the VHDL/verilog code ?

Thanks in Advance,
Narasimha Naik
 

echo47

Advanced Member level 6
Advanced Member level 6
Joined
Apr 7, 2002
Messages
3,933
Helped
638
Reputation
1,274
Reaction score
90
Trophy points
1,328
Location
USA
Activity points
33,176
I would do this in Verilog. Verilog doesn't have any fractional data types, so I would simply remember where I put the decimal point.

Code:
module top (a, b, y);
  input signed  [7:0] a, b;
  output signed [7:0] y;

  assign y = a * b;
endmodule
 

drwho78

Full Member level 3
Full Member level 3
Joined
Dec 31, 1999
Messages
163
Helped
10
Reputation
20
Reaction score
5
Trophy points
1,298
Activity points
1,141
Go here and look for Universal Multiplier.

**broken link removed**
 

anjali

Full Member level 3
Full Member level 3
Joined
Aug 16, 2005
Messages
173
Helped
14
Reputation
28
Reaction score
6
Trophy points
1,298
Activity points
3,033
its better to use booths algorithm for signed multiplication.
 

narasimha_80

Newbie level 5
Newbie level 5
Joined
Nov 29, 2005
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,368
Hello Anjali,

Actually I want to implement fractional value (in 2's complement) multipliers in VHDL.ie represeneting fractional value in binary and multiplying. Does Booths algorithms support this fractional value multiplication ? If not, Can you suggest any algorithms for this ? I really need some help.

Best Regards,
Narasimha Naik
 

echo47

Advanced Member level 6
Advanced Member level 6
Joined
Apr 7, 2002
Messages
3,933
Helped
638
Reputation
1,274
Reaction score
90
Trophy points
1,328
Location
USA
Activity points
33,176
I'm not sure I understand your question. Multiplication of fractions is exactly the same as integer multiplication, except for the position of the decimal point.

For example, let's assume you already have hardware that multiplies two 8-bit integers to get a 16-bit product:
aaaaaaaa * bbbbbbbb = yyyyyyyyyyyyyyyy

You can use the same hardware to multiply two 8-bit fraction values:
aaa.aaaaa * bbbbbb.bb = yyyyyyyyy.yyyyyyy

However, if you don't yet have an integer multiplier, and for some reason your don't want to use the HDL * operator, than that's a different problem.
 

narasimha_80

Newbie level 5
Newbie level 5
Joined
Nov 29, 2005
Messages
8
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,368
Hello echo47,

you have written that same hardware can be used for integer and fractional multiplication. ie

aaaaaaaa * bbbbbbbb = yyyyyyyyyyyyyyyy

aaa.aaaaa * bbbbbb.bb = yyyyyyyyy.yyyyyyy

I think we can not use the same hardware for integer and fractional multiplication.

See for example
0.5 * 0.5 = 0.25

0.5 = 01 in binary;

Then, 01 * 01 =0001 = 1 in decimal and 0001 is not equal to 0.25 in binary.

But, 0.25 = 0100

So I think we cannot use same hardware for integer and fractional value multiplication. Isn't it ?

Write to me further.

Regards,
Narasimha Naik
 

tarkyss

Full Member level 6
Full Member level 6
Joined
Aug 1, 2005
Messages
340
Helped
26
Reputation
52
Reaction score
8
Trophy points
1,298
Location
China
Activity points
4,162
narasimha_80
according your example
0.5 = 01 in binary;
Then, 01 * 01 =0001
0001 is not 1
0001=00.01=0.25
you should notify the position of the decimal point.
as for algorithm
there are a lot of algorithms for multiplier implemention
you can seach them in google,
it is easy to find a lot of useful links
as anjali said, booth encode is a good method for area and speed, especially 4-based booth encode.
 

echo47

Advanced Member level 6
Advanced Member level 6
Joined
Apr 7, 2002
Messages
3,933
Helped
638
Reputation
1,274
Reaction score
90
Trophy points
1,328
Location
USA
Activity points
33,176
Or you can use my 8-bit example:

aaa.aaaaa * bbbbbb.bb = yyyyyyyyy.yyyyyyy
0.5 = aaa.aaaaa = 000.10000
0.5 = bbbbbb.bb = 000000.10
000.10000 * 000000.10 = 000000000.0100000 = 0.25

To determine the location of the output decimal point, you add the number of input fraction bits. Five fraction bits times two fraction bits gives you seven fraction bits.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top