求助:env的run_phase没问题,到了下面agent的run_phase就跑不动了
时间:10-02
整理:3721RD
点击:
各位:
最近正在使用UVM搭建验证环境。现在遇到一个问题,就是环境跑起来之后,就卡在开始的那个时刻了。以前出现这个问题都是driver的reset函数没写好,但是这次我从test---tb---env---agent---driver这样的顺序一层一层往下debug的时候发现,到env的run_phase中加入“this.print()”的代码,能正常运行,而到了master_agent中的run_phase加入这个代码,就一直运行不了,而master_agent的其他phase中,比如build_phase和connect_phase则没问题。我觉得仿真应该是卡在这里了,但是为什么卡住?真是一头雾水。虽然严重怀疑自己是犯了低级错误,但是奈何这几天热的心浮气躁,两天都没找出问题所在。因此上来求助各位。代码如下:
最近正在使用UVM搭建验证环境。现在遇到一个问题,就是环境跑起来之后,就卡在开始的那个时刻了。以前出现这个问题都是driver的reset函数没写好,但是这次我从test---tb---env---agent---driver这样的顺序一层一层往下debug的时候发现,到env的run_phase中加入“this.print()”的代码,能正常运行,而到了master_agent中的run_phase加入这个代码,就一直运行不了,而master_agent的其他phase中,比如build_phase和connect_phase则没问题。我觉得仿真应该是卡在这里了,但是为什么卡住?真是一头雾水。虽然严重怀疑自己是犯了低级错误,但是奈何这几天热的心浮气躁,两天都没找出问题所在。因此上来求助各位。代码如下:
- `ifndef VDO_HANDWAVE_MASTER_AGENT_SV
- `define VDO_HANDWAVE_MASTER_AGENT_SV
- class vdo_handwave_master_agent extends uvm_agent;
- vdo_handwave_config cfg;
- vdo_handwave_master_sequencer sequencer;
- vdo_handwave_master_driverdriver;
- `uvm_component_utils_begin(vdo_handwave_master_agent)
- `uvm_field_object(cfg,UVM_DEFAULT|UVM_REFERENCE)
- `uvm_field_object(sequencer,UVM_DEFAULT|UVM_REFERENCE)
- `uvm_field_object(driver,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 task run_phase(uvm_phase phase);
- extern virtual function void update_config(input vdo_handwave_config cfg);
- endclass : vdo_handwave_master_agent
- function void vdo_handwave_master_agent::build_phase(uvm_phase phase);
- super.build_phase(phase);
- if(cfg==null) begin
- if(!uvm_config_db#(vdo_handwave_config)::get(this,"","cfg",cfg))
- `uvm_warning("NOCONFIG","Config not set for master agent")
- end
- sequencer = vdo_handwave_master_sequencer::type_id::create("sequencer",this);
- driver= vdo_handwave_master_driver::type_id::create("driver",this);
- endfunction : build_phase
- function void vdo_handwave_master_agent::connect_phase(uvm_phase phase);
- super.connect_phase(phase);
- driver.seq_item_port.connect(sequencer.seq_item_export);
- endfunction : connect_phase
- function void vdo_handwave_master_agent::update_config(input vdo_handwave_config cfg);
- sequencer.cfg=cfg;
- driver.cfg=cfg;
- endfunction : update_config
- task vdo_handwave_master_agent::run_phase(uvm_phase phase);
- this.print();
- endtask : run_phase
- `endif //VDO_MASTER_AGENT_SV
- `ifndef VDO_HANDWAVE_ENV_SV
- `define VDO_HANDWAVE_ENV_SV
- class vdo_handwave_env extends uvm_env;
- vdo_handwave_config cfg;
- vdo_handwave_master_agent master;
- vdo_handwave_slave_agentslaves[];
- `uvm_component_utils_begin(vdo_handwave_env)
- `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 function void start_of_simulation_phase(uvm_phase phase);
- extern virtual function void update_config(vdo_handwave_config cfg);
- extern virtual task run_phase(uvm_phase phase);
- //extern virtual task update_vif_enables();
- endclass : vdo_handwave_env
- function void vdo_handwave_env::build_phase(uvm_phase phase);
- super.build_phase(phase);
- if(cfg==null) begin
- if(!uvm_config_db#(vdo_handwave_config)::get(this,"","cfg",cfg)) begin
- `uvm_info("NOCONFIG","Using default_vdo_handwave_config",UVM_MEDIUM)
- $cast(cfg,factory.create_object_by_name("default_vdo_handwave_config","cfg"));
- end
- end
- uvm_config_object::set(this,"*","cfg",cfg);
- foreach(cfg.slave_configs[i]) begin
- string sname;
- sname=$psprintf("slave[%0d]*",i);
- uvm_config_object::set(this,sname,"cfg",cfg.slave_configs[i]);
- master=vdo_handwave_master_agent::type_id::create(cfg.master_config.name,this);
- slaves=new[cfg.slave_configs.size()];
- for(int i=0;i<cfg.slave_configs.size();i++) begin
- slaves[i]=vdo_handwave_slave_agent::type_id::create($psprintf("slave[%0d]",i),this);
- end
- end
- endfunction : build_phase
- function void vdo_handwave_env::connect_phase(uvm_phase phase);
- super.connect_phase(phase);
- endfunction : connect_phase
- function void vdo_handwave_env::start_of_simulation_phase(uvm_phase phase);
- set_report_id_action_hier("CFGOVR",UVM_DISPLAY);
- set_report_id_action_hier("CFGSET",UVM_DISPLAY);
- check_config_usage();
- endfunction : start_of_simulation_phase
- function void vdo_handwave_env::update_config(vdo_handwave_config cfg);
- master.update_config(cfg);
- foreach(slaves[i])
- slaves[i].update_config(cfg.slave_configs[i]);
- endfunction : update_config
- task vdo_handwave_env::run_phase(uvm_phase phase);
- endtask : run_phase
- `endif //VDO_HANDWAVE_ENV_SV
初来乍到,发表一下拙见
我怀疑您在run_phase的0时刻出现了死循环,请你查看一下自己的code。
你好,我也遇到这种问题了。你是怎么解决的?
和questa的uvm例子比对了一下,文件层次和内容写法一样,就是在仿真的过程中,调用了sequence 的start方法,就卡死了。搞了好几天了。头大啊。
monitor中是不是没有做时序的事情。
我的问题这样解决了