您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

45 行
1.3 KiB

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