aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/formal/gates/test_pmux.vhd
blob: b3901f41dd76a7fe966b8184e6518f2089015a1f (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
39
40
41
42
43
44
45
46
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity ent is
	port (
		clk : in std_logic;
		a : in std_logic_vector(1 downto 0);
		b : out std_logic_vector(1 downto 0)
	);
end entity;

architecture a of ent is
begin
	process(clk)
	begin
		if rising_edge(clk) then
			case a is
				when "00" =>
					b <= "01";
				when "01" =>
					b <= "10";
				when "11" =>
					b <= "00";
				when others =>
					b <= "11";
			end case;
		end if;
	end process;

	formal: block
		signal has_run : std_logic := '0';
		signal prev_a : std_logic_vector(1 downto 0);
	begin
		process(clk)
		begin
			if rising_edge(clk) then
				prev_a <= a;
				has_run <= '1';
			end if;
		end process;

		default clock is rising_edge(clk);
		assert always has_run -> unsigned(prev_a) + 1 = unsigned(b);
	end block;
end architecture;