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.

82 lines
2.3 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_before is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_before;
  9. architecture psl of psl_before is
  10. signal a, b : std_logic;
  11. signal c, d : std_logic;
  12. signal e, f : std_logic;
  13. begin
  14. -- 01234567890
  15. SEQ_A : sequencer generic map ("_-____-____") port map (clk, a);
  16. SEQ_B : sequencer generic map ("___-_____-_") port map (clk, b);
  17. -- 01234567890
  18. SEQ_C : sequencer generic map ("_-___-_____") port map (clk, c);
  19. SEQ_D : sequencer generic map ("_____-___-_") port map (clk, d);
  20. -- 01234567890
  21. SEQ_E : sequencer generic map ("_-____-____") port map (clk, e);
  22. SEQ_F : sequencer generic map ("_-_______-_") port map (clk, f);
  23. -- All is sensitive to rising edge of clk
  24. default clock is rising_edge(clk);
  25. -- This assertion holds
  26. BEFORE_0_a : assert always (a -> next (b before a));
  27. -- This assertion doesn't hold at cycle 5
  28. BEFORE_1_a : assert always (c -> next (d before c));
  29. -- This assertion doesn't hold at cycle 6
  30. BEFORE_2_a : assert always (e -> next (f before e));
  31. -- This is flawed variant of the former assertion
  32. -- because even in cycle 1 the b before a property has
  33. -- to hold, which is clearly not what we want
  34. -- This assertion doesn't hold at cycle 1
  35. -- Furthermore this assertion leads to a GHDL synthesis crash with bug report
  36. -- BEFORE_3_a : assert always (a -> (b before a));
  37. -- This assertion should hold but does not at cycle 3
  38. -- Potential GHDL bug?
  39. BEFORE_4_a : assert always (a -> next (b before_ a));
  40. -- This assertion should hold but does not at cycle 9
  41. -- Potential GHDL bug?
  42. BEFORE_5_a : assert always (c -> next (d before_ c));
  43. -- This assertion doesn't at cycle 6
  44. BEFORE_6_a : assert always (e -> next (f before_ e));
  45. -- This assertion holds
  46. BEFORE_7_a : assert always (a -> (b or next (b before a)));
  47. -- This assertion doesn't hold at cycle 5
  48. BEFORE_8_a : assert always (c -> (d or next (d before c)));
  49. -- This assertion holds
  50. BEFORE_9_a : assert always (e -> (f or next (f before e)));
  51. -- Stop simulation after longest running sequencer is finished
  52. -- Simulation only code by using pragmas
  53. -- synthesis translate_off
  54. stop_sim(clk, 11);
  55. -- synthesis translate_on
  56. end architecture psl;