Replies: 1 comment
-
Does this really work with GHDL? I tried the following: entity ent is
generic (g : integer);
end entity;
architecture test of ent is
constant empty : bit_vector(g downto 0) := (g => '1', g - 1 downto 0 => '0');
begin
end architecture;
Questa also gives an error but looks like it can be suppressed. The problem with non-locally-static choices is that the compiler has to generate code to calculate the bounds of the aggregate at runtime as well as check that every element in that range has been given a value. If the aggregate only contains a single association then this is relatively simple which is why the LRM makes an exception for it. In this case you can use There was a bug I fixed a few weeks ago where generics were treated as locally static in some cases in 2008 mode which is why this was accepted before. But it's just chance that it worked: changing the choice expression slightly would have caused crashes.
I'm pretty sure this error is correct. See 6.5.4 "Interface subprogram declarations" in the 2008 LRM:
So the default has to denote a subprogram at the time the interface declaration is analysed, not when it is instantiated. The requirement for conforming profiles is actually stricter than NVC implements at the moment (i.e. it requires the parameter names to be the same, not just the types). You can make this work by using generic (
type G_DATA_TYPE;
function to_string (x : G_DATA_TYPE) return string is <>;
function G_TO_STRING(data : G_DATA_TYPE) return string is to_string ); |
Beta Was this translation helpful? Give feedback.
-
Hi @nickg
I updated our docker image from a september version of nvc to the latest one. Now I get analyzing errors with code I use since years without problems (with nvc, ghdl, Questa and synthesis):
FIFO_AWIDTH
is a generic in this context.This code was compiled by the older version of
nvc
(and all other tools I use, even synthesis). I can't workaround this error with therelaxed
option, so I have to change to code.The other error I get is with a generic function in a generic package:
This error is more clear to me as
nvc
obvously can't find ato_string()
function for the not yet definedG_DATA_TYPE
type. However, this code was also compiled by the older version ofnvc
(and all other simulation tools I use).So, would it be possible to add these things to work with the
relaxed
option? TheQueueP
package is use since years in a lot of projects. I fear that I have to change a lot of simulation code when I remove theis to_string
function predefine.Beta Was this translation helpful? Give feedback.
All reactions