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_sb.sv 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class counter_sb;
  2. mailbox #(counter_trans) rm2sb, rdmon2sb;
  3. event DONE;
  4. int count_transaction, data_verified;
  5. counter_trans cov_h, rcvd_h;
  6. covergroup counter_cov;
  7. option.per_instance = 1;
  8. RST: coverpoint cov_h.rst {bins r[] = {0,1};}
  9. LD: coverpoint cov_h.load {bins l[] = {0,1};}
  10. UD: coverpoint cov_h.updown {bins ud[] = {0,1};}
  11. DATA: coverpoint cov_h.data {bins d[] = {[0:15]};}
  12. DOUT: coverpoint cov_h.data_out {bins dout[] = {[0:15]};}
  13. LDxDATA: cross LD, DATA;
  14. UDxDOUT: cross UD, DOUT;
  15. RSTxLDxDATA: cross RST, LD, DATA;
  16. RSTxLDxUD: cross RST, LD, UD;
  17. endgroup
  18. function new(mailbox #(counter_trans) rm2sb, mailbox #(counter_trans) rdmon2sb);
  19. this.rm2sb = rm2sb;
  20. this.rdmon2sb = rdmon2sb;
  21. counter_cov = new();
  22. endfunction
  23. task start;
  24. fork
  25. forever
  26. begin
  27. rm2sb.get(rcvd_h);
  28. cov_h = rcvd_h;
  29. counter_cov.sample();
  30. //--------------------//
  31. rdmon2sb.get(cov_h);
  32. check(rcvd_h);
  33. end
  34. join_none
  35. endtask
  36. task check(counter_trans rcvd_h);
  37. count_transaction++;
  38. if(cov_h.compare(rcvd_h))
  39. begin
  40. counter_cov.sample();
  41. data_verified++;
  42. end
  43. if(count_transaction >= no_of_transaction)
  44. ->DONE;
  45. endtask
  46. function void report;
  47. $display("--------------SCOREBOARD REPORT----------------");
  48. $display("Number of transactions received : %0d", count_transaction);
  49. $display("Number of transactions verified : %0d", data_verified);
  50. $display("-----------------------------------------------");
  51. endfunction
  52. endclass :counter_sb