From c35e8b5020003b3916f5dfe6846ed895833fc43c Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sun, 12 Feb 2023 22:04:59 +0000 Subject: [PATCH] Handle enumeration subtypes in generic arguments. Issue #618 --- src/elab.c | 5 ++++- test/regress/issue618.vhd | 19 +++++++++++++++++++ test/regress/testlist.txt | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/regress/issue618.vhd diff --git a/src/elab.c b/src/elab.c index ab9cd0800..1f0d0fa56 100644 --- a/src/elab.c +++ b/src/elab.c @@ -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; } diff --git a/test/regress/issue618.vhd b/test/regress/issue618.vhd new file mode 100644 index 000000000..3d285d80a --- /dev/null +++ b/test/regress/issue618.vhd @@ -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; diff --git a/test/regress/testlist.txt b/test/regress/testlist.txt index 8dc7e4e00..dd87cfc1b 100644 --- a/test/regress/testlist.txt +++ b/test/regress/testlist.txt @@ -720,3 +720,4 @@ implicit5 normal cover12 cover,shell issue612 normal,vhpi force2 normal,2008 +issue618 normal,gA='1',gB='0'