|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
各位:
最近正在使用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_driver driver;
- `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_agent slaves[];
- `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
复制代码 |
|