微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > 求助:在连接seq_item_port与seq_item_export时出错

求助:在连接seq_item_port与seq_item_export时出错

时间:10-02 整理:3721RD 点击:

各位:
目前正在学习UVM,在agent中将driver的seq_item_port与sequencer的seq_item_export连接起来的时候,nc报错TYCMPAT,大致是说类型不一致?可是port与export相连会类型不一致么,这个问题还是第一次碰到,有没有高手能帮忙解答一下?
相关代码如下:
axi_master_agent:

  1. class axi_master_agent extends uvm_agent;
  2. axi_configcfg;
  3. axi_master_write_sequencerwrite_sequencer;
  4. axi_master_write_driverwrite_driver;

  5. `uvm_component_utils_begin(axi_master_agent)
  6. `uvm_field_enum(uvm_active_passive_enum,is_active,UVM_DEFAULT)
  7. `uvm_field_object(cfg,UVM_DEFAULT|UVM_REFERENCE)
  8. `uvm_component_utils_end

  9. function new (string name ,uvm_component parent);
  10. super.new(name,parent);
  11. endfunction : new

  12. extern virtual function void build_phase(uvm_phase phase);
  13. extern virtual function void connect_phase(uvm_phase phase);
  14. extern virtual function void update_config(input axi_config cfg);

  15. endclass : axi_master_agent

  16. function void axi_master_agent::build_phase(uvm_phase phase);
  17. uvm_object config_obj;
  18. super.build_phase(phase);
  19. if(cfg==null) begin
  20. if(!uvm_config_db#(axi_config)::get(this,"","cfg",cfg))
  21. `uvm_warning("NOCONFIG","Config not set for master agent, using default is_active field")
  22. end
  23. else is_active = cfg.master_config.is_active;

  24. if(is_active==UVM_ACTIVE) begin
  25. write_sequencer = axi_master_write_sequencer::type_id::create("write_sequencer",this);
  26. write_driver= axi_master_write_driver::type_id::create("write_driver",this);
  27. end
  28. endfunction : build_phase

  29. function void axi_master_agent::connect_phase(uvm_phase phase);
  30. super.connect_phase(phase);
  31. if(is_active==UVM_ACTIVE)
  32. write_driver.seq_item_port.connect(write_sequencer.seq_item_export);
  33. endfunction : connect_phase

  34. function void axi_master_agent::update_config(input axi_config cfg);
  35. if(is_active==UVM_ACTIVE) begin
  36. write_sequencer.cfg=cfg;
  37. end
  38. endfunction : update_config

复制代码


axi_write_sequencer:

  1. class axi_master_write_sequencer extends uvm_sequencer;
  2. axi_config cfg;

  3. `uvm_component_utils_begin(axi_master_write_sequencer)
  4. `uvm_field_object(cfg, UVM_DEFAULT)
  5. `uvm_component_utils_end

  6. function new(string name, uvm_component parent);
  7. super.new(name,parent);
  8. endfunction : new

  9. virtual function void build_phase(uvm_phase phase);
  10. super.build_phase(phase);
  11. if(cfg == null)
  12. if(!uvm_config_db#(axi_config)::get(this,"","cfg",cfg))
  13. `uvm_warning("NOCONFIG","apb_config not set for this component")
  14. endfunction : build_phase
  15. endclass : axi_master_write_sequencer

复制代码


axi_write_driver:

  1. class axi_master_write_driver extends uvm_driver #(axi_transfer);
  2. virtual axi_write_if vif;
  3. axi_master_config cfg;
  4. axi_transfer array_transfer[$];// use queue which size can be dynamically

  5. `uvm_component_utils_begin(axi_master_write_driver)
  6. `uvm_field_object(cfg,UVM_DEFAULT)
  7. `uvm_component_utils_end

  8. function new(string name,uvm_component parent);
  9. super.new(name,parent);
  10. endfunction : new

  11. extern virtual function void build_phase(uvm_phase phase);
  12. extern virtual function void connect_phase(uvm_phase phase);
  13. extern virtual task run_phase(uvm_phase phase);
  14. //extern virtual protected task get_and_drive();
  15. extern virtual protected task reset();
  16. extern virtual protected task drive();
  17. extern virtual protected task drive_aw(axi_transfer trans);
  18. extern virtual protected task drive_w(axi_transfer trans);
  19. extern virtual protected task receive();

  20. endclass : axi_master_write_driver

  21. function void axi_master_write_driver::build_phase(uvm_phase phase);
  22. super.build_phase(phase);
  23. if(cfg == null)
  24. if(!uvm_config_db#(axi_master_config)::get(this,"","cfg",cfg))
  25. `uvm_error("NOCONFIG","axi_master_config not set for this component")

  26. endfunction : build_phase

  27. function void axi_master_write_driver::connect_phase(uvm_phase phase);
  28. super.connect_phase(phase);
  29. if(!uvm_config_db#(virtual axi_write_if)::get(this,"","vif",vif))
  30. `uvm_error("NOVIF",{"virtual interface must be set for : ",get_full_name(),".vif"})
  31. endfunction : connect_phase
  32. .....
  33. .....

复制代码


nc错误提示:
write_driver.seq_item_port.connect(write_sequencer.seq_item_export);
|
ncelab: *E,TYCMPAT (./axi_master_agent.sv,46|73): formal and actual do not have assignment compatible data types (expecting datatype compatible with 'class uvm_port_base#(.IF(class uvm_sqr_if_base#(.T1(class axi_transfer),.T2(class axi_transfer))))' but found 'class uvm_seq_item_pull_imp#(.REQ(class uvm_sequence_item),.RSP(class uvm_sequence_item),.IMP(class uvm_sequencer#(.REQ(class uvm_sequence_item),.RSP(class uvm_sequence_item))))' instead).

01.class axi_master_write_sequencer extends uvm_sequencer #(axi_transfer);

顶楼上!你的sequencer后面没有加transaction类型。

谢谢楼上诸位!
这个问题终于解决了。

这个port 是UVM 自带的 port 么?

应该是uvm_sequencer和uvm_driver中自带的,写了自己的sequencer和driver可以直接使用的。

您好,我想问您一下,seq_item_port和seq_item_export是driver和sequencer自己已经定义好了,只需要在agent的connect——phase中完成连接就行了是吗?

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top