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

`ifdef CASE_C5
class compile_item extends uvm_sequence_item;
  `uvm_object_utils(compile_item)
  rand int value;
  function new(string name = "compile_item"); super.new(name); endfunction
endclass
class compile_sequence extends uvm_sequence#(uvm_sequence_item);
  `uvm_object_utils(compile_sequence)
  function new(string name = "compile_sequence"); super.new(name); endfunction
  task body();
    compile_item item;
`ifdef MIGRATED
    `uvm_do(item, , , {value == 42;})
`else
    `uvm_do_with(item, {value == 42;})
`endif
  endtask
endclass
`endif

`ifdef CASE_C6
class compile_object extends uvm_object;
  `uvm_object_utils(compile_object)
`ifdef MIGRATED
  function new(string name = "compile_object"); super.new(name); endfunction
`else
  function new(); super.new(); endfunction
`endif
endclass
`endif

class probe_reg extends uvm_reg;
  function new(string name = "probe_reg"); super.new(name, 32, UVM_NO_COVERAGE); endfunction
endclass

class probe_component extends uvm_component;
  function new(string name, uvm_component parent); super.new(name, parent); endfunction
endclass

`ifdef CASE_C12
class compile_factory extends
`ifdef MIGRATED
  uvm_default_factory;
`else
  uvm_factory;
  uvm_default_factory delegate = new();
  virtual function void register(uvm_object_wrapper obj); delegate.register(obj); endfunction
  virtual function void set_inst_override_by_type(uvm_object_wrapper original_type, uvm_object_wrapper override_type, string full_inst_path);
    delegate.set_inst_override_by_type(original_type, override_type, full_inst_path);
  endfunction
  virtual function void set_inst_override_by_name(string original_type_name, string override_type_name, string full_inst_path);
    delegate.set_inst_override_by_name(original_type_name, override_type_name, full_inst_path);
  endfunction
  virtual function void set_type_override_by_type(uvm_object_wrapper original_type, uvm_object_wrapper override_type, bit replace=1);
    delegate.set_type_override_by_type(original_type, override_type, replace);
  endfunction
  virtual function void set_type_override_by_name(string original_type_name, string override_type_name, bit replace=1);
    delegate.set_type_override_by_name(original_type_name, override_type_name, replace);
  endfunction
  virtual function uvm_object create_object_by_type(uvm_object_wrapper requested_type, string parent_inst_path="", string name="");
    return delegate.create_object_by_type(requested_type, parent_inst_path, name);
  endfunction
  virtual function uvm_component create_component_by_type(uvm_object_wrapper requested_type, string parent_inst_path="", string name, uvm_component parent);
    return delegate.create_component_by_type(requested_type, parent_inst_path, name, parent);
  endfunction
  virtual function uvm_object create_object_by_name(string requested_type_name, string parent_inst_path="", string name="");
    return delegate.create_object_by_name(requested_type_name, parent_inst_path, name);
  endfunction
  virtual function uvm_component create_component_by_name(string requested_type_name, string parent_inst_path="", string name, uvm_component parent);
    return delegate.create_component_by_name(requested_type_name, parent_inst_path, name, parent);
  endfunction
  virtual function void debug_create_by_type(uvm_object_wrapper requested_type, string parent_inst_path="", string name="");
    delegate.debug_create_by_type(requested_type, parent_inst_path, name);
  endfunction
  virtual function void debug_create_by_name(string requested_type_name, string parent_inst_path="", string name="");
    delegate.debug_create_by_name(requested_type_name, parent_inst_path, name);
  endfunction
  virtual function uvm_object_wrapper find_override_by_type(uvm_object_wrapper requested_type, string full_inst_path);
    return delegate.find_override_by_type(requested_type, full_inst_path);
  endfunction
  virtual function uvm_object_wrapper find_override_by_name(string requested_type_name, string full_inst_path);
    return delegate.find_override_by_name(requested_type_name, full_inst_path);
  endfunction
  virtual function uvm_object_wrapper find_wrapper_by_name(string type_name);
    return delegate.find_wrapper_by_name(type_name);
  endfunction
  virtual function void print(int all_types=1); delegate.print(all_types); endfunction
`endif
endclass
`endif

`ifdef CASE_C14
class compile_arbitrator extends uvm_sequencer#(uvm_sequence_item);
  function new(string name, uvm_component parent); super.new(name, parent); endfunction
`ifdef MIGRATED
  virtual function int user_priority_arbitration(int avail_sequences[$]);
`else
  virtual function integer user_priority_arbitration(integer avail_sequences[$]);
`endif
    return avail_sequences[$];
  endfunction
endclass
`endif

module compile_probe;
  initial begin
`ifdef CASE_C1
`ifdef MIGRATED
    uvm_default_table_printer.knobs.depth = 3;
`else
    uvm_default_table_printer.knobs.name_width = 20;
`endif
`endif
`ifdef CASE_C2
    uvm_sequence_item item = new("item");
    uvm_event event_value;
`ifdef MIGRATED
    event_value = item.get_event_pool().get("end");
`else
    event_value = item.end_event;
`endif
`endif
`ifdef CASE_C3
    probe_component component_value = new("component_value", null);
`ifdef MIGRATED
    // Phase-based shutdown is exercised by objection_probe.
`else
    if ($test$plusargs("CALL_LEGACY")) component_value.kill();
`endif
`endif
`ifdef CASE_C4
    uvm_event event_value = new("event_value");
`ifdef MIGRATED
    if ($test$plusargs("CALL_LEGACY")) uvm_callbacks#(uvm_event, uvm_event_callback)::add(event_value, null);
`else
    if ($test$plusargs("CALL_LEGACY")) event_value.add_callback(null);
`endif
`endif
`ifdef CASE_C7
    uvm_resource#(int) resource_value = new("resource_value", "env.*");
`ifdef MIGRATED
`ifdef REVIEW_UVM20
    uvm_resource_pool::get().set_scope(resource_value, "env.*");
`else
    uvm_resource_pool::get().set(resource_value);
`endif
`else
    resource_value.set();
`endif
`endif
`ifdef CASE_C8
`ifdef MIGRATED
`ifdef REVIEW_UVM20
    uvm_compat_proxy_sequence#(uvm_sequence_item) sequence_value = new("sequence_value");
`else
    uvm_sequence_base sequence_value = new("sequence_value");
`endif
`else
    uvm_sequence_base sequence_value = new("sequence_value");
`endif
`endif
`ifdef CASE_C9
    probe_reg register_value = new();
    uvm_reg_map map_value;
`ifdef MIGRATED
    if ($test$plusargs("CALL_LEGACY")) map_value = register_value.get_default_map();
`else
    if ($test$plusargs("CALL_LEGACY")) map_value = register_value.get_default_map("caller");
`endif
`endif
`ifdef CASE_C10a
`ifdef MIGRATED
    uvm_root::get().set_timeout(1000);
`else
    set_global_timeout(1000);
`endif
`endif
`ifdef CASE_C10b
    uvm_report_object reporter = new("reporter");
    uvm_report_server server;
`ifdef MIGRATED
    server = uvm_report_server::get_server();
`else
    server = reporter.get_report_server();
`endif
`endif
`ifdef CASE_C10c
`ifdef MIGRATED
    uvm_config_db#(uvm_bitstream_t)::set(null, "*", "value", 1);
`else
    uvm_pkg::set_config_int("*", "value", 1);
`endif
`endif
`ifdef CASE_C11
`ifdef MIGRATED
    uvm_comparer comparer = new();
`else
    uvm_status_container status_value = new();
`endif
`endif
`ifdef CASE_C13
    int value = 1;
    uvm_printer printer = uvm_default_printer;
`ifdef MIGRATED
    printer.print_field("value", value, 32, UVM_HEX);
`else
    `uvm_print_int3(value, UVM_HEX, printer)
`endif
`endif
    $display("REVIEW|done|1");
    $finish;
  end
endmodule
