aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1130/foo.vhdl
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/synth/issue1130/foo.vhdl')
-rw-r--r--testsuite/synth/issue1130/foo.vhdl30
1 files changed, 30 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;