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.

67 lines
2.3 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_sere_or is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_sere_or;
  9. architecture psl of psl_sere_or is
  10. signal req2, req4, busy, valid, done : std_logic;
  11. signal req, wen, ends : std_logic;
  12. begin
  13. -- 0123456789012345678
  14. SEQ_REQ2 : sequencer generic map ("_-_________________") port map (clk, req2);
  15. SEQ_REQ4 : sequencer generic map ("________-__________") port map (clk, req4);
  16. SEQ_BUSY : sequencer generic map ("__----___--------__") port map (clk, busy);
  17. SEQ_VALID : sequencer generic map ("___-_-____-_-_-_-__") port map (clk, valid);
  18. SEQ_DONE : sequencer generic map ("______-__________-_") port map (clk, done);
  19. -- 01234567890123456789
  20. SEQ_REQ : sequencer generic map ("_-_______-__________") port map (clk, req);
  21. SEQ_WEN : sequencer generic map ("___-_-_____-_-_-_-__") port map (clk, wen);
  22. SEQ_ENDS : sequencer generic map ("_______-__________-_") port map (clk, ends);
  23. -- All is sensitive to rising edge of clk
  24. default clock is rising_edge(clk);
  25. -- Transfer started by req2 with 2 valids has to be finished by done
  26. -- This assertion holds
  27. SERE_0_a : assert always {req2 ; {valid[->2]} && {busy and not done}[+]} |=> {not busy and done};
  28. -- Transfer started by req4 with 4 valids has to be finished by done
  29. -- This assertion holds
  30. SERE_1_a : assert always {req4 ; {valid[->4]} && {busy and not done}[+]} |=> {not busy and done};
  31. -- SERE or operator
  32. -- Combination of both assertions above
  33. -- This assertion holds
  34. SERE_2_a : assert always {{req2; {valid[->2]} && {busy and not done}[+]} |
  35. {req4; {valid[->4]} && {busy and not done}[+]}} |=>
  36. {not busy and done};
  37. -- SERE or operator
  38. -- Transfer started by req has to have 2 or 4 cycles write cycles, finished by ends
  39. -- This assertion holds
  40. SERE_3_a : assert always {req} |=>
  41. {{{wen[=2]} && {not ends[+]}} |
  42. {{wen[=4]} && {not ends[+]}}; ends};
  43. -- Stop simulation after longest running sequencer is finished
  44. -- Simulation only code by using pragmas
  45. -- synthesis translate_off
  46. stop_sim(clk, 20);
  47. -- synthesis translate_on
  48. end architecture psl;