OpenCores
URL https://opencores.org/ocsvn/uart2bus_testbench/uart2bus_testbench/trunk

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [base/] [uvm_bottomup_phase.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//
2
//----------------------------------------------------------------------
3
//   Copyright 2007-2011 Mentor Graphics Corporation
4
//   Copyright 2007-2010 Cadence Design Systems, Inc.
5
//   Copyright 2010 Synopsys, Inc.
6
//   All Rights Reserved Worldwide
7
//
8
//   Licensed under the Apache License, Version 2.0 (the
9
//   "License"); you may not use this file except in
10
//   compliance with the License.  You may obtain a copy of
11
//   the License at
12
//
13
//       http://www.apache.org/licenses/LICENSE-2.0
14
//
15
//   Unless required by applicable law or agreed to in
16
//   writing, software distributed under the License is
17
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
18
//   CONDITIONS OF ANY KIND, either express or implied.  See
19
//   the License for the specific language governing
20
//   permissions and limitations under the License.
21
//----------------------------------------------------------------------
22
 
23
//------------------------------------------------------------------------------
24
//
25
// Class: uvm_bottomup_phase
26
//
27
//------------------------------------------------------------------------------
28
// Virtual base class for function phases that operate bottom-up.
29
// The pure virtual function execute() is called for each component.
30
// This is the default traversal so is included only for naming.
31
//
32
// A bottom-up function phase completes when the  method
33
// has been called and returned on all applicable components
34
// in the hierarchy.
35
 
36
virtual class uvm_bottomup_phase extends uvm_phase;
37
 
38
  // Function: new
39
  //
40
  // Create a new instance of a bottom-up phase.
41
  //
42
  function new(string name);
43
    super.new(name,UVM_PHASE_IMP);
44
  endfunction
45
 
46
 
47
  // Function: traverse
48
  //
49
  // Traverses the component tree in bottom-up order, calling  for
50
  // each component.
51
  //
52
  virtual function void traverse(uvm_component comp,
53
                                 uvm_phase phase,
54
                                 uvm_phase_state state);
55
    string name;
56
    uvm_domain phase_domain =phase.get_domain();
57
    uvm_domain comp_domain = comp.get_domain();
58
 
59
    if (comp.get_first_child(name))
60
      do
61
        traverse(comp.get_child(name), phase, state);
62
      while(comp.get_next_child(name));
63
 
64
    if (m_phase_trace)
65
    `uvm_info("PH_TRACE",$sformatf("bottomup-phase phase=%s state=%s comp=%s comp.domain=%s phase.domain=%s",
66
          phase.get_name(), state.name(), comp.get_full_name(),comp_domain.get_name(),phase_domain.get_name()),
67
          UVM_DEBUG)
68
 
69
    if (phase_domain == uvm_domain::get_common_domain() ||
70
        phase_domain == comp_domain) begin
71
      case (state)
72
        UVM_PHASE_STARTED: begin
73
          comp.m_current_phase = phase;
74
          comp.m_apply_verbosity_settings(phase);
75
          comp.phase_started(phase);
76
          end
77
        UVM_PHASE_EXECUTING: begin
78
          uvm_phase ph = this;
79
          if (comp.m_phase_imps.exists(this))
80
            ph = comp.m_phase_imps[this];
81
          ph.execute(comp, phase);
82
          end
83
        UVM_PHASE_READY_TO_END: begin
84
          comp.phase_ready_to_end(phase);
85
          end
86
        UVM_PHASE_ENDED: begin
87
          comp.phase_ended(phase);
88
          comp.m_current_phase = null;
89
          end
90
        default:
91
          `uvm_fatal("PH_BADEXEC","bottomup phase traverse internal error")
92
      endcase
93
    end
94
  endfunction
95
 
96
 
97
  // Function: execute
98
  //
99
  // Executes the bottom-up phase ~phase~ for the component ~comp~.
100
  //
101
  virtual function void execute(uvm_component comp,
102
                                          uvm_phase phase);
103
    // reseed this process for random stability
104
    process proc = process::self();
105
    proc.srandom(uvm_create_random_seed(phase.get_type_name(), comp.get_full_name()));
106
 
107
    comp.m_current_phase = phase;
108
    exec_func(comp,phase);
109
  endfunction
110
 
111
endclass
112
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.