Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > VHDL > flaw in to_sign...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 6129 of 6418
Post > Topic >>

flaw in to_signed() for big numbers?

by Kevin Neilson <kevin_neilson@[EMAIL PROTECTED] > Jul 2, 2008 at 03:31 PM

Signed types (using numeric_std) can have widths bigger than 32, but the 
to_signed() function only takes integers as an argument, so it seems to 
be very difficult to assign values to large signed constants.  For 
example, in my code I have:

constant round_const: signed(c'range) := to_signed(2**x-1,c'length);

This doesn't work if x==32, because 2**32-1 is outside the range of an 
integer (which must be <=(2**31-1)).  I can't use a real as an argument, 
and I can't convert a real to a signed without converting it to an 
integer first, and then I have the same problem.

A workaround, for this case, seems to be:

constant round_const: signed(c'range):= (x-1 downto 0=>'1',others=>'0');

But that is weak.
-Kevin
 




 11 Posts in Topic:
flaw in to_signed() for big numbers?
Kevin Neilson <kevin_n  2008-07-02 15:31:54 
Re: flaw in to_signed() for big numbers?
Mike Treseler <mtresel  2008-07-02 21:04:50 
Re: flaw in to_signed() for big numbers?
kennheinrich@[EMAIL PROTE  2008-07-03 04:15:07 
Re: flaw in to_signed() for big numbers?
Kevin Neilson <kevin_n  2008-07-03 11:56:16 
Re: flaw in to_signed() for big numbers?
kennheinrich@[EMAIL PROTE  2008-07-03 14:00:32 
Re: flaw in to_signed() for big numbers?
Jonathan Bromley <jona  2008-07-03 12:17:45 
Re: flaw in to_signed() for big numbers?
Rob <BertyBooster@[EMA  2008-07-03 04:55:52 
Re: flaw in to_signed() for big numbers?
Jonathan Bromley <jona  2008-07-03 13:51:23 
Re: flaw in to_signed() for big numbers?
Kevin Neilson <kevin_n  2008-07-03 11:59:47 
Re: flaw in to_signed() for big numbers?
Rob <BertyBooster@[EMA  2008-07-03 06:08:44 
Re: flaw in to_signed() for big numbers?
"KJ" <kkjenn  2008-07-05 12:45:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 22:59:28 CST 2008.