Skip to content

Commit

Permalink
Callback test, various iprovements
Browse files Browse the repository at this point in the history
Signed-off-by: Krzysztof Boronski <[email protected]>
  • Loading branch information
kboronski-ant committed Nov 7, 2023
1 parent 692bc12 commit bd4cf68
Show file tree
Hide file tree
Showing 13 changed files with 5,840 additions and 24 deletions.
1,294 changes: 1,294 additions & 0 deletions test_regress/t/t_uvm/base/uvm_callback.svh

Large diffs are not rendered by default.

228 changes: 228 additions & 0 deletions test_regress/t/t_uvm/base/uvm_domain.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
// SPDX-License-Identifier: Apache-2.0
//
//----------------------------------------------------------------------
// Copyright 2007-2018 Mentor Graphics Corporation
// Copyright 2007-2018 Cadence Design Systems, Inc.
// Copyright 2011 AMD
// Copyright 2015-2018 NVIDIA Corporation
// Copyright 2012 Accellera Systems Initiative
// All Rights Reserved Worldwide
//
// Licensed under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in
// writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See
// the License for the specific language governing
// permissions and limitations under the License.
//----------------------------------------------------------------------

//-!!!- NOTICE -------------------------------------------------------------!!!-
// This is a non-production-ready modified version of UVM intended for coverage
// testing purpouses
//-!!!----------------------------------------------------------------------!!!-

//UVM typedef class uvm_build_phase;
//UVM typedef class uvm_connect_phase;
//UVM typedef class uvm_end_of_elaboration_phase;
//UVM typedef class uvm_start_of_simulation_phase;
//UVM typedef class uvm_run_phase;
//UVM typedef class uvm_extract_phase;
//UVM typedef class uvm_check_phase;
//UVM typedef class uvm_report_phase;
//UVM typedef class uvm_final_phase;
//UVM
//UVM typedef class uvm_pre_reset_phase;
//UVM typedef class uvm_reset_phase;
//UVM typedef class uvm_post_reset_phase;
//UVM typedef class uvm_pre_configure_phase;
//UVM typedef class uvm_configure_phase;
//UVM typedef class uvm_post_configure_phase;
//UVM typedef class uvm_pre_main_phase;
//UVM typedef class uvm_main_phase;
//UVM typedef class uvm_post_main_phase;
//UVM typedef class uvm_pre_shutdown_phase;
//UVM typedef class uvm_shutdown_phase;
//UVM typedef class uvm_post_shutdown_phase;
//UVM
//UVM uvm_phase build_ph;
//UVM uvm_phase connect_ph;
//UVM uvm_phase end_of_elaboration_ph;
//UVM uvm_phase start_of_simulation_ph;
//UVM uvm_phase run_ph;
//UVM uvm_phase extract_ph;
//UVM uvm_phase check_ph;
//UVM uvm_phase report_ph;

//------------------------------------------------------------------------------
//
// Class -- NODOCS -- uvm_domain
//
//------------------------------------------------------------------------------
//
// Phasing schedule node representing an independent branch of the schedule.
// Handle used to assign domains to components or hierarchies in the testbench
//

// @uvm-ieee 1800.2-2017 auto 9.4.1
class uvm_domain extends uvm_phase;

static local uvm_domain m_uvm_domain; // run-time phases
static local uvm_domain m_domains[string];
static local uvm_phase m_uvm_schedule;

//UVM
static function uvmt_drop_globals();
m_uvm_domain = null;
m_domains.delete();
m_uvm_schedule = null;
endfunction
//UVM

// @uvm-ieee 1800.2-2017 auto 9.4.2.2
static function void get_domains(output uvm_domain domains[string]);
domains = m_domains;
endfunction


// Function -- NODOCS -- get_uvm_schedule
//
// Get the "UVM" schedule, which consists of the run-time phases that
// all components execute when participating in the "UVM" domain.
//
static function uvm_phase get_uvm_schedule();
void'(get_uvm_domain());
return m_uvm_schedule;
endfunction


// Function -- NODOCS -- get_common_domain
//
// Get the "common" domain, which consists of the common phases that
// all components execute in sync with each other. Phases in the "common"
// domain are build, connect, end_of_elaboration, start_of_simulation, run,
// extract, check, report, and final.
//
static function uvm_domain get_common_domain();

uvm_domain domain;

if(m_domains.exists("common"))
domain = m_domains["common"];

if (domain != null)
return domain;

domain = new("common");
//UVM domain.add(uvm_build_phase::get());
//UVM domain.add(uvm_connect_phase::get());
//UVM domain.add(uvm_end_of_elaboration_phase::get());
//UVM domain.add(uvm_start_of_simulation_phase::get());
//UVM domain.add(uvm_run_phase::get());
//UVM domain.add(uvm_extract_phase::get());
//UVM domain.add(uvm_check_phase::get());
//UVM domain.add(uvm_report_phase::get());
//UVM domain.add(uvm_final_phase::get());
//UVM
//UVM // for backward compatibility, make common phases visible;
//UVM // same as uvm_<name>_phase::get().
//UVM build_ph = domain.find(uvm_build_phase::get());
//UVM connect_ph = domain.find(uvm_connect_phase::get());
//UVM end_of_elaboration_ph = domain.find(uvm_end_of_elaboration_phase::get());
//UVM start_of_simulation_ph = domain.find(uvm_start_of_simulation_phase::get());
//UVM run_ph = domain.find(uvm_run_phase::get());
//UVM extract_ph = domain.find(uvm_extract_phase::get());
//UVM check_ph = domain.find(uvm_check_phase::get());
//UVM report_ph = domain.find(uvm_report_phase::get());

domain = get_uvm_domain();
//UVM m_domains["common"].add(domain,
//UVM .with_phase(m_domains["common"].find(uvm_run_phase::get())));
// Temporarily remove default run phase
//UVM

return m_domains["common"];

endfunction



// @uvm-ieee 1800.2-2017 auto 9.4.2.3
static function void add_uvm_phases(uvm_phase schedule);
//UVM
$display("[uvm]: WARNING: add_uvm_phases is a stub");
//UVM
//UVM schedule.add(uvm_pre_reset_phase::get());
//UVM schedule.add(uvm_reset_phase::get());
//UVM schedule.add(uvm_post_reset_phase::get());
//UVM schedule.add(uvm_pre_configure_phase::get());
//UVM schedule.add(uvm_configure_phase::get());
//UVM schedule.add(uvm_post_configure_phase::get());
//UVM schedule.add(uvm_pre_main_phase::get());
//UVM schedule.add(uvm_main_phase::get());
//UVM schedule.add(uvm_post_main_phase::get());
//UVM schedule.add(uvm_pre_shutdown_phase::get());
//UVM schedule.add(uvm_shutdown_phase::get());
//UVM schedule.add(uvm_post_shutdown_phase::get());

endfunction


// Function -- NODOCS -- get_uvm_domain
//
// Get a handle to the singleton ~uvm~ domain
//
static function uvm_domain get_uvm_domain();

if (m_uvm_domain == null) begin
m_uvm_domain = new("uvm");
m_uvm_schedule = new("uvm_sched", UVM_PHASE_SCHEDULE);
add_uvm_phases(m_uvm_schedule);
//UVM m_uvm_domain.add(m_uvm_schedule);
end
return m_uvm_domain;
endfunction



// @uvm-ieee 1800.2-2017 auto 9.4.2.1
function new(string name);
super.new(name,UVM_PHASE_DOMAIN);
if (m_domains.exists(name))
`uvm_error("UNIQDOMNAM", $sformatf("Domain created with non-unique name '%s'", name))
m_domains[name] = this;
endfunction


// @uvm-ieee 1800.2-2017 auto 9.4.2.4
function void jump(uvm_phase phase);
uvm_phase phases[$];

m_get_transitive_children(phases);

phases = phases.find(item) with (item.get_state() inside {[UVM_PHASE_STARTED:UVM_PHASE_CLEANUP]});

foreach(phases[idx])
if(phases[idx].is_before(phase) || phases[idx].is_after(phase))
phases[idx].jump(phase);

endfunction

// jump_all
// --------
static function void jump_all(uvm_phase phase);
uvm_domain domains[string];

uvm_domain::get_domains(domains);

foreach(domains[idx])
domains[idx].jump(phase);

endfunction
endclass
16 changes: 16 additions & 0 deletions test_regress/t/t_uvm/base/uvm_object.svh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@

// Status: MOCK

// UVM MOCK
class uvm_copier; endclass

class uvm_object;
local string m_leaf_name;
local int m_inst_id;
Expand All @@ -46,6 +49,9 @@ class uvm_object;
extern function int get_inst_id();

virtual function string get_type_name (); return "<unknown>"; endfunction

extern virtual function void do_copy (uvm_object rhs);
extern virtual function string get_full_name ();
endclass

// UVM 1:1*
Expand All @@ -69,3 +75,13 @@ endfunction
function int uvm_object::get_inst_id();
return m_inst_id;
endfunction

// UVM 1:1
function void uvm_object::do_copy (uvm_object rhs);
return;
endfunction

// UVM 1:1
function string uvm_object::get_full_name ();
return get_name();
endfunction
46 changes: 46 additions & 0 deletions test_regress/t/t_uvm/base/uvm_object_globals.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: Apache-2.0
//
//------------------------------------------------------------------------------
// Copyright 2007-2011 Mentor Graphics Corporation
// Copyright 2017 Intel Corporation
// Copyright 2010 Synopsys, Inc.
// Copyright 2007-2018 Cadence Design Systems, Inc.
// Copyright 2010 AMD
// Copyright 2015-2018 NVIDIA Corporation
// All Rights Reserved Worldwide
//
// Licensed under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of
// the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in
// writing, software distributed under the License is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See
// the License for the specific language governing
// permissions and limitations under the License.
//------------------------------------------------------------------------------

typedef enum { UVM_PHASE_UNINITIALIZED = 0,
UVM_PHASE_DORMANT = 1,
UVM_PHASE_SCHEDULED = 2,
UVM_PHASE_SYNCING = 4,
UVM_PHASE_STARTED = 8,
UVM_PHASE_EXECUTING = 16,
UVM_PHASE_READY_TO_END = 32,
UVM_PHASE_ENDED = 64,
UVM_PHASE_CLEANUP = 128,
UVM_PHASE_DONE = 256,
UVM_PHASE_JUMPING = 512
} uvm_phase_state;

typedef enum { UVM_PHASE_IMP,
UVM_PHASE_NODE,
UVM_PHASE_TERMINAL,
UVM_PHASE_SCHEDULE,
UVM_PHASE_DOMAIN,
UVM_PHASE_GLOBAL
} uvm_phase_type;
Loading

0 comments on commit bd4cf68

Please sign in to comment.