Last active
March 14, 2016 10:36
-
-
Save tmeissner/fd40f3d72a79d8c5d04d to your computer and use it in GitHub Desktop.
Test case of evaluating PSL endpoint & ended constructs in VHDL code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.numeric_std.all; | |
library std; | |
use std.env.all; | |
entity psl_test_endpoint is | |
end entity psl_test_endpoint; | |
architecture test of psl_test_endpoint is | |
signal s_rst_n : std_logic := '0'; | |
signal s_clk : std_logic := '0'; | |
signal s_write : std_logic; | |
signal s_read : std_logic; | |
begin | |
s_rst_n <= '1' after 100 ns; | |
s_clk <= not s_clk after 10 ns; | |
TestP : process is | |
begin | |
report "RUNNING psl_test_endpoint test case"; | |
report "=========================================="; | |
s_write <= '0'; | |
s_read <= '0'; | |
wait until s_rst_n = '1' and rising_edge(s_clk); | |
s_write <= '1'; | |
wait until rising_edge(s_clk); -- endpoint active | |
s_read <= '1'; | |
wait until rising_edge(s_clk); | |
s_write <= '0'; | |
s_read <= '0'; | |
wait until rising_edge(s_clk); | |
stop(0); | |
end process TestP; | |
-- sequence & endpoint definition | |
-- psl sequence S_TEST is {not(s_write); s_write}@rising_edge(s_clk); | |
-- psl endpoint E_TEST is S_TEST; | |
-- It's not possible to use endpoints on sequences VHDL code | |
EndpointP: process is | |
begin | |
wait until E_TEST; | |
report "TEST"; | |
wait; | |
end process EndpointP; | |
end architecture test; | |
library ieee; | |
use ieee.std_logic_1164.all; | |
use ieee.numeric_std.all; | |
library std; | |
use std.env.all; | |
entity psl_test_ended is | |
end entity psl_test_ended; | |
architecture test of psl_test_ended is | |
signal s_rst_n : std_logic := '0'; | |
signal s_clk : std_logic := '0'; | |
signal s_write : std_logic; | |
signal s_read : std_logic; | |
begin | |
s_rst_n <= '1' after 100 ns; | |
s_clk <= not s_clk after 10 ns; | |
TestP : process is | |
begin | |
report "RUNNING psl_test_ended test case"; | |
report "=========================================="; | |
s_write <= '0'; | |
s_read <= '0'; | |
wait until s_rst_n = '1' and rising_edge(s_clk); | |
s_write <= '1'; | |
wait until rising_edge(s_clk); -- sequence active | |
s_read <= '1'; | |
wait until rising_edge(s_clk); | |
s_write <= '0'; | |
s_read <= '0'; | |
wait until rising_edge(s_clk); | |
stop(0); | |
end process TestP; | |
-- sequence & endpoint definition | |
-- psl sequence S_TEST is {not(s_write); s_write}@rising_edge(s_clk); | |
-- It's not possible to use ended on sequences in VHDL code | |
EndedP: process is | |
begin | |
wait until ended(S_TEST); | |
report "TEST"; | |
wait; | |
end process EndedP; | |
end architecture test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The log from Modelsim DE 10.5, which supports evaluating enpoints & ended() in VHDL, looks like this: