I have a question about to_signed and to_unsigned.
Are they reciprocals of each other?
In other words is to_signed(to_unsigned( signed_val)) == signed_val
and is to_unsigned(to_signed(unsigned_val)) == unsigned_val?
From the description it appears that to_signed increases the size by one bit.
This might not be good.
Chuck Swart
David Bishop wrote:
In the midst of writing the code for the new packages,
there are a few things I would like to add. Yes, I know,
we are in the middle of things here, but for consistency's
sake, I would like to put these before the group.
1) A constant called "quote" in standard.std. This
can be used like the NL constant, so that you can include
a quote character in an assert. Example:
assert (false)
report "to_integer (" & quote & to_string (svar) & quote & ") overflow"
severity error.
2) In numeric_std, my FAQ is "how do I convert an UNSIGNED number into
a SIGNED number"? Why don't we create two functions, "to_signed" which
takes an unsigned number, adds a sign bit to it, and returns, and
"to_unsigned" which does an "abs" is the number is negative, and drops
the sign bit.
Received on Thu, 19 Aug 2004 10:00:39 -0700
This archive was generated by hypermail 2.1.8 : Thu Aug 19 2004 - 10:00:48 PDT