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.

53 lines
1.4 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_logical_implication is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_logical_implication;
  9. architecture psl of psl_logical_implication is
  10. signal a, b, c, d : std_logic;
  11. begin
  12. -- 01234567890
  13. SEQ_A : sequencer generic map ("_-__-___-__") port map (clk, a);
  14. SEQ_B : sequencer generic map ("_-______-__") port map (clk, b);
  15. SEQ_C : sequencer generic map ("_-__-______") port map (clk, c);
  16. SEQ_D : sequencer generic map ("___________") port map (clk, d);
  17. -- All is sensitive to rising edge of clk
  18. default clock is rising_edge(clk);
  19. -- This assertion holds
  20. IMPLICATION_0_a : assert always (a -> b or c);
  21. -- This assertion doesn't hold at cycle 4
  22. IMPLICATION_1_a : assert always (a -> b and c);
  23. -- This assertion holds because RHS of implication always holds
  24. IMPLICATION_2_a : assert always (a -> true);
  25. -- This assertion doesn't hold at cycle 1 because RHS of implication never holds
  26. IMPLICATION_3_a : assert always (a -> false);
  27. -- This assertion holds because LHS of implication never holds
  28. IMPLICATION_4_a : assert always (d -> (a and b and c));
  29. -- Stop simulation after longest running sequencer is finished
  30. -- Simulation only code by using pragmas
  31. -- synthesis translate_off
  32. stop_sim(clk, 11);
  33. -- synthesis translate_on
  34. end architecture psl;