From 99cd9e61d58acd28dded11ef27f55e3ba955ae8c Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Fri, 13 Mar 2020 05:37:45 +0100 Subject: testsuite/synth: add a test for previous commit. --- testsuite/synth/const01/const03.vhdl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 testsuite/synth/const01/const03.vhdl (limited to 'testsuite/synth/const01/const03.vhdl') diff --git a/testsuite/synth/const01/const03.vhdl b/testsuite/synth/const01/const03.vhdl new file mode 100644 index 000000000..4ffd037f5 --- /dev/null +++ b/testsuite/synth/const01/const03.vhdl @@ -0,0 +1,24 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity const03 is + port (v : std_logic_vector (15 downto 0); + o : out std_logic_vector (3 downto 0)); +end const03; + +architecture behav of const03 is + function count (vec : std_logic_vector) return std_logic_vector + is + variable res : std_logic_vector (3 downto 0) := x"0"; + begin + for i in vec'range loop + if vec (i) = '1' then + res := std_logic_vector (unsigned(res) + 1); + end if; + end loop; + return res; + end count; +begin + o <= count(v); +end behav; -- cgit v1.2.3