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.

54 lines
1.2 KiB

  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use work.pkg.all;
  4. entity psl_logical_iff is
  5. port (
  6. clk : in std_logic
  7. );
  8. end entity psl_logical_iff;
  9. architecture psl of psl_logical_iff is
  10. signal a, b, c : 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. -- All is sensitive to rising edge of clk
  17. default clock is rising_edge(clk);
  18. -- This assertion holds
  19. IFF_0_a : assert always (a <-> b or c);
  20. -- Equivalent but with logical implication operator
  21. -- This assertion holds
  22. IFF_1_a : assert always (a -> b or c) and (b or c -> a);
  23. -- This assertion doesn't hold at cycle 4
  24. IFF_2_a : assert always (a <-> b and c);
  25. -- This assertion doesn't hold at cycle 0
  26. IFF_3_a : assert always (a <-> true);
  27. -- This assertion doesn't hold at cycle 1
  28. IFF_4_a : assert always (a -> false);
  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;