Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   declaring real numbers (2^15-1) and (-2^15) in vhdl (http://www.velocityreviews.com/forums/t22399-declaring-real-numbers-2-15-1-and-2-15-in-vhdl.html)

hari 04-22-2004 03:03 AM

declaring real numbers (2^15-1) and (-2^15) in vhdl
 
hi
i would like to know how to declare the numbers in vhdl.the numbers
are
(2^15-1) and (-2^15).

when i declare it using the REAL modelsim returns a error saying it is
out of range.how to overcome it
thanks
hari

Egbert Molenkamp 04-22-2004 07:31 AM

Re: declaring real numbers (2^15-1) and (-2^15) in vhdl
 
Here an example (no problem for Modelsim)
constant rl : real := 2.0**15;

(remember the right operand of the power function should be an integer; so
do not write 15.0. When you use the IEEE package math_real you have more
functions)

Egbert Molenkamp

"hari" <hari_pro@yahoo.com> wrote in message
news:a4a587f1.0404211903.7b799a11@posting.google.c om...
> hi
> i would like to know how to declare the numbers in vhdl.the numbers
> are
> (2^15-1) and (-2^15).
>
> when i declare it using the REAL modelsim returns a error saying it is
> out of range.how to overcome it
> thanks
> hari




Charles Bailey 05-12-2004 09:43 PM

Re: declaring real numbers (2^15-1) and (-2^15) in vhdl
 
constant i : integer:=2**15;
works also.

"Egbert Molenkamp" <remove_funny_molenkam@cs.utwente.nl> wrote in
message news:c67sd7$7gn$1@ares.cs.utwente.nl...
> Here an example (no problem for Modelsim)
> constant rl : real := 2.0**15;
>
> (remember the right operand of the power function should be an

integer; so
> do not write 15.0. When you use the IEEE package math_real you have

more
> functions)





All times are GMT. The time now is 07:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.