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.

rounding/truncation fixed-point

Status
Not open for further replies.

mkenobi

Newbie level 6
Joined
Feb 19, 2004
Messages
14
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
United Kingdom
Activity points
91
Hi, how to round off or truncate a fixed-point number? for example 32-bit to 16-bit. any help (docs or code) will be appreciated. thanks.
 

it depends on the type of data in the 32 bit number.. if all bits contain data truncate the 16 LSBs .. if say some of MSBs are repeated sign bits truncate them except one. or if the data content varies from 0 to 2^32 select a variable truncation point and adjust the bit postions in the next block..
 

i'm doing 16-bit fixed-point [SIII.FFFFFFFFFFFF (s:sign, i:integer, f: fraction)] multiplication. 16-bit product is needed
 

ok in your case the result is 31 bit.. (16+16-1).. so you can remove 1 MSB and 15 fractional LSBs to get 16 bit. the result would be SIIIIII.FFFFFFFFF
 

    mkenobi

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top