`timescale 1ns/1ps
`include "uvm_macros.svh"
import uvm_pkg::*;

class initialization_object extends uvm_object;
  `uvm_object_utils(initialization_object)
  function new(string name="object"); super.new(name); endfunction
endclass

class initialization_component extends uvm_component;
  int value = 7;
  `uvm_component_utils_begin(initialization_component)
    `uvm_field_int(value, UVM_ALL_ON)
  `uvm_component_utils_end
  function new(string name, uvm_component parent); super.new(name, parent); endfunction
`ifdef REVIEW_UVM20
  virtual function bit use_automatic_config(); return 0; endfunction
`endif
endclass

class initialization_service extends uvm_default_coreservice_t;
endclass

module initialization_probe;
  initial begin
    initialization_service service;
    initialization_component component_value;
    uvm_coreservice_t actual;
    uvm_factory factory_value;
    uvm_object created;
    uvm_root root_value;
`ifdef REVIEW_UVM20
    service = new();
    uvm_init(service);
    actual = uvm_coreservice_t::get();
    $display("REVIEW|custom_service_installed|%0d", actual == service);
    $display("REVIEW|core_initialized|%0d", get_core_state() == UVM_CORE_INITIALIZED);
`else
    actual = uvm_coreservice_t::get();
`endif
    factory_value = actual.get_factory();
    created = factory_value.create_object_by_name("initialization_object", "", "created");
    $display("REVIEW|deferred_factory_create|%0d", created != null);
    $display("REVIEW|default_printer_ready|%0d", uvm_default_printer != null);
    component_value = new("component_value", null);
    uvm_config_db#(int)::set(null, "component_value", "value", 42);
`ifndef REVIEW_UVM20
    root_value = uvm_root::get();
    root_value.disable_apply_cfg_settings = 1;
`endif
    component_value.build_phase(null);
    $display("REVIEW|automatic_config_disabled|%0d", component_value.value == 7);
    $display("REVIEW|done|1");
    $finish;
  end
endmodule
