Re: [vhdl-200x-ft] Bit size rules

From: John Michael Williams <jwill@AstraGate.net>
Date: Tue Jul 06 2004 - 22:24:49 PDT

Hi David.

It appears to me that there may be ESSENTIAL inconsistencies
here. If so, operators for fp have to be different
than for float or integer.

Two alternatives seem feasible:

1. Only overload for fp operands or operators which do
    not create inconsistency. This might be hard on the
    user.

2. Define a new set of operator symbols for fp arithmetic.
    For example, fp '*' is called by "|*", where the
    prefix '|' indicates that the multiplication is to be
    fixed point. A |* B is a fixed point expression.

Also, negative indices are very important in DSP, so
they should be allowed somehow.

David Bishop wrote:
> This is another inconsistency with numeric_std.
>
> For addition, we have the hardest pill to swallow:
> In numeric_std:
> unsigned (a downto 0) + unsigned (b downto 0) = unsigned (max(a,b)
> downto 0);
> unsigned (a downto 0) - unsigned (b downto 0) = unsigned (max(a,b)
> downto 0);
> signed (a downto 0) + signed (b downto 0) = signed (max(a,b) downto 0);
> signed (a downto 0) - signed (b downto 0) = signed (max(a,b) downto 0);
> Since this proposal says "max(a,b)+1" then you can no longer say:
> signal a, b : ufixed (7 downto -3);
> a <= a + b;
> Because the result needs to be one bit wider.
> You would have to say:
> a <= resize (a+b, 7, -3);
>
> For multiplication and division, these rules make sense as they
> maintain the precision on the bit width.
> In numeric_std:
> signed (a downto 0) * signed (c downto 0) = signed (a+c+1 downto 0)
> unsigned (a downto 0) * unsigned (c downto 0) = unsigned (a+c+1 downto 0)
> So this will be different in the "signed" case.
> Division in fixed point is a whole other animal. So it must be different.
>
>... [jmw: rest removed]

-- 
                          John
                      jwill@AstraGate.net
                      John Michael Williams
Received on Tue Jul 6 22:21:20 2004

This archive was generated by hypermail 2.1.8 : Tue Jul 06 2004 - 22:21:24 PDT