求助:在连接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:
- class axi_master_agent extends uvm_agent;
- axi_configcfg;
- axi_master_write_sequencerwrite_sequencer;
- axi_master_write_driverwrite_driver;
- `uvm_component_utils_begin(axi_master_agent)
- `uvm_field_enum(uvm_active_passive_enum,is_active,UVM_DEFAULT)
- `uvm_field_object(cfg,UVM_DEFAULT|UVM_REFERENCE)
- `uvm_component_utils_end
- function new (string name ,uvm_component parent);
- super.new(name,parent);
- endfunction : new
- extern virtual function void build_phase(uvm_phase phase);
- extern virtual function void connect_phase(uvm_phase phase);
- extern virtual function void update_config(input axi_config cfg);
- endclass : axi_master_agent
- function void axi_master_agent::build_phase(uvm_phase phase);
- uvm_object config_obj;
- super.build_phase(phase);
- if(cfg==null) begin
- if(!uvm_config_db#(axi_config)::get(this,"","cfg",cfg))
- `uvm_warning("NOCONFIG","Config not set for master agent, using default is_active field")
- end
- else is_active = cfg.master_config.is_active;
- if(is_active==UVM_ACTIVE) begin
- write_sequencer = axi_master_write_sequencer::type_id::create("write_sequencer",this);
- write_driver= axi_master_write_driver::type_id::create("write_driver",this);
- end
- endfunction : build_phase
- function void axi_master_agent::connect_phase(uvm_phase phase);
- super.connect_phase(phase);
- if(is_active==UVM_ACTIVE)
- write_driver.seq_item_port.connect(write_sequencer.seq_item_export);
- endfunction : connect_phase
- function void axi_master_agent::update_config(input axi_config cfg);
- if(is_active==UVM_ACTIVE) begin
- write_sequencer.cfg=cfg;
- end
- endfunction : update_config
axi_write_sequencer:
- class axi_master_write_sequencer extends uvm_sequencer;
- axi_config cfg;
- `uvm_component_utils_begin(axi_master_write_sequencer)
- `uvm_field_object(cfg, UVM_DEFAULT)
- `uvm_component_utils_end
- function new(string name, uvm_component parent);
- super.new(name,parent);
- endfunction : new
- virtual function void build_phase(uvm_phase phase);
- super.build_phase(phase);
- if(cfg == null)
- if(!uvm_config_db#(axi_config)::get(this,"","cfg",cfg))
- `uvm_warning("NOCONFIG","apb_config not set for this component")
- endfunction : build_phase
- endclass : axi_master_write_sequencer
axi_write_driver:
- class axi_master_write_driver extends uvm_driver #(axi_transfer);
- virtual axi_write_if vif;
- axi_master_config cfg;
- axi_transfer array_transfer[$];// use queue which size can be dynamically
- `uvm_component_utils_begin(axi_master_write_driver)
- `uvm_field_object(cfg,UVM_DEFAULT)
- `uvm_component_utils_end
- function new(string name,uvm_component parent);
- super.new(name,parent);
- endfunction : new
- extern virtual function void build_phase(uvm_phase phase);
- extern virtual function void connect_phase(uvm_phase phase);
- extern virtual task run_phase(uvm_phase phase);
- //extern virtual protected task get_and_drive();
- extern virtual protected task reset();
- extern virtual protected task drive();
- extern virtual protected task drive_aw(axi_transfer trans);
- extern virtual protected task drive_w(axi_transfer trans);
- extern virtual protected task receive();
- endclass : axi_master_write_driver
- function void axi_master_write_driver::build_phase(uvm_phase phase);
- super.build_phase(phase);
- if(cfg == null)
- if(!uvm_config_db#(axi_master_config)::get(this,"","cfg",cfg))
- `uvm_error("NOCONFIG","axi_master_config not set for this component")
- endfunction : build_phase
- function void axi_master_write_driver::connect_phase(uvm_phase phase);
- super.connect_phase(phase);
- if(!uvm_config_db#(virtual axi_write_if)::get(this,"","vif",vif))
- `uvm_error("NOVIF",{"virtual interface must be set for : ",get_full_name(),".vif"})
- endfunction : connect_phase
- .....
- .....
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中完成连接就行了是吗?