Examples of using PSL for functional and formal verification of VHDL with GHDL (and SymbiYosys)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_abort is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_abort;
  9. architecture psl of psl_abort is
  10. signal a, b, c, d : std_logic;
  11. begin
  12. -- Creating an abort signal which is asynchronously set & reset
  13. d <= '0', '1' after 1100 ps, '0' after 1400 ps;
  14. -- 0123456789
  15. SEQ_A : sequencer generic map ("-___-_____") port map (clk, a);
  16. SEQ_B : sequencer generic map ("_______-__") port map (clk, b);
  17. SEQ_C : sequencer generic map ("-_________") port map (clk, c);
  18. -- D : _|________
  19. -- All is sensitive to rising edge of clk
  20. default clock is rising_edge(clk);
  21. -- This assertion doesn't hold at cycle 4
  22. WITHOUT_ABORT_a : assert (always a -> next (b before a));
  23. -- This assertion holds
  24. WITH_ABORT_0_a : assert (always a -> next (b before a)) abort c;
  25. -- In simulation this assertion should also hold, but it does not
  26. -- GHDL seemed to implement abort as sync_abort instead of async_abort
  27. -- See 1850-2010 6.2.1.5.1 abort, async_abort and sync_abort
  28. -- In formal this assertion fails at cycle 4 as d is 0 all the time
  29. -- Is fixed now, see issue ghdl/ghdl#1654
  30. WITH_ABORT_1_a : assert (always a -> next (b before a)) abort d;
  31. -- async_abort is similar to abort
  32. -- In formal this assertion fails at cycle 4 as d is 0 all the time
  33. WITH_ABORT_2_a : assert (always a -> next (b before a)) async_abort d;
  34. -- sync_abort is working on synchronously events
  35. -- This assertion holds
  36. WITH_ABORT_3_a : assert (always a -> next (b before a)) sync_abort c;
  37. -- Stop simulation after longest running sequencer is finished
  38. -- Simulation only code by using pragmas
  39. -- synthesis translate_off
  40. stop_sim(clk, 12);
  41. -- synthesis translate_on
  42. end architecture psl;