<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Verification Martial Arts</title>
	
	<link>http://www.vmmcentral.org/vmartialarts</link>
	<description>A Blog on Verification Methodology</description>
	<lastBuildDate>Tue, 09 Feb 2010 06:47:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/vmmcentral/vma" /><feedburner:info uri="vmmcentral/vma" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>You get real hierarchy with VMM1.2</title>
		<link>http://feedproxy.google.com/~r/vmmcentral/vma/~3/PiT6VG7nW94/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/?p=934#comments</comments>
		<pubDate>Tue, 09 Feb 2010 06:41:55 +0000</pubDate>
		<dc:creator>Wei-Hua Han</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[VMM 1.2]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=934</guid>
		<description><![CDATA[If you look at VMM1.2 classes, you may find that almost all new() functions have an argument, vmm_object parent. The purpose of this argument is to build a parent-child hierarchy within a VMM1.2 based environment, so that VMM1.2 can provide an infrastructure where users can access the components inside the environment through hierarchical path and [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "You get real hierarchy with VMM1.2", url: "http://www.vmmcentral.org/vmartialarts/?p=934" });</script>]]></description>
			<content:encoded><![CDATA[<p>If you look at VMM1.2 classes, you may find that almost all new() functions have an argument, <em>vmm_object parent</em>. The purpose of this argument is to build a parent-child hierarchy within a VMM1.2 based environment, so that VMM1.2 can provide an infrastructure where users can access the components inside the environment through hierarchical path and name. And this parent-child hierarchy also contributes to the implicit phasing implementation.</p>
<p>Here is a small example to illustrate how a hierarchy can be built with VMM1.2:</p>
<ol>
<li>class mike_c extends vmm_object;     </li>
<li>&#160;&#160; function new(<span style="color: red">vmm_object parent=null</span>, string name=&quot;&quot;);      </li>
<li>&#160;&#160;&#160;&#160;&#160; super.new(parent,name);     </li>
<li>&#160;&#160; endfunction     </li>
<li>endclass     </li>
<li>class ben_c extends vmm_object;     </li>
<li>&#160;&#160; function new(<span style="color: red">vmm_object parent=null</span>, string name=&quot;&quot;);      </li>
<li>&#160;&#160;&#160;&#160;&#160; super.new(parent,name);     </li>
<li>&#160;&#160; endfunction     </li>
<li>endclass     </li>
<li>class jason_c extends vmm_object;     </li>
<li>&#160;&#160; mike_c Mike;     </li>
<li>&#160;&#160; ben_c Ben;     </li>
<li>&#160;&#160; int weight;     </li>
<li>&#160;&#160; function new(<span style="color: red">vmm_object parent=null</span>, string name=&quot;&quot;);      </li>
<li>&#160;&#160;&#160;&#160;&#160; bit is_set;     </li>
<li>&#160;&#160;&#160;&#160;&#160; super.new(parent,name);     </li>
<li>&#160;&#160;&#160;&#160;&#160; weight=vmm_opts::get_object_int(is_set,this, &quot;weight&quot;,0, &quot;set weight&quot;);     </li>
<li>&#160;&#160; endfunction     </li>
<li>&#160;&#160; function void build();     </li>
<li><span style="color: red">&#160;&#160;&#160;&#160;&#160; Mike = new(this,&quot;Mike&quot;);       <br /></span></li>
<li><span style="color: red">&#160;&#160;&#160;&#160;&#160; Ben = new(this,&quot;Ben&quot;);       <br /></span></li>
<li>&#160;&#160; endfunction     </li>
<li>endclass     </li>
<li></li>
<li>program p1;     </li>
<li>&#160;&#160; jason_c Jason;     </li>
<li>&#160;&#160; initial begin     </li>
<li>&#160;&#160;&#160;&#160;&#160; vmm_opts::set_int(&quot;Jason:weight&quot;,10);     </li>
<li><span style="color: red">&#160;&#160;&#160;&#160;&#160; Jason=new(null,&quot;Jason&quot;);       <br /></span></li>
<li>&#160;&#160;&#160;&#160;&#160; Jason.build();     </li>
<li>&#160;&#160;&#160;&#160;&#160; vmm_object::print_hierarchy(Jason);     </li>
<li>&#160;&#160;&#160;&#160;&#160; $display(&quot;Jason has %0d children&quot;,Jason.get_num_children());     </li>
<li>&#160;&#160;&#160;&#160;&#160; $display(Jason.Mike.get_object_name());     </li>
<li>&#160;&#160;&#160;&#160;&#160; $display(Jason.Ben.get_object_hiername());     </li>
<li>&#160;&#160;&#160;&#160;&#160; $display(Jason.weight);     </li>
<li>&#160;&#160; end     </li>
<li>
<div>endprogram       </div>
</li>
</ol>
<p>In this small example, line 30 creates an object (Jason) for jason_c and its parent is &quot;null&quot;, so Jason is a root component in the hierarchy. When Jason.build() is called in line 31, object Mike and Ben are created and their parent is set to Jason. So in this small system we build the following hierarchy:</p>
<p style="margin-left: 36pt">[Jason]</p>
<p style="margin-left: 36pt">|&#8211;[Mike]</p>
<p style="margin-left: 36pt">|&#8211;[Ben]</p>
<p style="margin-left: 36pt">Jason has 2 children</p>
<p style="margin-left: 36pt">Mike</p>
<p style="margin-left: 36pt">Jason:Ben</p>
<p>This hierarchy can be printed by vmm_object method print_hierarchy().</p>
<p>Please note that unlike Verilog modules and instances where the hierarchy is defined as per the Verilog LRM, the VMM1.2 parent-child hierarchy is really user defined. It depends on how &quot;parent&quot; argument is specified when the object is created, and not on where the object variable is declared or created.</p>
<p>As for the component name, although you may choose to specify a different name as the variable name, it is a good practice to keep it consistent, which makes the code more readable and avoids confusion.</p>
<p>From the above example, you can find that the hierarchical name for object Jason.Ben is &quot;Jason:Ben&quot;. VMM1.2 uses &quot;:&quot; as the hierarchical separator instead of &quot;.&quot;. The reason is that this hierarchical name is actually a made-up name, and we want to differentiate it from the semantic hierarchical reference name specified in Verilog/SystemVerilog which uses &quot;.&quot; as the separator.</p>
<p>There are many methods provided in VMM1.2 which help users to work with the parent-child hierarchy. Some of these methods are:</p>
<ul>
<li>find_child_by_name(): finds the named object relative to this object     </li>
<li>get_num_children(): gets the total number of children for this object     </li>
<li>get_nth_child(): returns the nth child of this object     </li>
<li>get_object_hiername(): gets the complete hierarchical name of this object     </li>
<li>get_parent_object():returns the parent of this object     </li>
<li>get_root_object(): gets the root parent of this object     </li>
<li>get_typename(): returns the name of the actual type of this object     </li>
<li>is_parent_of(): returns true, if the specified object is a parent of this object     </li>
<li>print_hierarchy(): prints the object hierarchy     </li>
<li>Set_parent_object(): sets or replaces the parent of this object     </li>
</ul>
<p>Dr. Ambar Sarkar has explained how users can traverse the hierarchy in his <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvP3A9NTI0">blog post</a>.</p>
<p>This parent-child hierarchical infrastructure is one of the most important mechanisms in VMM1.2. Many other VMM1.2 features rely on this infrastructure:</p>
<p><strong>1.&#160;&#160; Implicit phasing</strong></p>
<p>Implicit phasing is new in VMM1.2. In implicit phasing, structural components (transactors) are aligned with each other automatically. The phase specific methods are called automatically throughout the whole hierarchy in a top-down (for functions) or forked (for tasks) mode. Thus implicit phasing makes integration of Verification IPs into the simulation environment or other structural components a lot easier. Other VMM1.2 users also benefit from implicit phasing when building complicated verification environments.</p>
<p><strong>2.&#160;&#160; Factory replacement</strong></p>
<p>Factory is an important feature that enables flexibility and reuse inside a verification environment. Because of the parent-child hierarchy, users can replace components, generated transactions or scenarios with their extension type or other objects by specifying hierarchy path and names. Support for regular expression for specifying hierarchies and names make this utility very powerful.</p>
<p>For example, in the following code segment, we override the type <em>mike_c</em> for <em>Mike</em> with <em>mike_ext</em> :</p>
<p>&#160;&#160;&#160;&#160;&#160; mike_c::override_with_new(&quot;@%Jason:Mike&quot;,mike_ext::this_type,log);</p>
<p><strong>3.&#160;&#160; Hierarchical configuration</strong></p>
<p>In addition to supporting runtime configuration through command-line options or files, using the parent-child hierarchy VMM1.2 also supports configuration of components by specifying their hierarchical path and name. All these configuration utilities are provided through vmm_opts.</p>
<p>For example, in the following code segment, we set the property <em>weight</em> of object <em>Jason</em> to <em>10</em> using hierarchical configuration:</p>
<p>&#160;&#160; vmm_opts::set_int(&quot;Jason:weight&quot;,10);</p>
<p>Like factory, users can also use regular expression with hierarchical configuration.</p>
<p>If you have watched &quot;Growing Pains&quot;, you know that I am not quite accurate when I say</p>
<p>&#160;&#160; Jason has 2 children</p>
<p>He indeed has three&#8230;</p>
<p>Have fun with VMM1.2. <span style="font-family: wingdings">J</span></p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=934" width="1" height="1" style="display: none;" /><p><a href="http://sharethis.com/item?&wp=2.8.4&amp;publisher=b6935ab9-2078-4b1e-8193-7b0edf235e2d&amp;title=You+get+real+hierarchy+with+VMM1.2&amp;url=http%3A%2F%2Fwww.vmmcentral.org%2Fvmartialarts%2F%3Fp%3D934">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/vmmcentral/vma/~4/PiT6VG7nW94" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/?feed=rss2&amp;p=934</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vmmcentral.org/vmartialarts/?p=934</feedburner:origLink></item>
		<item>
		<title>Leverage on the built-in callback inside vmm_atomic_gen and be productive with DVE features for VMM debug</title>
		<link>http://feedproxy.google.com/~r/vmmcentral/vma/~3/z1YtdLRawnc/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/?p=922#comments</comments>
		<pubDate>Mon, 08 Feb 2010 00:14:03 +0000</pubDate>
		<dc:creator>srini</dc:creator>
				<category><![CDATA[Debug]]></category>
		<category><![CDATA[VMM]]></category>
		<category><![CDATA[vmm_channel]]></category>
		<category><![CDATA[vmm_xactor]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=922</guid>
		<description><![CDATA[Srinivasan Venkataramanan, CVC Pvt. Ltd.
Rashmi Talanki, Sasken
John Paul Hirudayasamy, Synopsys
During a recent Verification environment creation for a customer we had to tap an additional copy/reference of the generated transaction to another component in the environment without affecting the flow. So one producer gets more than one consumer (here 2 consumers). As a first time VMM [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Leverage on the built-in callback inside vmm_atomic_gen and be productive with DVE features for VMM debug", url: "http://www.vmmcentral.org/vmartialarts/?p=922" });</script>]]></description>
			<content:encoded><![CDATA[<p>Srinivasan Venkataramanan, CVC Pvt. Ltd.</p>
<p>Rashmi Talanki, Sasken</p>
<p>John Paul Hirudayasamy, Synopsys</p>
<p>During a recent Verification environment creation for a customer we had to tap an additional copy/reference of the generated transaction to another component in the environment without affecting the flow. So one producer gets more than one consumer (here 2 consumers). As a first time VMM coder the customer tried using “<em>vmm_channel::peek</em>” on the channel that was connecting GEN to BFM. Initially it seemed to work, but with some more complex code being added across the 2 consumers for the channel, things started getting funny – one of the consumers received the transactions more than once for instance.</p>
<p>The log file looked like:</p>
<blockquote><p>@ (N-1) ns the transaction was peeked by Master_BFM  0.0.0</p>
<p>@ (N-1) ns the transaction was peeked by Slave_BFM 0.0.0</p>
<p>.</p>
<p>.(perform the task)</p>
<p>.</p>
<p>@N ns the Master_BFM  get the transaction 0.0.0</p>
<p>@N ns the transaction was peeked by <strong><span style="color: #ff0000">Slave_BFM 0.0.0</span></strong></p>
<p>@N ns the transaction was peeked by Master_BFM 0.0.1</p>
<p>@N ns the transaction was peeked by Slave_BFM 0.0.1</p></blockquote>
<p>With little reasoning from CVC team, the customer understood the issue quickly to be classical race condition of 2 consumers waiting for same transaction. What are the options, well several indeed:</p>
<p>1. Use <em>vmm_channel::tee()</em> (See our VMM Adoption book <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3N5c3RlbXZlcmlsb2cudXMvdm1tX2luZm8uaHRtbA==">http://systemverilog.us/vmm_info.html</a> for an example)</p>
<p>2. Use callbacks – a flexible, robust means to provide extensions for any such future requirements</p>
<p>3. Use <em>vmm_broadcaster</em></p>
<p>4. Use the new VMM 1.2 Analysis Ports (See a good thread on this: http://www.vmmcentral.org/vmartialarts/?p=860 )</p>
<p>The customer liked the callbacks route but was hesitant to move towards the lengthy route of callbacks – for few reasons (valid for first timers).</p>
<p>1. Coding callbacks takes more time than simple chan.peek(), especially the facade class &amp; inserting at the right place</p>
<p>2. She was using the built-in `vmm_atomic_gen macro to create the generator and didn’t know exactly how to add the callbacks there as it is pre-coded!</p>
<p>Up for review, we discussed the pros and cons of the approaches and when I mentioned about the built-in <em>post_inst_gen</em> callback inside the <em>vmm_atomic_gen</em> she got a pleasant surprise – that takes care of 2 of the 4 steps in the typical callbacks addition step as being recommended by CVC’s popular DR-VMM course (<a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy5jdmNibHIuY29tL3RybmdfcHJvZmlsZXMvQ1ZDX0RSX1ZNTV9wcm9maWxlLnBkZg==">http://www.cvcblr.com/trng_profiles/CVC_DR_VMM_profile.pdf</a>).</p>
<p>Step-1: Declaring a facade class with needed tasks/methods</p>
<p>Step-2: Inserting the callback at “strategic” location inside the component (in this case generator)</p>
<p>This leaves only the Steps 3 &amp; 4 for the end user – not bad for a robust solution (especially given that the Step-4 is more of formality of registration). Now that the customer is convinced, it is time to move to coding desk to get it working. She opened up vmm.sv and got trapped in the multitude of `define vmm_atomic_gen_* macros with all those nice looking “ \ “ at the end – thanks to SV’s style of creating macros with arguments. Though powerful, it is not the easiest one to read and decipher – again for a first time SV/VMM user.</p>
<p>Now comes the rescue in terms of well proven DVE – the VCS’s robust GUI front end. Its macro expansion feature that works as cleanly as it can get is at times hard to locate. But with our toolsmiths ready for assistance at CVC, it took hardly a few clicks to reveal the magic behind the `vmm_atomic_gen(icu_xfer). Here is a first look at the atomic gen code inside DVE.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTAvMDIvY2xpcF9pbWFnZTAwMi5naWY="><img style="border-top-width: 0px;border-left-width: 0px;border-bottom-width: 0px;border-right-width: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2010/02/clip_image002_thumb.gif" border="0" alt="clip_image002" width="244" height="145" /></a></p>
<p>Once the desired text macro is selected, DVE has a “CSM – Context Sensitive Menu” to expand the macro with arguments. It is “Show à Macro”, as seen below in the screenshot.</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTAvMDIvY2xpcF9pbWFnZTAwNC5qcGc="><img style="border-top-width: 0px;border-left-width: 0px;border-bottom-width: 0px;border-right-width: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2010/02/clip_image004_thumb.jpg" border="0" alt="clip_image004" width="244" height="150" /></a></p>
<p>With a quick bang go on DVE – the Macros expander popped up revealing the nicely expanded, with all class name argument substituted source code for the actual atomic_generator that gets created by the one liner macro. Along with clearly visible were the facade class name and the actual callback task with clear argument list (something that’s not obvious by looking at standard vmm.sv).</p>
<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTAvMDIvY2xpcF9pbWFnZTAwNi5naWY="><img style="border-top-width: 0px;border-left-width: 0px;border-bottom-width: 0px;border-right-width: 0px" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2010/02/clip_image006_thumb.gif" border="0" alt="clip_image006" width="244" height="146" /></a></p>
<p> Now, what’s more – in DVE, you can bind such “nice feature” to a convenient hot-key if you like (say if you intend to use this feature often). Here is the trick:</p>
<p>Add the following to your $HOME/.synopsys_dve_usersetup.tcl</p>
<blockquote><p>gui_set_hotkey -menu &#8220;Scope-&gt;Show-&gt;Macro&#8221; -hot_key &#8220;F6&#8243;</p></blockquote>
<p>Now when you select a macro and type “F6” – the macro expands, no rocket science, but a cool convenient feature indeed!</p>
<p>Voila – learnt 2 things today – the built-in callback inside the vmm_atomic_gen can save more than 50% of coding and can match up to the effort (or the lack of) of using simple chan.peek(). The second one being DVE’s macro expansion feature that makes debugging a real fun!</p>
<p>Kudos to VMM and the ever improving DVE!</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=922" width="1" height="1" style="display: none;" /><p><a href="http://sharethis.com/item?&wp=2.8.4&amp;publisher=b6935ab9-2078-4b1e-8193-7b0edf235e2d&amp;title=Leverage+on+the+built-in+callback+inside+vmm_atomic_gen+and+be+productive+with+DVE+features+for+VMM+debug&amp;url=http%3A%2F%2Fwww.vmmcentral.org%2Fvmartialarts%2F%3Fp%3D922">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/vmmcentral/vma/~4/z1YtdLRawnc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/?feed=rss2&amp;p=922</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vmmcentral.org/vmartialarts/?p=922</feedburner:origLink></item>
		<item>
		<title>Verification in the trenches: Implementing Complex Synchronization Between Components Using VMM1.2</title>
		<link>http://feedproxy.google.com/~r/vmmcentral/vma/~3/3OSL6Cjvz54/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/?p=910#comments</comments>
		<pubDate>Fri, 05 Feb 2010 21:04:35 +0000</pubDate>
		<dc:creator>Ambar Sarkar</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=910</guid>
		<description><![CDATA[ Dr. Ambar Sarkar, Chief Verification Technologist, Paradigm Works Inc.
Why is it tricky to get transactors and other verification components to work in sync with each other, especially&#160; if they come from different projects?&#160; It is likely that they worked well within their source projects,&#160; but their phases (build, configure, reset, start, shutdown etc) were [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Verification in the trenches: Implementing Complex Synchronization Between Components Using VMM1.2", url: "http://www.vmmcentral.org/vmartialarts/?p=910" });</script>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMDkvMTIvYW1iYXIuanBn"><img style="border-right-width: 0px;border-top-width: 0px;border-bottom-width: 0px;margin-left: 0px;border-left-width: 0px;margin-right: 0px" border="0" alt="ambar" align="left" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2009/12/ambar_thumb.jpg" width="108" height="87" /></a> Dr. Ambar Sarkar, Chief Verification Technologist, Paradigm Works Inc.</p>
<p>Why is it tricky to get transactors and other verification components to work in sync with each other, especially&#160; if they come from different projects?&#160; It is likely that they worked well within their source projects,&#160; but their phases (build, configure, reset, start, shutdown etc) were implemented quite differently compared to other components. These differences are usually driven by the inherent protocol requirements or team preferences. For example, consider the verification of an SOC with an AXI&#160; host interface and a PCIe Root Complex. You will likely get your host interface transactor out of reset and execute a configuration sequence before you let your PCIe end point transactor send in requests. So you would not want to run the phases of these two transactors in lock step.</p>
<p>While there are countless ways to implement the phases and their sequencing, one can broadly classify a component&#160; as being either explicitly or implicitly driven, depending on how its phases are invoked.</p>
<p><strong>Implicit phasing</strong>: In my <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvP3A9OTA5">earlier post</a>, we discussed how one can often easily coordinate the execution of various verification components. Simply put, as long as one is able to distribute the execution of the component between predetermined methods (called phases), the components can execute in lock-step with one another without requiring any additional coding by the verification engineer. This is called implicit phasing. Implicit phasing may suffice in many cases, but the challenge is to agree on the same set of phases and their sequencing. You basically will need a way to define additional&#160; phases and potentially even rearrange their implicit calling sequence.</p>
<p><strong>Explicit phasing</strong>: In contrast, explicit phasing requires the environment writer to explicitly call and synchronize the phases of the components. Typically, it takes some work to get such components to play well with one another.&#160; This happens more often for legacy or externally developed components. In such cases, the&#160; developers may not have known about the predetermined phases so they could not have broken down the implementation quite the way the target environment expects. Explicit phasing is often unavoidable in environments with components from multiple sources, since you may need to carefully control and coordinate the phases by hand to accommodate their differing implementation assumptions.</p>
<p>So the challenge we are discussing today is really about making these explicit and implicit phased components get their phases to match and cooperate during their phase transitions.</p>
<p>This is where vmm_timeline helps. Simply put, vmm_timeline object encapsulates your implicitly phased object and allows it to be called as an explicitly phased object.&#160; It lets you define your own phases and the sequence in which you want to execute them. The ability to customize phases is critical, as you may need to define additional phases to fit in with the way the explicitly phased target&#160; environment expects its phases to execute.</p>
<p>Here is an example that shows how an implicitly-phased component(<strong>my_implicit_comp</strong>) is being executed within an explicitly-phased <strong>my_env.</strong> Notice how the <strong>my_tl</strong>(derived from <strong>vmm_timeline</strong>) is used.</p>
<p><strong>Step a. Create a vmm_timeline object and instantiate the components</strong></p>
<table border="1" cellspacing="1" cellpadding="2" width="656">
<tbody>
<tr>
<td valign="top" width="652"><strong>// Implicitly phased comp            <br /></strong>class <strong>my_implicit_comp</strong> extends <strong>vmm_group</strong>;           <br /><strong>&#160; `vmm_typename</strong>(<strong>my_implicit_comp</strong>)&#160; <br />&#160; …           <br />&#160; function new(string name = &quot;&quot;,           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; vmm_object parent = null);           <br />&#160;&#160;&#160; super.new(&quot;my_implicit_comp&quot;, name, null);           <br />&#160;&#160;&#160; super.set_parent_object(parent);           <br />&#160; endfunction
<p>&#160; virtual function void build_ph();            <br />&#160;&#160;&#160; super.build_ph();&#160; <br />&#160;&#160;&#160; …</p>
<p>&#160; endfunction            <br />&#160; …</p>
<p>endclass</p>
<p><strong>// Create a vmm_timeline class to wrap this implicitly phased component</strong></p>
<p>class <strong>my_tl</strong> extends <strong>vmm_timeline</strong>;&#160; <br />&#160; `vmm_typename(my_tl)&#160; <br />&#160;&#160; <strong>my_implicit_comp comp1;&#160; <br />&#160; </strong></p>
<p><strong>&#160; </strong>function new(string name = &quot;&quot;,&#160; <br />&#160;&#160;&#160; vmm_object parent = null);             <br />&#160;&#160;&#160; super.new(&quot;my_tl&quot;, name, parent);             <br />&#160; endfunction</p>
<p>&#160; virtual function void build_ph();&#160;&#160; <br />&#160;&#160;&#160; super.build_ph(); </p>
<p>&#160; <strong>&#160; // Create an instance              <br />&#160;&#160;&#160; </strong><strong>this.comp1 = my_implicit_comp::create_instance(this, “comp1”);&#160; <br /></strong>&#160; endfunction             </p>
<p>endclass</p>
</td>
</tr>
</tbody>
</table>
<p align="left"><strong>Step b. Instantiate in top-level vmm_env and call out the implicit methods</strong></p>
<table border="1" cellspacing="1" cellpadding="2" width="626">
<tbody>
<tr>
<td valign="top" width="622"><strong>// Instantiate the vmm_timeline object in the top environment and call its phases explicitly.</strong>
<p><strong>class my_env extends vmm_env</strong>;             <br />&#160; `vmm_typename(my_env)             <br /><strong>&#160; my_tl tl;              <br /></strong></p>
<p>&#160; function new();            <br />&#160;&#160;&#160; super.new(&quot;env&quot;);             <br />&#160; endfunction</p>
<p><strong>&#160; virtual function void build();              <br /></strong>&#160;&#160;&#160; super.build();             <br /><strong>&#160;&#160;&#160; this.tl = new(&quot;tl&quot;, this);              <br /></strong>&#160; endfunction</p>
<p><strong>&#160; virtual task start();              <br /></strong>&#160;&#160;&#160; super.start();             <br /><strong>&#160;&#160;&#160; tl.run_phase(&quot;start&quot;);              <br /></strong>&#160;&#160; `vmm_note(log, &quot;Started&#8230;&quot;);             <br />&#160; endtask</p>
<p><strong>&#160; virtual task wait_for_end();              <br /></strong>&#160;&#160;&#160;&#160; super.wait_for_end();             <br />&#160;&#160;&#160;&#160; fork             <br />&#160;&#160;&#160;&#160;&#160;&#160; // run_test phase corresponds best here             <br /><strong>&#160;&#160;&#160;&#160;&#160;&#160; tl.run_phase(&quot;run_test&quot;);              <br /></strong>&#160;&#160;&#160;&#160;&#160;&#160; begin             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; `vmm_note(log, &quot;Running&#8230;&quot;);             <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; #100;             <br />&#160;&#160;&#160;&#160;&#160;&#160; end             <br />&#160;&#160;&#160; join             <br />&#160; endtask</p>
<p><strong>&#160; virtual task stop();              <br /></strong>&#160;&#160;&#160; super.stop();</p>
<p>&#160;&#160;&#160; // shutdown phase corresponds best here            <br /><strong>&#160;&#160;&#160; tl.run_phase(&quot;shutdown&quot;);              <br /></strong>&#160;&#160;&#160; `vmm_note(log, &quot;Stopped&#8230;&quot;);             <br />&#160; endtask</p>
</td>
</tr>
</tbody>
</table>
<p>Note that the converse is also true. Explicitly phased components can be incorporated into implicitly driven environments. You need to encapsulate them in a parent class derived from the <strong>vmm_subenv</strong> class and define how each implicit phase of the parent class can be mapped to the proper explicit phase(s) of the original component. Then you can simply instantiate this parent class in the target environment. For further details, search the string “Mixed Phasing” in the VMM 1.2 User Guide.<strong> </strong></p>
<p>In summary, vmm_timeline helps you manage different phasing and sequencing needs of verification components by making it easier for explicitly and implicitly phased components to interact. No wonder that under the hood of VMM1.2, vmm_timeline is used to implement advanced features such as multi-test concatenation.</p>
<p>This article is the 4<sup>th</sup> in the <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvP3A9NDgx"><em>Verification in the trenches</em></a><em> series</em>. Hope you found this article useful. If you would like to hear about any other related topic, please comment or drop me a line at ambar.sarkar@paradigm-works.com. Also, if you are starting out fresh, please check out the free VMM1.2 environment generator at <a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3Jlc291cmNld29ya3MucGFyYWRpZ20td29ya3MuY29tL3N2ZnRnL3ZtbQ=="><em>http://resourceworks.paradigm-works.com/svftg/vmm</em></a><em> . </em></p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=910" width="1" height="1" style="display: none;" /><p><a href="http://sharethis.com/item?&wp=2.8.4&amp;publisher=b6935ab9-2078-4b1e-8193-7b0edf235e2d&amp;title=Verification+in+the+trenches%3A+Implementing+Complex+Synchronization+Between+Components+Using+VMM1.2&amp;url=http%3A%2F%2Fwww.vmmcentral.org%2Fvmartialarts%2F%3Fp%3D910">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/vmmcentral/vma/~4/3OSL6Cjvz54" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/?feed=rss2&amp;p=910</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vmmcentral.org/vmartialarts/?p=910</feedburner:origLink></item>
		<item>
		<title>The Curious World of Ports and Exports in VMM 1.2</title>
		<link>http://feedproxy.google.com/~r/vmmcentral/vma/~3/0zbEG-Fm82Q/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/?p=901#comments</comments>
		<pubDate>Thu, 04 Feb 2010 22:31:21 +0000</pubDate>
		<dc:creator>John Aynsley</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=901</guid>
		<description><![CDATA[
John Aynsley, CTO, Doulos
&#160;
&#160;
In a previous post I discussed the new blocking transport interface of VMM 1.2, and described how a producer can call the b_transport method implemented by a consumer. In this post, I will describe how to connect the producer to the consumer using the new features of VMM 1.2.
The new features discussed [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "The Curious World of Ports and Exports in VMM 1.2", url: "http://www.vmmcentral.org/vmartialarts/?p=901" });</script>]]></description>
			<content:encoded><![CDATA[<h6><a href="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?url=aHR0cDovL3d3dy52bW1jZW50cmFsLm9yZy92bWFydGlhbGFydHMvd3AtY29udGVudC91cGxvYWRzLzIwMTAvMDEvSm9obkF5bnNsZXkuanBn"><img height="112" alt="JohnAynsley" src="http://www.vmmcentral.org/vmartialarts/wp-content/uploads/2010/01/JohnAynsley_thumb.jpg" width="101" border="0" /></a></h6>
<h3>John Aynsley, CTO, Doulos</h3>
<p>&#160;</p>
<p>&#160;</p>
<p>In a previous post I discussed the new blocking transport interface of VMM 1.2, and described how a producer can call the <b>b_transport</b> method implemented by a consumer. In this post, I will describe how to connect the producer to the consumer using the new features of VMM 1.2.</p>
<p>The new features discussed here were inspired by the SystemC TLM-2.0 standard. In SystemC, two modules wishing to communicate get connected using so-called “ports” and “exports”. Although the underlying concept is both elegant and powerful, the terminology “port” and “export” often seems to cause confusion. Since this is now part of VMM 1.2, I will explain. Let us consider a simple example of a producer calling the <b>b_transport</b> method implemented in a consumer.</p>
<p>class my_tx extends vmm_data; // User-defined transaction class   <br />&#160;&#160;&#160; &#8230;</p>
<p>class producer extends vmm_xactor;   <br />&#160;&#160;&#160; vmm_tlm_b_transport_port #(producer, my_tx) m_port;    <br />&#160;&#160;&#160; my_tx tx;    <br />&#160;&#160;&#160; &#8230;</p>
<p>&#160;&#160;&#160; m_port.b_transport(tx, delay);   <br />&#160;&#160;&#160; &#8230;</p>
<p>class consumer extends vmm_xactor;   <br />&#160;&#160;&#160; vmm_tlm_b_transport_export #(consumer, my_tx) m_export;    <br />&#160;&#160;&#160; task b_transport(int id = -1, my_tx trans, ref int delay);    <br />&#160;&#160;&#160; &#8230;</p>
<p>class my_env extends vmm_group;   <br />&#160;&#160;&#160; producer m_producer;    <br />&#160;&#160;&#160; consumer m_consumer;</p>
<p>&#160;&#160;&#160; virtual function void connect_ph;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; m_producer.m_port.tlm_bind( m_consumer.m_export );    <br />&#160;&#160;&#160; endfunction    <br />&#160;&#160;&#160; &#8230;</p>
<p>What is happening here is that the producer is calling <b>b_transport</b> through a port, the consumer is providing an implementation of <b>b_transport</b> using an export, and the top-level environment is connecting (or “binding”) the port to the export. The <b>tlm_bind</b> method is creating the link between the port and the export such that when the producer calls <b>b_transport</b>, it is the implementation of <b>b_transport</b> within the consumer that actually gets called.</p>
<p>Both the port and the export declarations are parameterized with the type of the transactor (producer/consumer) and the type of the transaction (my_tx). You may notice that the implementation of <b>b_transport</b> has an extra <b>int id</b> argument. This can be used to distinguish between transactions arriving from different producers. I will discuss this in my next blog post.</p>
<p>The purpose of ports and exports is to provide a structured way of making method calls between VMM transactors (or SystemC modules) such that the dependencies between each transactor and its environment can be minimized. To call <b>b_transport</b> the code within the producer only need refer to the port and has no direct dependencies on any code outside that transactor. Similarly, to call the <b>b_transport</b> method implemented within the consumer, the environment only need refer to the export. It is only when the port and export are connected within the <b>connect_ph</b> method of the environment that a specific dependency is established between the producer and consumer transactors.</p>
<p>What about those terms “port” and “export”? The term port was originally borrowed from VHDL and Verilog. In SystemC, a port allows an interface method call to be made up-and-out-of a module. When SystemC was enhanced to add the mirror image construct that allows an interface method call to be made down-and-into a module the term “export” was chosen because an export provides or “exports” an interface, whereas a port “imports” an interface.</p>
<p>If we could re-write history, I guess we might have chosen the term “import” instead of “port”. Perhaps that would have caused less confusion. Or maybe not!</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=901" width="1" height="1" style="display: none;" /><p><a href="http://sharethis.com/item?&wp=2.8.4&amp;publisher=b6935ab9-2078-4b1e-8193-7b0edf235e2d&amp;title=The+Curious+World+of+Ports+and+Exports+in+VMM+1.2&amp;url=http%3A%2F%2Fwww.vmmcentral.org%2Fvmartialarts%2F%3Fp%3D901">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/vmmcentral/vma/~4/0zbEG-Fm82Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/?feed=rss2&amp;p=901</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.vmmcentral.org/vmartialarts/?p=901</feedburner:origLink></item>
		<item>
		<title>Shorthand macros with user defined implementation</title>
		<link>http://feedproxy.google.com/~r/vmmcentral/vma/~3/LxY10f5Kik4/</link>
		<comments>http://www.vmmcentral.org/vmartialarts/?p=899#comments</comments>
		<pubDate>Wed, 03 Feb 2010 21:24:37 +0000</pubDate>
		<dc:creator>Vidyashankar Ramaswamy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.vmmcentral.org/vmartialarts/?p=899</guid>
		<description><![CDATA[&#160;
The transaction class objects are created by extending the base class vmm_data. Vmm_data class has many virtual methods which need to be implemented by the extended class. This can become a laborious process as this is done for each extended class object. However, a set of shorthand macros available to help minimize the amount of [...]<script type="text/javascript">SHARETHIS.addEntry({ title: "Shorthand macros with user defined implementation", url: "http://www.vmmcentral.org/vmartialarts/?p=899" });</script>]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p align="justify">The transaction class objects are created by extending the base class vmm_data. Vmm_data class has many virtual methods which need to be implemented by the extended class. This can become a laborious process as this is done for each extended class object. However, a set of shorthand macros available to help minimize the amount of code required to create these data class extensions. These shorthand macros can be used on per data member basis which provides a default implementation of all the require methods. Following is an example.</p>
<table cellspacing="0" cellpadding="2" width="582" border="1">
<tbody>
<tr>
<td valign="top" width="580">
<p>&#160;&#160;&#160;&#160;&#160; . . .&#160; <br />1&#160;&#160;&#160; <font color="#008000">class </font>apb_trans <font color="#008000">extends</font> vmm_data;             <br />2&#160;&#160;&#160;&#160;&#160;&#160; `vmm_typename(apb_trans)</p>
<p>3&#160;&#160;&#160;&#160;&#160;&#160; rand enum {READ, WRITE} <font color="#008080">kind</font>;             <br />4&#160;&#160;&#160;&#160;&#160;&#160; rand bit [31:0] addr;             <br />5&#160;&#160;&#160;&#160;&#160;&#160; rand logic [31:0] data;</p>
<p>6&#160;&#160;&#160;&#160;&#160;&#160; `vmm_data_member_begin(apb_trans)            <br />7&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; `vmm_data_member_scalar(addr, DO_ALL)             <br />8&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; `vmm_data_member_scalar(data, DO_ALL)             <br />9&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; `vmm_data_member_enum(<font color="#008080">kind</font>, DO_ALL)             <br />10&#160;&#160;&#160;&#160; `vmm_data_member_end(apb_trans)             <br />11&#160;&#160;&#160;&#160; …             <br />12&#160; <font color="#008000">endclass:</font> apb_trans&#160; <br />&#160;&#160;&#160;&#160;&#160; . . .</p>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p align="justify">The class properties are declared as shown in Line number 3 to 5. Line number 6 and 10 marks the start and end of the shorthand macro section. Based on the variable type , the appropriate macros are called (line number 7 to 9). As the name says “DO_ALL” means use this variable in all the virtual method implementations. Say if you want to exclude the “<font color="#008080">kind</font>” property from printing, then you can use “DO_ALL – DO_PRINT”. Please refer to the VMM user guide for more details on this.</p>
<p><b><font size="3">User defined implementation</font> </b></p>
<p align="justify">Shorthand macros provide the default implementation for all the vmm_data virtual methods. If you want to override the default implementation of a method, then you have to implement the do_* method. For example say you want to change the implementation for byte_size, You can still use shorthand macros but need to explicitly implement the apb_trans::do_byte_size() method and force VMM not to provide the default implementation. The example code is shown below.</p>
<table cellspacing="0" cellpadding="2" width="583" border="1">
<tbody>
<tr>
<td valign="top" width="581">
<p>1&#160;&#160; <font color="#008000">virtual function</font> int unsigned <font color="#ff8000">do_byte_size</font> (int kind = –1) ;             <br />2&#160;&#160;&#160;&#160;&#160;&#160; . . .             <br />3&#160;&#160;&#160;&#160;&#160;&#160; . . .             <br />4&#160;&#160; <font color="#008000">endfunction</font></p>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p><b><font size="3">Constructor replacement</font></b></p>
<p align="justify">In some cases a transaction class might need a custom constructor with different arguments. Please note that the explicit constructor implementation is done using the shorthand macro `vmm_data_new() as shown below (line 1). The new implementation should follow the macro definition (Line number 2 to 5). It is also important to provide default values for the arguments to make the transaction class factory-enabled (Line number 2).</p>
<table cellspacing="0" cellpadding="2" width="584" border="1">
<tbody>
<tr>
<td valign="top" width="582">
<p>1&#160;&#160; <font color="#ff8000">`vmm_data_new</font>(apb_trans)             <br />2&#160;&#160; <font color="#008000">function </font>new (vmm_log log=null, vmm_object parent=null, string name=””);             <br />3&#160;&#160;&#160;&#160;&#160;&#160; super.new(. . ., . . .) ;             <br />4&#160;&#160;&#160;&#160;&#160;&#160; . . .&#160; <br />5&#160;&#160; <font color="#008000">endfunction</font></p>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p align="justify">The shorthand macros are also available for messaging service (vmm_log), vmm_unit configuration, RTL configuration (vmm_rtl_config) and TLM ports. For the complete list, please refer to the VMM user guide.</p>
 <img src="http://www.vmmcentral.org/vmartialarts/wp-content/plugins/feed-statistics.php?view=1&post_id=899" width="1" height="1" style="display: none;" /><p><a href="http://sharethis.com/item?&wp=2.8.4&amp;publisher=b6935ab9-2078-4b1e-8193-7b0edf235e2d&amp;title=Shorthand+macros+with+user+defined+implementation&amp;url=http%3A%2F%2Fwww.vmmcentral.org%2Fvmartialarts%2F%3Fp%3D899">ShareThis</a></p><img src="http://feeds.feedburner.com/~r/vmmcentral/vma/~4/LxY10f5Kik4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vmmcentral.org/vmartialarts/?feed=rss2&amp;p=899</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vmmcentral.org/vmartialarts/?p=899</feedburner:origLink></item>
	</channel>
</rss>
