Skip to content

Commit

Permalink
Handle enumeration subtypes in generic arguments. Issue #618
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Feb 12, 2023
1 parent 9ac84ce commit c35e8b5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/elab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1697,10 +1697,13 @@ static tree_t elab_generic_parse(tree_t generic, const char *str)
str, type_pp(type), istr(tree_ident(generic)));

if (type_is_enum(type)) {
type_t base = type_base_recur(type);
tree_t lit = type_enum_literal(base, value.integer);

tree_t result = tree_new(T_REF);
tree_set_type(result, type);
tree_set_ident(result, ident_new(str));
tree_set_ref(result, type_enum_literal(type, value.integer));
tree_set_ref(result, lit);

return result;
}
Expand Down
19 changes: 19 additions & 0 deletions test/regress/issue618.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
library ieee ;
use ieee.std_logic_1164.all ;

entity issue618 is
generic (
A : std_logic := '0' ;
B : std_logic := '1'
) ;
end entity;

architecture test of issue618 is
begin
p1: process is
begin
assert A = '1';
assert B = '0';
wait;
end process;
end architecture;
1 change: 1 addition & 0 deletions test/regress/testlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -720,3 +720,4 @@ implicit5 normal
cover12 cover,shell
issue612 normal,vhpi
force2 normal,2008
issue618 normal,gA='1',gB='0'

0 comments on commit c35e8b5

Please sign in to comment.