diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-02-10 18:30:49 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-02-10 18:30:49 +0100 |
commit | 5eeeb1bbd49c90cb89d1bc9df08e2028143cde01 (patch) | |
tree | 84f1fd296947edcf840c1ce781bf0dad5fbfc653 /testsuite | |
parent | 341fb38309af36e4a335656f988e3f5859b86f37 (diff) | |
download | ghdl-5eeeb1bbd49c90cb89d1bc9df08e2028143cde01.tar.gz ghdl-5eeeb1bbd49c90cb89d1bc9df08e2028143cde01.tar.bz2 ghdl-5eeeb1bbd49c90cb89d1bc9df08e2028143cde01.zip |
testsuite/synth: add testcase for #1130
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/synth/issue1130/foo.vhdl | 30 | ||||
-rwxr-xr-x | testsuite/synth/issue1130/testsuite.sh | 11 |
2 files changed, 41 insertions, 0 deletions
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" |