blob: 5fe7a2689d8a8e30d67bcc925923ac83f7e2ddac [file] [log] [blame]
<html><head><title>User-Defined Phases</title><link rel="stylesheet" type="text/css" href="../../styles/main.css"><script language=JavaScript src="../../javascript/main.js"></script></head><body class="FramedContentPage" onLoad="NDOnLoad()"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>
<!-- Generated by Natural Docs, version Development Release 01-12-2008 (1.35 base) -->
<!-- http://www.naturaldocs.org -->
<!-- saved from url=(0026)http://www.naturaldocs.org -->
<!--TOP - START OF CONTENT-->
<div id=Content>
<!--CONTENT index=0 -->
<div class="CSection"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="User-Defined_Phases" href="../../src/overviews/test-phasing.txt">User-Defined Phases</a></h1><div class=CBody><p>To define your own custom phase, use the following pattern.</p><p>1.&nbsp; Extend the appropriate base class for your phase type.</p><blockquote><pre>class my_PHASE_phase extends uvm_task_phase;
class my_PHASE_phase extends uvm_topdown_phase;
class my_PHASE_phase extends uvm_bottomup_phase;</pre></blockquote><p>2.&nbsp; Optionally, implement your exec_task or exec_func method.</p><blockquote><pre>task exec_task(uvm_component comp, uvm_phase schedule);
function void exec_func(uvm_component comp, uvm_phase schedule);</pre></blockquote><p>If implemented, these methods usually call the related method on the component</p><blockquote><pre>comp.PHASE_phase(uvm_phase phase);</pre></blockquote><p>3.&nbsp; Since the phase class is a singleton, providing an accessor method allows for easy global use, and protecting the constructor prevents misuse.</p><blockquote><pre>class my_PHASE_phase extends uvm_topdown_phase; or uvm_task_phase/uvm_bottomum_phase
static local my_PHASE_phase m_inst; Local reference to global IMP
protected function new(string name=&quot;PHASE&quot;); Protected constructor for singleton
super.new(name);
endfunction : new
static function my_PHASE_phase get(); Static method for accessing singleton
if (m_imp == null)
m_imp = new();
return m_imp;
endfunction : get
Optionally implement exec_func/exec_task
endclass : my_PHASE_phase</pre></blockquote><p>4.&nbsp; Insert the phase in a phase schedule or domain using the <a href="../base/uvm_phase-svh.html#uvm_phase.add" class=LMethod id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">uvm_phase::add</a> method:</p><blockquote><pre>my_schedule.add(my_PHASE_class::get());</pre></blockquote>
<!--START_ND_SUMMARY index=0-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=0 -->
<tr class="SMain"><td colspan=2 class=SEntry><a href="#User-Defined_Phases" >User-Defined Phases</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>To define your own custom phase, use the following pattern.</td></tr></table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
</div><!--Content-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CMethod>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters colspan=5>function void add(</td> </tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>uvm_phase&nbsp;</td>
<td class=PParameter nowrap>phase,</td>
<td class=PDefaultValuePrefix>&nbsp;&nbsp;</td>
<td class=PDefaultValue width=100%></td>
</tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>uvm_phase&nbsp;</td>
<td class=PParameter nowrap>with_phase</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>null,</td>
</tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>uvm_phase&nbsp;</td>
<td class=PParameter nowrap>after_phase</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>null,</td>
</tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>uvm_phase&nbsp;</td>
<td class=PParameter nowrap>before_phase</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>null</td>
</tr>
<tr>
<td class=PAfterParameters colspan=5>)</td></tr>
</table></td></tr>
</table></blockquote>
Build up a schedule structure inserting phase by phase, specifying linkage</div></div><!--END_ND_TOOLTIPS-->
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>