aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/synth/issue1130/foo.vhdl
blob: 87e0dfc2f3f03eec18a8ad731c00334232e947d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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;