Re: [vhdl-200x] FW: string literals in fixed point package

From: David Bishop <dbishop@eda.org>
Date: Thu Jun 03 2010 - 13:02:01 PDT

Gogia, Mohit wrote:
>
> Hello,
>
> The Fixed point package in VHDL 2008 takes the assumption that the
> ranges will always be “downto” and positive range will be treated as
> integer portion and negative ranges as fractional portion. However
> according to LRM, the string literal “01010” will be assigned range
> from integer’low to integer’low + 5.
>
The problem here is "natural range" as opposed to "integer range", a
natural goes form 0 to 2_147_483_647. Integer range goes from
-2_147_483_647 to +2_147_483_647

Unsigned is "naturnal range", so if I assign "0100" to a natural, the
bottom has an index of "0"
For ufixed, which is "integer range" the bottom bit is -2_147_483_647,
making it a very small number.
I tried several different things, and I could not get around this one if
I wanted a negative index.
>
> So the usage of string literals along with ufixed/sfixed as in
> following examples could lead to null ranges and hence potential
> design issues which rtl designer didn’t intended.
>
> 1) `if out1 = "0111" then ` where out1 is ufixed(2 downto -1)
>
Will always return "false" because the ranes do not match.
>
> 2) `sig1 <= const1 + "0001001000";` where sig1 and const1 are sfixed
> types.
>
>
Will give you a VERY long "sig1"
>
> What is the behavior expected from compilers when string literals are
> used along with ufixed/sfixed? Does this really makes sense to use
> string literals directly with sfixed/ufixed.
>
That's the problem. Literals don't work with this package. I would so it
this way:
to_ufixed ("0111", out1'high, out1'low);

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Jun 3 13:02:17 2010

This archive was generated by hypermail 2.1.8 : Thu Jun 03 2010 - 13:02:44 PDT