aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/formal/gates/test_abs.vhd
blob: 3e711b2e570697741efe5b8f4c3118112aaa4d3e (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
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

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

architecture a of ent is
begin
	process(clk)
	begin
		if rising_edge(clk) then
			b <= abs a;
		end if;
	end process;

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

		default clock is rising_edge(clk);
		assert always has_run -> b >= 0 or (last_a = x"80" and last_a = b);
	end block;
end;