blob: 6cd1d1491c13a3bdd4c53679c09404303f409a22 [file] [log] [blame]
<html><head><title>Policy Classes</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="Policy_Classes" href="../../src/comps/uvm_policies.svh">Policy Classes</a></h1><div class=CBody><p>Policy classes are used to implement polymorphic operations that differ between built-in types and class-based types.&nbsp; Generic components can then be built that work with either classes or built-in types, depending on what policy class is used.</p>
<!--START_ND_SUMMARY index=0-->
<div class=Summary><div class=STitle>Contents</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=0 -->
<tr class="SMain"><td class=SEntry><a href="#Policy_Classes" >Policy Classes</a></td><td class=SDescription>Policy classes are used to implement polymorphic operations that differ between built-in types and class-based types. </td></tr>
<!-- index=1 -->
<tr class="SSMethod SMarked"><td class=SEntry><a href="#uvm_built_in_comp#(T)" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">uvm_built_in_comp #(T)</a></td><td class=SDescription>This policy class is used to compare built-in types.</td></tr>
<!-- index=2 -->
<tr class="SSMethod"><td class=SEntry><a href="#uvm_built_in_converter#(T)" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">uvm_built_in_converter #(T)</a></td><td class=SDescription>This policy class is used to convert built-in types to strings.</td></tr>
<!-- index=3 -->
<tr class="SSMethod SMarked"><td class=SEntry><a href="#uvm_built_in_clone#(T)" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">uvm_built_in_clone #(T)</a></td><td class=SDescription>This policy class is used to clone built-in types via the = operator.</td></tr>
<!-- index=4 -->
<tr class="SSMethod"><td class=SEntry><a href="#uvm_class_comp#(T)" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">uvm_class_comp #(T)</a></td><td class=SDescription>This policy class is used to compare two objects of the same type.</td></tr>
<!-- index=5 -->
<tr class="SSMethod SMarked"><td class=SEntry><a href="#uvm_class_converter#(T)" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">uvm_class_converter #(T)</a></td><td class=SDescription>This policy class is used to convert a class object to a string.</td></tr>
<!-- index=6 -->
<tr class="SSMethod"><td class=SEntry><a href="#uvm_class_clone#(T)" id=link6 onMouseOver="ShowTip(event, 'tt6', 'link6')" onMouseOut="HideTip('tt6')">uvm_class_clone #(T)</a></td><td class=SDescription>This policy class is used to clone class objects.</td></tr></table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=1 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_built_in_comp#(T)" href="../../src/comps/uvm_policies.svh">uvm_built_in_comp #(T)</a></h2><div class=CBody><p>This policy class is used to compare built-in types.</p><p>Provides a comp method that compares the built-in type, T, for which the == operator is defined.</p>
<!--START_ND_SUMMARY index=1-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=1 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_built_in_comp#(T)" id=link7 onMouseOver="ShowTip(event, 'tt1', 'link7')" onMouseOut="HideTip('tt1')">uvm_built_in_comp #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to compare built-in types.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_comp #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=2 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_built_in_converter#(T)" href="../../src/comps/uvm_policies.svh">uvm_built_in_converter #(T)</a></h2><div class=CBody><p>This policy class is used to convert built-in types to strings.</p><p>Provides a convert2string method that converts the built-in type, T, to a string using the %p format specifier.</p>
<!--START_ND_SUMMARY index=2-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=2 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_built_in_converter#(T)" id=link8 onMouseOver="ShowTip(event, 'tt2', 'link8')" onMouseOut="HideTip('tt2')">uvm_built_in_converter #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to convert built-in types to strings.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_converter #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=3 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_built_in_clone#(T)" href="../../src/comps/uvm_policies.svh">uvm_built_in_clone #(T)</a></h2><div class=CBody><p>This policy class is used to clone built-in types via the = operator.</p><p>Provides a clone method that returns a copy of the built-in type, T.</p>
<!--START_ND_SUMMARY index=3-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=3 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_built_in_clone#(T)" id=link9 onMouseOver="ShowTip(event, 'tt3', 'link9')" onMouseOut="HideTip('tt3')">uvm_built_in_clone #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to clone built-in types via the = operator.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_clone #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=4 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_class_comp#(T)" href="../../src/comps/uvm_policies.svh">uvm_class_comp #(T)</a></h2><div class=CBody><p>This policy class is used to compare two objects of the same type.</p><p>Provides a comp method that compares two objects of type T.&nbsp; The class T must provide the method &ldquo;function bit compare(T rhs)&rdquo;, similar to the <a href="../base/uvm_object-svh.html#uvm_object.compare" class=LMethod id=link11 onMouseOver="ShowTip(event, 'tt7', 'link11')" onMouseOut="HideTip('tt7')">uvm_object::compare</a> method.</p>
<!--START_ND_SUMMARY index=4-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=4 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_class_comp#(T)" id=link10 onMouseOver="ShowTip(event, 'tt4', 'link10')" onMouseOut="HideTip('tt4')">uvm_class_comp #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to compare two objects of the same type.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_comp #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=5 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_class_converter#(T)" href="../../src/comps/uvm_policies.svh">uvm_class_converter #(T)</a></h2><div class=CBody><p>This policy class is used to convert a class object to a string.</p><p>Provides a convert2string method that converts an instance of type T to a string.&nbsp; The class T must provide the method &ldquo;function string convert2string()&rdquo;, similar to the <a href="../base/uvm_object-svh.html#uvm_object.convert2string" class=LMethod id=link13 onMouseOver="ShowTip(event, 'tt8', 'link13')" onMouseOut="HideTip('tt8')">uvm_object::convert2string</a> method.</p>
<!--START_ND_SUMMARY index=5-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=5 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_class_converter#(T)" id=link12 onMouseOver="ShowTip(event, 'tt5', 'link12')" onMouseOut="HideTip('tt5')">uvm_class_converter #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to convert a class object to a string.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_converter #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
<!--CONTENT index=6 -->
<div class="CClass"><div class=CTopic><h2 class=CTitle><a name="uvm_class_clone#(T)" href="../../src/comps/uvm_policies.svh">uvm_class_clone #(T)</a></h2><div class=CBody><p>This policy class is used to clone class objects.</p><p>Provides a clone method that returns a copy of the built-in type, T.&nbsp; The class T must implement the clone method, to which this class delegates the operation.&nbsp; If T is derived from <a href="../base/uvm_object-svh.html#uvm_object" class=LClass id=link15 onMouseOver="ShowTip(event, 'tt9', 'link15')" onMouseOut="HideTip('tt9')">uvm_object</a>, then T must instead implement <a href="../base/uvm_object-svh.html#uvm_object.do_copy" class=LMethod id=link16 onMouseOver="ShowTip(event, 'tt10', 'link16')" onMouseOut="HideTip('tt10')">uvm_object::do_copy</a>, either directly or indirectly through use of the `uvm_field macros.</p>
<!--START_ND_SUMMARY index=6-->
<div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable>
<!-- index=6 -->
<tr class="SClass"><td colspan=2 class=SEntry><a href="#uvm_class_clone#(T)" id=link14 onMouseOver="ShowTip(event, 'tt6', 'link14')" onMouseOut="HideTip('tt6')">uvm_class_clone #(T)</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>This policy class is used to clone class objects.</td></tr>
<!-- PROTOTYPE -->
<tr class="SPrototype SIndent1"><td colspan=2 class="SEntry SIndent1">Class Declaration</td></tr>
<tr class="SPrototype SIndent1"><td colspan=2 class=SDescription>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_clone #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</td></tr>
</table></div></div><!--END_ND_SUMMARY-->
</div></div></div>
</div><!--Content-->
<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_comp #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to compare built-in types.</div></div><div class=CToolTip id="tt2"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_converter #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to convert built-in types to strings.</div></div><div class=CToolTip id="tt3"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_built_in_clone #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to clone built-in types via the = operator.</div></div><div class=CToolTip id="tt4"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_comp #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to compare two objects of the same type.</div></div><div class=CToolTip id="tt5"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_converter #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to convert a class object to a string.</div></div><div class=CToolTip id="tt6"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype>
<tr><td><table border=0 cellspacing=0 cellpadding=0><tr>
<td class=PBeforeParameters nowrap>class uvm_class_clone #(</td> <td class=PType nowrap>type&nbsp;</td>
<td class=PParameter nowrap>T</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>int</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
This policy class is used to clone class objects.</div></div><div class=CToolTip id="tt7"><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 nowrap>function bit compare (</td> <td class=PType nowrap>uvm_object&nbsp;</td>
<td class=PParameter nowrap>rhs,</td>
<td class=PDefaultValuePrefix>&nbsp;&nbsp;</td>
<td class=PDefaultValue width=100%></td>
</tr><tr><td></td> <td class=PType nowrap>uvm_comparer&nbsp;</td>
<td class=PParameter nowrap>comparer</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>null</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
Deep compares members of this data object with those of the object provided in the <i>rhs</i> (right-hand side) argument, returning 1 on a match, 0 othewise.</div></div><div class=CToolTip id="tt8"><div class=CMethod>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>virtual function string convert2string()
</td></tr></table></blockquote>This virtual function is a user-definable hook, called directly by the user, that allows users to provide object information in the form of a string. </div></div><div class=CToolTip id="tt9"><div class=CClass>
<blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>virtual class uvm_object extends uvm_void
</td></tr></table></blockquote>The uvm_object class is the base class for all UVM data and hierarchical classes. </div></div><div class=CToolTip id="tt10"><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 nowrap>virtual function void do_copy (</td> <td class=PType nowrap>uvm_object&nbsp;</td>
<td class=PParameter nowrap>rhs</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
The do_copy method is the user-definable hook called by the copy method. </div></div><!--END_ND_TOOLTIPS-->
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>