Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Error --unconstrained record or array type is not supported

446 views
Skip to first unread message
Message has been deleted

Alan Fitch

unread,
Mar 12, 2009, 5:14:20 AM3/12/09
to
Zhey...@googlemail.com wrote:
> I was trying to compile the VHDL code with generic (Width:positive:=
> 8);
>
> In Quartus, I got the following error.
> Error (10427): VHDL aggregate error at GCD.vhd(49): OTHERS choice used
> in aggregate for unconstrained record or array type is not supported
<snip>

> -----------------------------------------------------------------
> library IEEE;
> use IEEE.STD_Logic_1164.all, IEEE.Numeric_STD.all;
> entity GCD is
> generic (Width:positive:= 8); ---I have also tried natural and
> integer, but all failed.
> port (Clock,Reset,Load: in std_logic;
> A,B: in unsigned(Width-1 downto 0);
> Done: out std_logic;
> Y: out unsigned(Width-1 downto 0));
> end entity GCD;
> architecture RTL of GCD is
> signal A_New,A_Hold,B_Hold: unsigned(Width-1 downto 0);
> signal A_lessthan_B: std_logic;
> begin
<snip>

> if (B_Hold = (others => '0')) then -- here is the error B_Hold =
> (others => '0')
> -------------------------------------------------------------------------------
> I also googled some topic about it, is it true that when using
> generics, B_Hold = (others => '0') OTHERS choice used in aggregate for
> unconstrained record or array type is not supported?

Yes it's true. The expression (others => '0') doesn't hold enough type
information to make the compiler happy.

There are various ways round this:

1. use a subtype, e.g.

subtype vecT is unsigned (width -1 downto 0);

...
if B_hold = VecT'(others => '0')

2. The other way is to use the aggregate itself by naming the aggregate
choices, e.g.

if B_hold = (Width -1 downto 0 => '0') then

I haven't tried these in Quartus,

regards
Alan
--
Alan Fitch
Doulos
http://www.doulos.com

Brian Drummond

unread,
Mar 12, 2009, 11:23:08 AM3/12/09
to
On Wed, 11 Mar 2009 19:03:50 -0700 (PDT), "Zhey...@googlemail.com"
<Zhey...@googlemail.com> wrote:

>I was trying to compile the VHDL code with generic (Width:positive:=
>8);
>
>In Quartus, I got the following error.
>Error (10427): VHDL aggregate error at GCD.vhd(49): OTHERS choice used
>in aggregate for unconstrained record or array type is not supported

> if (B_Hold = (others => '0')) then

-- here is the error

It is an error because you can overload "=" with an "=" operator which works on
different size operands (typically returning false if different size).
Therefore the parser cannot possibly know how many "others" there are.

The solution is to make the RHS operand explicitly the same size as the LHS
operand, whatever that size is.

One reliable way is simply
if (B_Hold = (B_Hold'range => '0')) then

- Brian

JimLewis

unread,
Mar 18, 2009, 2:29:41 PM3/18/09
to


Since B_hold is unsigned, you can take advantage of the overloading
and compare to an integer:

if B_hold = 0 then

Cheers,
Jim
SynthWorks VHDL Training
http://www.synthworks.com

0 new messages