classextendsuvm_env; `uvm_component_utils (my_env) // This is standard code for all components function new(string name = "my_env", uvm_component parent = null); super.new (name, parent); endfunction // Code for rest of the steps come here endclass
申明这个env中的一些component:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// apb_agnt and other components are assumed to be user-defined classes that already exist in TB apb_agnt m_apb_agnt; func_cov m_func_cov; scbd m_scbd; env_cfg m_env_cfg; // Build components within the "build_phase" virtual function voidbuild_phase(uvm_phase phase); super.build_phase (phase); m_apb_agnt = apb_agnt::type_id::create ("m_apb_agnt", this); m_func_cov = func_cov::type_id::create ("m_func_cov", this); m_scbd = scbd::type_id::create ("m_scbd", this); // [Optional] Collect configuration objects from the test class if applicable if (uvm_config_db #(env_cfg)::get(this, "", "env_cfg", m_env_cfg)) `uvm_fatal ("build_phase", "Did not get a configuration object for env") // [Optional] Pass other configuration objects to sub-components via uvm_config_db endfunction
近期评论