aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue529/impure1.vhdl
blob: 7cd3181d2e9344701caf240453a08f97ab6bdec3 (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
31
32
33
34
35
36
37
38
library ieee;
   use ieee.std_logic_1164.all;

entity impure_ex is
port (
   clk : in  std_logic;
   arg : in  std_logic;
   res : out std_logic
);
end impure_ex;

architecture rtl of impure_ex is

   -- An impure function called from a combinatorial process with "all" 
   -- sensitivity triggers an exception.
   impure function foo return std_logic is
   begin
      return arg;
   end function foo;

   signal ns : std_logic;

begin

   --comb_process : process(res) -- this works
   comb_process : process(all)
   begin
      ns <= res XOR foo;
   end process;

   process(clk)
   begin
      if rising_edge(clk) then
         res <= ns;
      end if;
   end process;

end rtl;