AXI-Verification architecture, functional coverage and assertions based coverage code
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.

73 lines
1.9 KiB

  1. class axi_slave_p_mon extends uvm_monitor;
  2. `uvm_component_utils(axi_slave_p_mon)
  3. uvm_analysis_port #(axi_txn) ap;
  4. virtual axi_slave_if vif;
  5. axi_txn mon_txn;
  6. function new( string name = "axi_slave_p_mon", uvm_component parent = null);
  7. super.new(name, parent);
  8. ap = new("ap",this);
  9. mon_txn= new ("mon_txn");
  10. endfunction
  11. virtual function void build_phase(uvm_phase phase);
  12. super.build_phase(phase);
  13. if (!uvm_config_db#(virtual axi_slave_if)::get(this,"","vif",vif))
  14. begin
  15. `uvm_error( get_type_name(),"Not able to get AXI INTF HANDLE")
  16. end
  17. endfunction
  18. virtual task run_phase(uvm_phase phase);
  19. forever begin
  20. @(vif);
  21. //WA
  22. if (vif.awvalid == 1 && vif.awready == 1)begin
  23. mon_txn = axi_tx::type_id::create("mon_txn");
  24. mon_txn.awre = vif.awaddr;
  25. mon_txn.awlen = vif.awlen;
  26. mon_txn.awsize = vif.awsize;
  27. mon_txn.awburst = burst_type_t'(vif.mon_cb.awburst);
  28. tx.tx_id = vif.mon_cb.awid;
  29. num_writes = 0;
  30. end
  31. //WD
  32. if (vif.mon_cb.wvalid == 1 && vif.mon_cb.wready == 1)begin
  33. num_writes++;
  34. if (num_writes > 1)begin
  35. tx.dataQ.push_back(vif.mon_cb.wdata);
  36. end
  37. end
  38. //WR(B)
  39. if (vif.mon_cb.bvalid == 1 && vif.mon_cb.bready == 1)begin
  40. tx.resp = vif.mon_cb.bresp;
  41. ap_port.write(tx);
  42. end
  43. //RA
  44. if (vif.mon_cb.arvalid == 1 && vif.mon_cb.arready == 1)begin
  45. tx = axi_tx::type_id::create("tx");
  46. tx.wr_rd = 1'b0;
  47. tx.addr = vif.mon_cb.araddr;
  48. tx.burst_len = vif.mon_cb.arlen;
  49. tx.burst_size = vif.mon_cb.arsize;
  50. tx.burst_type = burst_type_t'(vif.mon_cb.arburst);
  51. tx.tx_id = vif.mon_cb.arid;
  52. num_reads = 0;
  53. end
  54. //RD
  55. if (vif.mon_cb.rvalid == 1 && vif.mon_cb.rready == 1)begin
  56. num_reads++;
  57. if(num_reads > 1)begin
  58. tx.dataQ.push_back(vif.mon_cb.rdata);
  59. end
  60. if (vif.mon_cb.rlast == 1)begin
  61. ap_port.write(tx);
  62. end
  63. end
  64. end
  65. endtask
  66. endclass