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.

42 lines
754 B

  1. module counter_t (
  2. input Reset_n_i,
  3. input Clk_i,
  4. input [31:0] Data_i,
  5. output [31:0] Data_o
  6. );
  7. `define INIT_VALUE 8
  8. counter #(.Init(`INIT_VALUE)) counter_i (
  9. .Reset_n_i(Reset_n_i),
  10. .Clk_i(Clk_i),
  11. .Data_o(Data_o)
  12. );
  13. reg init_state = 1;
  14. always @(*)
  15. if (init_state) assume (!Reset_n_i);
  16. always @(posedge Clk_i)
  17. init_state = 0;
  18. /*
  19. // Don't works with Verific at the moment
  20. initial begin
  21. assume (!Reset_n_i);
  22. end
  23. */
  24. // Proves fail, counterexample hasn't initial reset active
  25. assert property (@(posedge Clk_i) Data_o >= `INIT_VALUE && Data_o <= 64);
  26. assert property (@(posedge Clk_i) disable iff (!Reset_n_i) Data_o < 64 |=> Data_o == $past(Data_o) + 1);
  27. endmodule