From 5eeeb1bbd49c90cb89d1bc9df08e2028143cde01 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 10 Feb 2020 18:30:49 +0100 Subject: testsuite/synth: add testcase for #1130 --- testsuite/synth/issue1130/foo.vhdl | 30 ++++++++++++++++++++++++++++++ testsuite/synth/issue1130/testsuite.sh | 11 +++++++++++ 2 files changed, 41 insertions(+) create mode 100644 testsuite/synth/issue1130/foo.vhdl create mode 100755 testsuite/synth/issue1130/testsuite.sh diff --git a/testsuite/synth/issue1130/foo.vhdl b/testsuite/synth/issue1130/foo.vhdl new file mode 100644 index 000000000..87e0dfc2f --- /dev/null +++ b/testsuite/synth/issue1130/foo.vhdl @@ -0,0 +1,30 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity foo is + port ( encoded : in integer); +end; + +architecture foo of foo is + type some_type is (foo, bar, baz); + + function decode( constant v : integer ) return some_type is + begin + return some_type'val(v); + end; + + function decode( constant v : string ) return some_type is + begin + return some_type'value(v); + end; + + signal decoded_from_slv : some_type; + signal decoded_from_string : some_type; + +begin + + decoded_from_slv <= decode(encoded); + decoded_from_string <= decode(string'("foo")); + +end; diff --git a/testsuite/synth/issue1130/testsuite.sh b/testsuite/synth/issue1130/testsuite.sh new file mode 100755 index 000000000..9e68d3bed --- /dev/null +++ b/testsuite/synth/issue1130/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +for t in foo; do + synth $t.vhdl -e $t > syn_$t.vhdl + analyze syn_$t.vhdl + clean +done + +echo "Test successful" -- cgit v1.2.3