diff options
author | Tristan Gingold <tgingold@free.fr> | 2021-11-21 08:21:24 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2021-11-21 08:21:24 +0100 |
commit | a76a041d967d05a3b59da7c454a8cbbe2c802989 (patch) | |
tree | 0e11ab16fa0fa2107c39b4ba37451a8b29c14471 /testsuite/synth/issue1920/ent2.vhdl | |
parent | 0ce499a09bc3403114d9a1ac8989f29790a64967 (diff) | |
download | ghdl-a76a041d967d05a3b59da7c454a8cbbe2c802989.tar.gz ghdl-a76a041d967d05a3b59da7c454a8cbbe2c802989.tar.bz2 ghdl-a76a041d967d05a3b59da7c454a8cbbe2c802989.zip |
testsuite/synth: add a test for #1920
Diffstat (limited to 'testsuite/synth/issue1920/ent2.vhdl')
-rw-r--r-- | testsuite/synth/issue1920/ent2.vhdl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/synth/issue1920/ent2.vhdl b/testsuite/synth/issue1920/ent2.vhdl new file mode 100644 index 000000000..f524c0469 --- /dev/null +++ b/testsuite/synth/issue1920/ent2.vhdl @@ -0,0 +1,30 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity ent is + port ( + inputs : in std_logic; + result : out std_logic + ); +end entity; + +architecture synth of ent is + + function local_func(A : std_logic) return std_logic is + begin + return A; + end function; + + -- With this line + -- As expected, GHDL emits a good enough error message: cannot use signal value during elaboration + constant C : std_logic := inputs; + + -- But with this line, which is erroneous code, because a constant cannot be computed from a non-constant + -- GHDL crashes with an assertion: raised CONSTRAINT_ERROR : netlists-builders.adb:791 access check failed + --constant C : std_logic := local_func(inputs); + +begin + + result <= C; + +end architecture; |