From b47d09862f3c05e8827ac5a39880a5303f3ba767 Mon Sep 17 00:00:00 2001 From: Tristan Gingold <tgingold@free.fr> Date: Mon, 6 Aug 2018 07:16:48 +0200 Subject: Add testcase for #616 --- testsuite/gna/issue616/mwe.vhdl | 76 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 testsuite/gna/issue616/mwe.vhdl (limited to 'testsuite/gna/issue616/mwe.vhdl') diff --git a/testsuite/gna/issue616/mwe.vhdl b/testsuite/gna/issue616/mwe.vhdl new file mode 100644 index 000000000..c791e1218 --- /dev/null +++ b/testsuite/gna/issue616/mwe.vhdl @@ -0,0 +1,76 @@ +library ieee; +use ieee.std_logic_1164.all; + +entity mwe is + generic ( + wait_us : integer := 400; + clk_period : time := 10 ns + ); +end entity; + +architecture sim of mwe is + + signal clk : std_logic := '0'; + signal runsim : boolean := true; + + function slv_all(constant width : in integer; constant value : in std_logic) return std_logic_vector is + variable slv_v : std_logic_vector(width - 1 downto 0) := (others => value); + begin + return slv_v; + end function; + + function slv_ones(constant width : in integer) return std_logic_vector is + begin + return slv_all(width, '1'); + end function; + + +begin + + p_clk: process + begin + while runsim loop + clk <= '0'; + wait for clk_period / 2; + clk <= '1'; + wait for clk_period / 2; + end loop; + wait; + end process; + + + p_check_requests: process + + function return_true return boolean is + constant ones_c : std_logic_vector(31 downto 0) := slv_ones(32); + begin + return true; + end function; + + variable ones_v : std_logic_vector(31 downto 0); + variable result_v : boolean; + begin + wait until rising_edge(clk); + + while runsim loop + wait until rising_edge(clk); + + result_v := return_true; + + -- uncommenting the following lines speeds up the design + -- ones_v := slv_ones(32); + + end loop; + + wait; + end process; + + + p_main: process + begin + wait for wait_us * 1 us; + runsim <= false; + wait; + end process; + +end architecture; -- cgit v1.2.3