# OVM on top

This example demonstrates a simple OVM-on-top environment, where OVM controls the phasing of OVM and any integrated VMM envs. Unlike the VMM-on-top use model, VMM envs integrated in an OVM environment do not require modification, i.e. do not require a change to its inheritance and the addition of a call to <ovm_build> in the build phase.

../../../../examples/02_integration/02_ovm_on_top.sv

    `define OVM_ON_TOP

    `include "ovm_vmm_pkg.sv"

    `include "ovm_other.sv"
    `include "vmm_other.sv"

    class wrapped_vmm_env extends avt_ovm_vmm_env #(vmm_env_ext);

      `ovm_component_utils(wrapped_vmm_env)

      function new (string name, ovm_component parent=null);
        super.new(name,parent);
      endfunction

    endclass

    class my_ovm_env extends ovm_comp_ext;

      wrapped_vmm_env subenv;

      `ovm_component_utils(my_ovm_env)

      function new (string name, ovm_component parent=null);
        super.new(name,parent);
      endfunction

      virtual function void build();
        subenv = new("vmm_env",this);
        subenv.auto_stop_request = 1;
      endfunction

    endclass

    program example_02_ovm_on_top;

      initial run_test("my_ovm_env");

    endprogram