增城网站建设,上海奉贤网站建设,未来做那个网站能致富,2323wan网页游戏topic overview 不建议的方法#xff1a;假如没有TLM TLM TLM 1.0 整个TLM机制下#xff0c;底层逻辑离不开动作发起者和被动接受者这个底层的模型基础#xff0c;但实际上#xff0c;在验证环境中#xff0c;任何一个组件#xff0c;都有可能成为动作的发起者#xff0…topic overview 不建议的方法假如没有TLM TLM TLM 1.0 整个TLM机制下底层逻辑离不开动作发起者和被动接受者这个底层的模型基础但实际上在验证环境中任何一个组件都有可能成为动作的发起者都有可能主动发起命令且只有掌握主动权才能更灵活的控制数据的流通因此TLM机制下实际用的最多的组件也就是基于FIFO的数据通信。
端对端的fifo模式 主要的连接图如上
monitor里面声明put port端口。 reference model 里面声明get port端口。 monitor在agent里面将agent的export端口与monitor的put port端口连接。 在env里将agent 的export与fifo相连接将reference model的port与fifo相连接。
class my_monitor extends uvm_component;uvm_component_utils(my_monitor)uvm_blocking_put_port #(my_transaction, my_monitor) m2r_port;//monitor里面声明put port端口function new(string name ,uvm_component parent);super.name(name, parent)this.m2r_port new(m2r_port,this);endfunctiontask run_phase(uvm_phase phase);super.run_phase(phase);repeat(10) beginreq seq_item::type_id::create(req);assert(req.randomize());m2r_port.put(req);uvm_info(get_name(), $sformatf(Send value %0h, req.value), UVM_NONE);#5;endendtask
endclassclass my_reference_model extends uvm_component;uvm_component_utils(my_reference_model)uvm_blocking_get_port #(my_transaction) m2r_port;//reference model 里面声明get port端口function new(string name ,uvm_component parent);super.name(name, parent)this.m2r_port new(m2r_port,this);endfunctionvirtual task run_phase (my_transaction tr);uvm_info(get_name(), begin to get data from monitor,UVM_LOW)forever beginm2r_port.get(item);uvm_info(get_name(),(master agent have been sent a transaction:\n,item.sprint()),UVM_LOW)endendtask
endclassclass master_agent extends uvm_agent;//monitor在agent里面将agent的export端口与monitor的put port端口连接uvm_component_utils(master_agent)uvm_blocking_put_export #(my_transaction) m_a2r_export;my_monitor my_mon;function new(string name ,uvm_component parent);super.name(name, parent)this.m_a2r_export new(m_a2r_export,this);endfunctionvirtual function void build_phase(uvm_phase phase);super.build_phase(phase);my_mon my_monitor::type_id::create(my_monitor, this);endfunction: build_phasevirtual function void connect_phase (uvm_phase phase);if(is_active UVM_ACTIVE);my_mon.m2r_port.connect(this.m_a2r_export);uvm_info(get_name(), Monitor has been connect with agent,UVM_LOW)endfunction
endclassclass my_env extends uvm_env;//在env里将agent 的export与fifo相连接将reference model的port与fifo相连接uvm_component_utils(my_env)my_reference_model my_model;master_agent my_agent;uvm_tlm_analysis_fifo # (my_transaction) agt2ref_mod_fifo function new(string name ,uvm_component parent);super.name(name, parent)this.agt2ref_mod_fifo new(agt2ref_mod_fifo,this);endfunctionvirtual function void build_phase(uvm_phase phase);super.build_phase(phase);my_model my_reference_model::type_id::create(my_model, this);my_agent master_agent::type_id::create(my_agent, this);endfunction: build_phasevirtual function void connect_phase (uvm_phase phase);my_agent.m_a2r_export.connect(agt2ref_mod_fifo.uvm_blocking_put_export)my_model.m2r_port.connect(agt2ref_mod_fifo.uvm_blocking_get_export);endfunction
endclass参考文献
原文链接https://blog.csdn.net/JamesBond619/article/details/137541659 原文链接https://blog.csdn.net/qq_36955425/article/details/130631383