Verwendeter Programmcode in Studienarbeit für ESY1B zum Thema "Verifikation mit SystemVerilog und Python"
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.

counter_assertion.sv 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. module counter_assertion(clk, rst, data, updown, load, count);
  2. input logic clk, rst;
  3. input logic updown, load;
  4. input logic [3:0] data, count;
  5. property reset_prpty;
  6. @(posedge clk) rst |=> (count == 4'b0);
  7. endproperty
  8. sequence up_seq;
  9. !load && updown;
  10. endsequence
  11. sequence down_seq;
  12. !load && !updown;
  13. endsequence
  14. property up_count_prpty;
  15. @(posedge clk) disable iff(rst)
  16. up_seq |=> (count == ($past(count, 1) + 1'b1));
  17. endproperty
  18. property down_count_prpty;
  19. @(posedge clk) disable iff(rst)
  20. down_seq |=> (count == ($past(count, 1) - 1'b1));
  21. endproperty
  22. property count_Fto0_prpty;
  23. @(posedge clk) disable iff(rst)
  24. (!load && updown) && (count == 4'hF) |=> (count == 4'b0);
  25. endproperty
  26. property count_0toF_prpty;
  27. @(posedge clk) disable iff(rst)
  28. (!load && !updown) && (count == 4'b0) |=> (count == 4'hF);
  29. endproperty
  30. property load_prpty;
  31. @(posedge clk) disable iff(rst)
  32. load |=> (count == $past(data, 1));
  33. endproperty
  34. RST: assert property (reset_prpty);
  35. UP_COUNT: assert property (up_count_prpty);
  36. DOWN_COUNT: assert property (down_count_prpty);
  37. F2O: assert property (count_Fto0_prpty);
  38. O2F: assert property (count_0toF_prpty);
  39. LOAD: assert property (load_prpty);
  40. endmodule