Marcus Harnisch wrote:
> David Bishop writes:
> > 1) Added functions "add_sign" and "remove_sign" to convert between
> > SIGNED and UNSIGNED types. "add_sign" would add a '0' sign bit
> > and increase the vector by 1 bit. "remove_sign" would do an "abs"
> > and remove the sign bit, shrinking the vector by 1 bit.
>
> It's late over here, but how would the corner case of -(2**n)/2 be
> dealt with? Say we have an 8bit signed, which can have a value of
> -128. If the size of the vector would be reduced by one, we'd end up
> with a vector of zeros :-/
Good point.
This means that the output of the "remove_sign" function will
have to be the same length as the input.
Will fix.
-- David W. Bishop dbishop@vhdl.org All standard disclaimers apply.Received on Tue Oct 26 08:15:08 2004
This archive was generated by hypermail 2.1.8 : Tue Oct 26 2004 - 08:15:34 PDT