diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-07-28 15:33:30 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-07-28 17:39:43 +0200 |
commit | 4cf890dac121dc977fc4507168b48e47aecf5c46 (patch) | |
tree | 35f53140121d1d2eb6e0412f994b31d8562b2a43 /tests/sva/vhdlpsl00.vhd | |
parent | 5a828fff34ae8e0da7d887232daa516db1e37a21 (diff) | |
download | yosys-4cf890dac121dc977fc4507168b48e47aecf5c46.tar.gz yosys-4cf890dac121dc977fc4507168b48e47aecf5c46.tar.bz2 yosys-4cf890dac121dc977fc4507168b48e47aecf5c46.zip |
Add simple VHDL+PSL example
Diffstat (limited to 'tests/sva/vhdlpsl00.vhd')
-rw-r--r-- | tests/sva/vhdlpsl00.vhd | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/sva/vhdlpsl00.vhd b/tests/sva/vhdlpsl00.vhd new file mode 100644 index 000000000..6d765d5a9 --- /dev/null +++ b/tests/sva/vhdlpsl00.vhd @@ -0,0 +1,34 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_unsigned.all; +use ieee.numeric_std.all; + +entity top is + port ( + clk : in std_logic; + rst : in std_logic; + up : in std_logic; + down : in std_logic; + cnt : buffer std_logic_vector(7 downto 0) + ); +end entity; + +architecture rtl of top is +begin + process (clk) begin + if rising_edge(clk) then + if rst = '1' then + cnt <= std_logic_vector(to_unsigned(0, 8)); + elsif up = '1' then + cnt <= cnt + std_logic_vector(to_unsigned(1, 8)); + elsif down = '1' then + cnt <= cnt - std_logic_vector(to_unsigned(1, 8)); + end if; + end if; + end process; + + -- PSL default clock is (rising_edge(clk)); + -- PSL assume always ( down -> not up ); + -- PSL assert always ( up |=> (cnt = prev(cnt) + std_logic_vector(to_unsigned(1, 8))) ) abort rst = '1'; + -- PSL assert always ( down |=> (cnt = prev(cnt) - std_logic_vector(to_unsigned(1, 8))) ) abort rst = '1'; +end architecture; |