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.

in HDL, How to round to the closestnumber in the direction of zero

Status
Not open for further replies.

rogeret

Member level 4
Joined
Sep 7, 2011
Messages
77
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,864
When you represent numbers with finite precision, not every number in the available range can be represented exactly. If a number cannot be represented exactly by the specified data type and scaling, a rounding method is used to cast the value to a representable number.
But , in HDL, How to round to the closestnumber in the direction of zero?
Any efficient method?
Thanks!
 

yes
if(MSB)
begin
truncate;
end
else
begin
scale 0.11111111 and adds
truncate
end

but it is not so efficient
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top