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.9 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_sequence is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_sequence;
  9. architecture psl of psl_sequence 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. -- Address phase sequence
  22. -- Don't works in synthesis, only in simulation
  23. sequence a_phase is {avalid; busy[->3]; adone};
  24. -- Data phase sequence
  25. -- Sequences can have parameters
  26. -- Don't works in synthesis, only in simulation
  27. sequence d_phase (boolean done) is {data[->3]; done};
  28. -- SERE concatenation operator
  29. -- RHS starts at one cycle cycle that the LHS ends
  30. -- This assertion holds
  31. SERE_0_a : assert always {req} |=> {a_phase; d_phase(ddone)};
  32. -- SERE concatenation operator
  33. -- RHS starts at one cycle cycle that the LHS ends
  34. -- This cover holds at cycle 7
  35. SERE_0_c : cover {req; a_phase} report "Address phase completed";
  36. -- SERE concatenation operator
  37. -- RHS starts at one cycle cycle that the LHS ends
  38. -- This cover holds at cycle 11
  39. SERE_1_c : cover {d_phase(ddone)} report "Data phase completed";
  40. -- Stop simulation after longest running sequencer is finished
  41. -- Simulation only code by using pragmas
  42. -- synthesis translate_off
  43. stop_sim(clk, 13);
  44. -- synthesis translate_on
  45. end architecture psl;