Trying to verify Verilog/VHDL designs with formal methods and tools
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.1 KiB

  1. module counter_t (
  2. input Reset_n_i,
  3. input Clk_i,
  4. output [31:0] Data_o
  5. );
  6. `define INIT_VALUE 8
  7. counter #(.Init(`INIT_VALUE)) counter_i (
  8. .Reset_n_i(Reset_n_i),
  9. .Clk_i(Clk_i),
  10. .Data_o(Data_o)
  11. );
  12. reg init_state = 1;
  13. // Initial reset
  14. always @(*) begin
  15. if (init_state) assume (!Reset_n_i);
  16. if (!init_state) assume (Reset_n_i);
  17. end
  18. always @(posedge Clk_i)
  19. init_state = 0;
  20. /*
  21. // Don't works with Verific at the moment
  22. initial begin
  23. assume (!Reset_n_i);
  24. end
  25. */
  26. // Intermediate assertions
  27. always @(*)
  28. if (!Reset_n_i) assert (Data_o == `INIT_VALUE);
  29. // Fail with unbounded prove using SMTBMC, maybe the assertions have to be more strict
  30. // there have to be more restrictions.
  31. // With abc pdr is can be successfully proved
  32. assert property (@(posedge Clk_i) Data_o >= `INIT_VALUE && Data_o <= 64);
  33. assert property (@(posedge Clk_i) disable iff (!Reset_n_i) Data_o < 64 |=> Data_o == $past(Data_o) + 1);
  34. assert property (@(posedge Clk_i) disable iff (!Reset_n_i) Data_o == 64 |=> $stable(Data_o));
  35. endmodule