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_rm.sv 927B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. class counter_rm;
  2. mailbox #(counter_trans) rm2sb, wrmon2rm;
  3. counter_trans wrmon2rm_h, temp_h;
  4. int count;
  5. function new(mailbox #(counter_trans) wrmon2rm, mailbox #(counter_trans) rm2sb);
  6. this.rm2sb = rm2sb;
  7. this.wrmon2rm = wrmon2rm;
  8. temp_h = new();
  9. endfunction
  10. task model();
  11. ++count;
  12. if(count > 1)
  13. begin
  14. temp_h.rst = wrmon2rm_h.rst;
  15. temp_h.load = wrmon2rm_h.load;
  16. temp_h.updown = wrmon2rm_h.updown;
  17. temp_h.data = wrmon2rm_h.data;
  18. if(wrmon2rm_h.rst)
  19. temp_h.data_out = 0;
  20. else if(wrmon2rm_h.load)
  21. temp_h.data_out = wrmon2rm_h.data;
  22. else if(wrmon2rm_h.updown)
  23. temp_h.data_out = ++temp_h.data_out;
  24. else if(!wrmon2rm_h.updown)
  25. temp_h.data_out = --temp_h.data_out;
  26. end
  27. endtask
  28. task start();
  29. fork
  30. forever
  31. begin
  32. wrmon2rm.get(wrmon2rm_h);
  33. rm2sb.put(temp_h);
  34. temp_h = new temp_h;
  35. model();
  36. end
  37. join_none
  38. endtask
  39. endclass :counter_rm