UVM Environment
Table of Contents
User-defined environment is derived from uvm_env, uvm_env is inherited from uvm_component.
Environment is the container class, It contains one or more agents, as well as other components such as scoreboard, top level monitor, and checker.
Writing UVM Environment
1. Environment is written by extending UVM_ENV.
class mem_model_env extends uvm_env; `uvm_component_utils(mem_model_env) // new - constructor function new(string name, uvm_component parent); super.new(name, parent); endfunction : new endclass : mem_model_env
2. Declare the agent,
mem_agent mem_agnt;
3. Create agent,
mem_agnt = mem_agent::type_id::create("mem_agnt", this);
UVM environment code,
class mem_model_env extends uvm_env; mem_agent mem_agnt; `uvm_component_utils(mem_model_env) // new - constructor function new(string name, uvm_component parent); super.new(name, parent); endfunction : new // build_phase function void build_phase(uvm_phase phase); super.build_phase(phase); mem_agnt = mem_agent::type_id::create("mem_agnt", this); endfunction : build_phase endclass : mem_model_env