Negative and floating point numbers in verilog

Status
Not open for further replies.

saima_a

Newbie level 4
Joined
Sep 19, 2008
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,332
verilog negative numbers

Hi all
i want to implement the following mathematical equation in verilog:

slopeup=(y2-y1)/(x2-x1)

slopeup after calculations will be like 0.01456... or -0.013478......... etc.
Plz can anybody tell me how to accomodate numbers like this in verilog???? Plz reply soon. Waiting
 

verilog negative

Negative numbers are generally represented as 2's compliment in hardware.
While fractional numbers, may be represented by 'fixed point' or floating point.
Fixed point is simpler form, but may not have a vast 'range'.
If you see some of the c progrmas on the following site, you will get an idea how to represent fractional/decimal numbers using fixed point binary.
http://www.vlsiip.com/cindex.html
Kr,
Avi
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…