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.

51 lines
1.7 KiB

  1. class axi_master extends uvm_agent;
  2. `uvm_component_utils(axi_master)
  3. // Components
  4. uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH)) w_seqr;
  5. uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH)) r_seqr;
  6. axi_m_driver drv;
  7. axi_m_monitor mon;
  8. uvm_analysis_port#(axi_transaction#(D_WIDTH, A_WIDTH)) ap;
  9. // Variables
  10. env_config env_cfg;
  11. function new(string name, uvm_component parent);
  12. super.new(name, parent);
  13. endfunction //new()
  14. // Function: build_phase
  15. extern function void build_phase(uvm_phase phase);
  16. // Function: connect_phase
  17. extern function void connect_phase(uvm_phase phase);
  18. endclass //axi_master extends uvm_agent
  19. function void axi_master::build_phase(uvm_phase phase);
  20. env_cfg = new("env_cfg");
  21. assert (uvm_config_db#(env_config)::get(this, "", "config", env_cfg)) begin
  22. `uvm_info(get_name(), "vif has been found in ConfigDB.", UVM_LOW)
  23. end else `uvm_fatal(get_name(), "vif cannot be found in ConfigDB!")
  24. drv = axi_m_driver::type_id::create("drv", this);
  25. mon = axi_m_monitor::type_id::create("mon", this);
  26. w_seqr = uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH))::type_id::create("w_seqr", this);
  27. r_seqr = uvm_sequencer#(axi_transaction#(D_WIDTH, A_WIDTH))::type_id::create("r_seqr", this);
  28. drv.vif = env_cfg.intf;
  29. mon.vif = env_cfg.intf;
  30. ap = new("ap", this);
  31. endfunction: build_phase
  32. function void axi_master::connect_phase(uvm_phase phase);
  33. super.connect_phase(phase);
  34. drv.seq_item_port.connect(w_seqr.seq_item_export);
  35. drv.seq_item_port2.connect(r_seqr.seq_item_export);
  36. mon.ap.connect(ap);
  37. endfunction: connect_phase