From 82548be462091370f1fbd664c590bebe8f6f7096 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 12 Dec 2018 06:47:27 +0100 Subject: Add more test cases for #646 --- testsuite/gna/issue646/repro2.vhdl | 20 ++++++++++++++++++++ testsuite/gna/issue646/repro3.vhdl | 25 +++++++++++++++++++++++++ testsuite/gna/issue646/repro4.vhdl | 33 +++++++++++++++++++++++++++++++++ testsuite/gna/issue646/testsuite.sh | 10 ++++++++++ 4 files changed, 88 insertions(+) create mode 100644 testsuite/gna/issue646/repro2.vhdl create mode 100644 testsuite/gna/issue646/repro3.vhdl create mode 100644 testsuite/gna/issue646/repro4.vhdl (limited to 'testsuite/gna') diff --git a/testsuite/gna/issue646/repro2.vhdl b/testsuite/gna/issue646/repro2.vhdl new file mode 100644 index 000000000..80d59ace7 --- /dev/null +++ b/testsuite/gna/issue646/repro2.vhdl @@ -0,0 +1,20 @@ +entity repro2 is +end entity; + +architecture tb of repro2 is + + type tb_cfg_t is record + value : string; + end record tb_cfg_t; + + function get_msg return string is + begin + return "goodbye"; + end get_msg; + + constant tb_cfg: tb_cfg_t := ( value => get_msg ); +begin + assert tb_cfg.value > "a"; +end tb; + + diff --git a/testsuite/gna/issue646/repro3.vhdl b/testsuite/gna/issue646/repro3.vhdl new file mode 100644 index 000000000..7d02c25f4 --- /dev/null +++ b/testsuite/gna/issue646/repro3.vhdl @@ -0,0 +1,25 @@ +entity repro3 is +end entity; + +architecture tb of repro3 is + + type tb_cfg_t is record + value : string; + end record tb_cfg_t; + + function get_msg return string is + begin + return "goodbye"; + end get_msg; + + function init return tb_cfg_t is + begin + return (value => get_msg); + end init; + + constant tb_cfg: tb_cfg_t := init; +begin + assert tb_cfg.value > "a"; +end tb; + + diff --git a/testsuite/gna/issue646/repro4.vhdl b/testsuite/gna/issue646/repro4.vhdl new file mode 100644 index 000000000..8bd890df8 --- /dev/null +++ b/testsuite/gna/issue646/repro4.vhdl @@ -0,0 +1,33 @@ +entity repro4 is +end entity; + +architecture tb of repro4 is + + type channel is record + data : bit_vector; + ack : bit; + end record; + + type my_bus is record + rd : channel; + wr : channel; + end record; + + function init_channel (width : natural) return channel is + begin + return (data => (width - 1 downto 0 => '0'), + ack => '0'); + end init_channel; + + function init_bus (width : natural) return my_bus is + begin + return (rd => init_channel (width), + wr => init_channel (width)); + end init_bus; + + constant b : my_bus := init_bus (12); +begin + assert b.rd.data(2) = '0'; +end tb; + + diff --git a/testsuite/gna/issue646/testsuite.sh b/testsuite/gna/issue646/testsuite.sh index ca326e2f6..0c6fa9fa0 100755 --- a/testsuite/gna/issue646/testsuite.sh +++ b/testsuite/gna/issue646/testsuite.sh @@ -7,6 +7,16 @@ export GHDL_STD_FLAGS=--std=08 analyze repro.vhdl elab_simulate repro +# TODO: init value. +#analyze repro2.vhdl +#elab_simulate repro2 + +analyze repro3.vhdl +elab_simulate repro3 + +analyze repro4.vhdl +elab_simulate repro4 + clean echo "Test successful" -- cgit v1.2.3