blob: d45cb4ee9438bbe253c23f4c063feca28e0eb962 [file] [log] [blame]
<html><head><title>Factory 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="Factory_Classes" href="../../src/overviews/factory.txt">Factory Classes</a></h1><div class=CBody><p>As the name implies, the <a href="../base/uvm_factory-svh.html#uvm_factory" class=LClass id=link2 onMouseOver="ShowTip(event, 'tt1', 'link2')" onMouseOut="HideTip('tt1')">uvm_factory</a> is used to manufacture (create) UVM objects and components.&nbsp; Only one instance of the factory is present in a given simulation.</p><p>User-defined object and component types are registered with the factory via typedef or macro invocation, as explained in <a href="../base/uvm_factory-svh.html#uvm_factory.Usage" class=LGroup id=link3 onMouseOver="ShowTip(event, 'tt2', 'link3')" onMouseOut="HideTip('tt2')">uvm_factory::Usage</a>.&nbsp; The factory generates and stores lightweight proxies to the user-defined objects and components: <a href="../base/uvm_registry-svh.html#uvm_object_registry#(T,Tname)" class=LClass id=link4 onMouseOver="ShowTip(event, 'tt3', 'link4')" onMouseOut="HideTip('tt3')">uvm_object_registry #(T,Tname)</a> for objects and <a href="../base/uvm_registry-svh.html#uvm_component_registry#(T,Tname)" class=LClass id=link5 onMouseOver="ShowTip(event, 'tt4', 'link5')" onMouseOut="HideTip('tt4')">uvm_component_registry #(T,Tname)</a> for components.&nbsp; Each proxy only knows how to create an instance of the object or component it represents, and so is very efficient in terms of memory usage.</p><p>When the user requests a new object or component from the factory (e.g.&nbsp; <a href="../base/uvm_factory-svh.html#uvm_factory.create_object_by_type" class=LMethod id=link6 onMouseOver="ShowTip(event, 'tt5', 'link6')" onMouseOut="HideTip('tt5')">uvm_factory::create_object_by_type</a>), the factory will determine what type of object to create based on its configuration, then ask that type&rsquo;s proxy to create an instance of the type, which is returned to the user.</p><img src="../../images/uvm_ref_factory.gif" width="472" height="131">
<!--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="#Factory_Classes" >Factory Classes</a></td></tr>
<tr class=SMain><td colspan=2 class=SWideDescription>As the name implies, the <a href="../base/uvm_factory-svh.html#uvm_factory" class=LClass id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">uvm_factory</a> is used to manufacture (create) UVM objects and components. </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>class uvm_factory
</td></tr></table></blockquote>As the name implies, uvm_factory is used to manufacture (create) UVM objects and components. </div></div><div class=CToolTip id="tt2"><div class=CGroup>Using the factory involves three basic operations</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 colspan=5>class uvm_object_registry #(</td> </tr><tr><td>&nbsp;&nbsp;&nbsp;</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%>uvm_object,</td>
</tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>string&nbsp;</td>
<td class=PParameter nowrap>Tname</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>&quot;&lt;unknown&gt;&quot;</td>
</tr>
<tr>
<td class=PAfterParameters colspan=5>) extends uvm_object_wrapper</td></tr>
</table></td></tr>
</table></blockquote>
The uvm_object_registry serves as a lightweight proxy for an uvm_object of type <i>T</i> and type name <i>Tname</i>, a string. </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 colspan=5>class uvm_component_registry #(</td> </tr><tr><td>&nbsp;&nbsp;&nbsp;</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%>uvm_component,</td>
</tr><tr><td>&nbsp;&nbsp;&nbsp;</td> <td class=PType nowrap>string&nbsp;</td>
<td class=PParameter nowrap>Tname</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>&quot;&lt;unknown&gt;&quot;</td>
</tr>
<tr>
<td class=PAfterParameters colspan=5>) extends uvm_object_wrapper</td></tr>
</table></td></tr>
</table></blockquote>
The uvm_component_registry serves as a lightweight proxy for a component of type <i>T</i> and type name <i>Tname</i>, a string. </div></div><div class=CToolTip id="tt5"><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 uvm_object create_object_by_type (</td> <td class=PType nowrap>uvm_object_wrapper&nbsp;</td>
<td class=PParameter nowrap>requested_type,</td>
<td class=PDefaultValuePrefix>&nbsp;&nbsp;</td>
<td class=PDefaultValue width=100%></td>
</tr><tr><td></td> <td class=PType nowrap>string&nbsp;</td>
<td class=PParameter nowrap>parent_inst_path</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>&quot;&quot;,</td>
</tr><tr><td></td> <td class=PType nowrap>string&nbsp;</td>
<td class=PParameter nowrap>name</td>
<td class=PDefaultValuePrefix>&nbsp;=&nbsp;</td>
<td class=PDefaultValue width=100%>&quot;&quot;</td>
<td class=PAfterParameters nowrap>)</td></tr>
</table></td></tr>
</table></blockquote>
</div></div><!--END_ND_TOOLTIPS-->
<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>