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.

Approximation of multiplication product

Status
Not open for further replies.

honnaraj.t

Member level 2
Joined
Aug 3, 2007
Messages
48
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
1,725
hi,
i need to do multiplication of 12-bit(11-0) number which is of fixed format means.......
in this last bit represents sign bit and remaining represents magnitude. i am doing multiplication using ALTERA multiplier (MEGAWIZARD-FUNC) which is giving 24-bit product but i want this to be compressed to 12-bit (more efficiently)..............please attach any material regarding this topic if it is available. thanks in advance .....................................
 

I guess you're talking of regular signed (2's complement) arithmetic. For a 12 bit accurate result you have to perform a 12x12 multiply and cut off the less significant bits. There's no other approximation. In a signed x signed multiply, also the highest result bit is redundant, if you handle the overflow with 0x800*0x800.
 

Thanks for replying.....

i am bit confused regarding : if we multiplied n-bits * n-bits = product is definetly 2n-bits ..........if we want to assign this 2n-bit product to n-bit (register) which gives an error........ if we repeat multiplication 4-5 times on same data my results will go very bad...

i got shock while i did this example -1(12-bit)*-1(12-bit) =0 (LSB-12-bit)
 

The correct truncation of the 24 bit product to a 12 bit result depends on the meaning of your fixed point number format. Unfortunately you didn't tell about. Cutting of the less significant bits is correct for a fractional (representing -1 to +1) format. If you are intending a simple right justified integer format, the 12 most significant bits have to be eliminated by saturation logic, positive values have to be limited to +2047 (0x7ff) and negative to -2048 (0x800). Obviously, the number of result bits must fit the register size before assigning it, a general HDL programming fact, not specific to arithmetics.

As a hint: Cause standard libraries don't provide this kind of operations, it's meaningful to define functions that perform it.
 

I believe a good solution is to determine the dynamic range of the vector that needs to be truncated. For example, if you have a signed vector of 8-bits that needs to be efficiently truncated to only 4-bits and we need to have the resultant 4-bits to contain most of the value of the input 8-bits vector, we can consider the following:

Say:
X = 1111_1010 -- Input Vector
Notice that the most significant 5bits are all (1)s. And they are representing the sign of the vector, while the effective value of the vector is only contained in the least-significant 3 bits.

If you managed to determine the effective range of the value, u can truncate its most-significant 4bits of this range, and this might be the most accurate truncation.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top