diff options
Diffstat (limited to 'testsuite/synth/issue2408/bug.vhdl')
-rw-r--r-- | testsuite/synth/issue2408/bug.vhdl | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/testsuite/synth/issue2408/bug.vhdl b/testsuite/synth/issue2408/bug.vhdl new file mode 100644 index 000000000..179b30298 --- /dev/null +++ b/testsuite/synth/issue2408/bug.vhdl @@ -0,0 +1,39 @@ +library IEEE; +use IEEE.std_logic_1164.all; +use IEEE.std_logic_arith.all; + +entity bug is + generic( + LEN : positive := 32; + POS : natural := 10 + ); + port( + output : out signed(LEN-1 downto 0) + ); + + function GET_NUM_FUNC(n : natural) return integer is + variable result :integer; + begin + case n is + when 0 => result := 16#010020#; + when 1 => result := 16#020D30#; + when 2 => result := 16#00FC1#; + when 3 => result := 16#05010#; + when 4 => result := 16#02800#; + when 5 => result := 16#01400#; + when 6 => result := 16#002F#; + when 7 => result := 16#0508#; + when 8 => result := 16#0200#; + when 9 => result := 16#0100#; + when 10 => result := 16#0A0#; + when others => result := 16#0#; + end case; + return result; + end GET_NUM_FUNC; + +end bug; + +architecture behav of bug is +begin + output <= conv_signed(GET_NUM_FUNC(POS), LEN); +end architecture; |