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.

correctly truncating bits for fpga arithmetic

Status
Not open for further replies.

sweethomela8

Member level 4
Joined
Apr 28, 2010
Messages
70
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,766
To avoid overflow, when you do a multiplication or large sum, you have enough bits to hold the largest value possible from the arithmetic. If you need to scale down in bits, do you take the number of bits from the MSB downto the number of bits you can use? say you have a 20 bit sum and need to truncate it down to 10 bits...do you take the MSB down to the 10th bit?
 

I'm not sure I fully understand your question, but if you have a multiplication result and you need to truncate it, of course you would take bits from MSB down rather than LSB up. Take a few examples and convert to decimal to see why -- it should be very obvious.

If I misunderstood, please forgive me and explain more.
 

Always discard the least significant bits. Also you should look at the most significant bit of the 10 bits you are dropping and make a decision like this; If the MSBit of the 10 bit you are dropping and the LSBit of the 10 bit you are keeping are both 1's, then add 1 to the 10 bits you are keeping (the MSB). This improves your precision by 1/2 point.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top