Closed tmeissner closed 1 month ago
Here's a minimal way to reproduce it:
package QueueP is
generic (G_QUEUE_COUNT : positive := 1;
G_QUEUE_DEPTH : positive := 4096 / 8 + 5;
type G_DATA_TYPE;
function G_TO_STRING(data : G_DATA_TYPE) return string is to_string);
subtype t_queue_count is natural range 0 to G_QUEUE_COUNT - 1;
procedure test (x : t_queue_count);
end package QueueP;
package body QueueP is
procedure test (x : t_queue_count) is
begin
end procedure;
end package body;
-------------------------------------------------------------------------------
package pack is
constant C_QUEUE_COUNT : positive := 4;
constant C_QUEUE_MAX_SIZE : positive := 65535;
package C2hQueue is new work.QueueP
generic map (G_QUEUE_COUNT => C_QUEUE_COUNT,
G_QUEUE_DEPTH => C_QUEUE_MAX_SIZE,
G_DATA_TYPE => bit_vector(7 downto 0),
G_TO_STRING => to_string);
end package;
-------------------------------------------------------------------------------
entity issue894 is
end entity;
use work.pack.all;
architecture test of issue894 is
begin
tb: process is
variable v : natural;
begin
C2hQueue.test(v);
wait;
end process;
end architecture;
@tmeissner please test again with the latest master branch.
Thanks. The reported error is gone now. Now I get another error with my DUT design, I'll open a separate issue for that.
The strange thing is, that the new error is emitted for a file which is analyzed before the file caused this issue here 🧐 So I'm not really sure if the fix really works, as the file isn't analyzed anymore now.
The error I got now with another file, even before analyzing the package above:
nvc --std=19 --work=work -L ./ -a ../../src/QueueHandlingE.vhd
** Fatal: type kind T_INTEGER does not have item I_ELEM
[0x5612f8a3a8e9] ../src/object.c:254 object_lookup_failed
[0x5612f8a34224] ../src/type.c:329 type_elem.cold
[0x5612f8a556cd] ../src/parse.c:1946 get_subtype_for.lto_priv.0
[0x5612f8a5bfcd] ../src/parse.c:1990 apply_subtype_attribute
[0x5612f8a5bfcd] ../src/parse.c:2101 apply_type_attribute
[0x5612f8a5bfcd] ../src/parse.c:3287 p_attribute_name
[0x5612f8a5d3af] ../src/parse.c:3719 p_name.lto_priv.0
[0x5612f8a5add6] ../src/parse.c:4382 p_primary.lto_priv.0
[0x5612f8a5f84e] ../src/parse.c:4480 p_factor
[0x5612f8a5fbb9] ../src/parse.c:4519 p_term
[0x5612f8a5fe8d] ../src/parse.c:4574 p_simple_expression
[0x5612f8a6022a] ../src/parse.c:4612 p_shift_expression
[0x5612f8a606b9] ../src/parse.c:1505 p_relation
[0x5612f8a5a65a] ../src/parse.c:4693 p_expression_with_head.lto_priv.0
[0x5612f8a5aa2a] ../src/parse.c:4731 p_expression
[0x5612f8a5aa2a] ../src/parse.c:4259 p_aggregate_or_expression
[0x5612f8a5af8d] ../src/parse.c:4368 p_primary.lto_priv.0
[0x5612f8a5f84e] ../src/parse.c:4480 p_factor
[0x5612f8a5fbb9] ../src/parse.c:4519 p_term
[0x5612f8a5fe8d] ../src/parse.c:4574 p_simple_expression
[0x5612f8a6022a] ../src/parse.c:4612 p_shift_expression
[0x5612f8a60579] ../src/parse.c:4669 p_relation
[0x5612f8a5a65a] ../src/parse.c:4693 p_expression_with_head.lto_priv.0
[0x5612f8a63a9a] ../src/parse.c:4731 p_expression
[0x5612f8a63a9a] ../src/parse.c:6782 p_condition.lto_priv.0
[0x5612f8a76a5d] ../src/parse.c:9848 p_if_statement
[0x5612f8a76a5d] ../src/parse.c:10286 p_sequential_statement.lto_priv.0
[0x5612f8a6c80f] ../src/parse.c:8059 p_sequence_of_statements.lto_priv.0
[0x5612f8a6e523] ../src/parse.c:8122 p_subprogram_body.lto_priv.0
[0x5612f8a728d7] ../src/parse.c:9285 p_block_declarative_item.lto_priv.0
[0x5612f8a7e549] ../src/parse.c:12585 p_architecture_body
[0x5612f8a7e549] ../src/parse.c:12857 p_secondary_unit
[0x5612f8a7ee07] ../src/parse.c:12883 p_design_unit
[0x5612f8a7ee07] ../src/parse.c:12997 parse
[0x5612f8abb8e2] ../src/common.c:2421 analyse_file.part.0
[0x5612f8a45beb] ../src/nvc.c:2415 analyse
[0x5612f8a45beb] ../src/common.c:1920 process_command
[0x5612f8a414d6] ../src/nvc.c:2060 main
Please report this bug at https://github.com/nickg/nvc/issues
This does not occur with older versions of nvc before the latest commits.
The error I got now with another file, even before analyzing the package above:
I think this should be fixed now, could you test again?
This is fixed now, thanks for your efforts 👌
I have a strange error when creating an instance of a generic package. When I give a parameter an integer literal, it works. When I give the parameter an constant of the same integer, it creates an nvc error like this:
I wasn't able to create a MWE yet. The generic package instances are created in another package, here is an excerpt:
The public part of the QueueP package is as follows:
nvc Version:
I will post the code of an MWE if I'm successful to create one.