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_env.sv 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. class counter_env;
  2. virtual counter_if.WR_BFM wr_if;
  3. virtual counter_if.WR_MON wrmon_if;
  4. virtual counter_if.RD_MON rdmon_if;
  5. mailbox #(counter_trans) gen2wr = new;
  6. mailbox #(counter_trans) wrmon2rm = new;
  7. mailbox #(counter_trans) rm2sb = new;
  8. mailbox #(counter_trans) rdmon2sb = new;
  9. counter_gen gen_h;
  10. counter_wr_bfm wr_h;
  11. counter_wr_mon wrmon_h;
  12. counter_rd_mon rdmon_h;
  13. counter_rm rm_h;
  14. counter_sb sb_h;
  15. function new( virtual counter_if.WR_BFM wr_if,
  16. virtual counter_if.WR_MON wrmon_if,
  17. virtual counter_if.RD_MON rdmon_if);
  18. this.wr_if = wr_if;
  19. this.wrmon_if = wrmon_if;
  20. this.rdmon_if = rdmon_if;
  21. endfunction
  22. task build();
  23. gen_h = new(gen2wr);
  24. wr_h = new(wr_if, gen2wr);
  25. wrmon_h = new(wrmon_if, wrmon2rm);
  26. rdmon_h = new(rdmon_if, rdmon2sb);
  27. rm_h = new(wrmon2rm, rm2sb);
  28. sb_h = new(rm2sb, rdmon2sb);
  29. endtask
  30. task reset();
  31. @(wr_if.wr_cb);
  32. wr_if.wr_cb.rst <= 1;
  33. @(wr_if.wr_cb);
  34. @(wr_if.wr_cb);
  35. @(wr_if.wr_cb);
  36. @(wr_if.wr_cb);
  37. @(wr_if.wr_cb);
  38. wr_if.wr_cb.rst <= 0;
  39. endtask
  40. task start();
  41. gen_h.start();
  42. wr_h.start();
  43. wrmon_h.start();
  44. rdmon_h.start();
  45. rm_h.start();
  46. sb_h.start();
  47. endtask
  48. task stop();
  49. wait(sb_h.DONE.triggered);
  50. endtask
  51. task run();
  52. reset();
  53. start();
  54. stop();
  55. sb_h.report();
  56. endtask
  57. endclass: counter_env