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.

64 lines
1.8 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_property is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_property;
  9. architecture psl of psl_property is
  10. signal req, avalid, busy, adone, data, ddone : std_logic;
  11. begin
  12. -- 01234567890123
  13. SEQ_REQ : sequencer generic map ("_-____________") port map (clk, req);
  14. SEQ_AVALID : sequencer generic map ("__-___________") port map (clk, avalid);
  15. SEQ_BUSY : sequencer generic map ("___-_--_______") port map (clk, busy);
  16. SEQ_ADONE : sequencer generic map ("_______-______") port map (clk, adone);
  17. SEQ_DATA : sequencer generic map ("________---___") port map (clk, data);
  18. SEQ_DDONE : sequencer generic map ("___________-__") port map (clk, ddone);
  19. -- All is sensitive to rising edge of clk
  20. default clock is rising_edge(clk);
  21. -- Transfer property
  22. -- Don't works in synthesis, only in simulation
  23. property transfer_3 is always (
  24. {req} |=> {{avalid; busy[->3]; adone}; {data[->3]; ddone}}
  25. );
  26. -- SERE concatenation operator
  27. -- RHS starts at one cycle cycle that the LHS ends
  28. -- This assertion holds
  29. PROP_0_a : assert transfer_3;
  30. -- Properties can have parameters
  31. -- Don't works in synthesis, only in simulation
  32. -- Parameters with repetition operators lead to crash:
  33. -- raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : no field Hash
  34. property transfer_3_p (boolean v, ad, dd) is always (
  35. {req} |=> {{v; busy[->3]; ad}; {data[->3]; dd}}
  36. );
  37. -- SERE concatenation operator
  38. -- RHS starts at one cycle cycle that the LHS ends
  39. -- This assertion holds
  40. PROP_1_a : assert transfer_3_p(avalid, adone, ddone);
  41. -- Stop simulation after longest running sequencer is finished
  42. -- Simulation only code by using pragmas
  43. -- synthesis translate_off
  44. stop_sim(clk, 13);
  45. -- synthesis translate_on
  46. end architecture psl;