<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Verilab Blog</title>
	
	<link>http://www.verilab.com/blog</link>
	<description>Verilab</description>
	<pubDate>Mon, 15 Sep 2008 23:35:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/VerilabBlog" type="application/rss+xml" /><item>
		<title>DAC 2008 Presentations Now Posted</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/350598930/</link>
		<comments>http://www.verilab.com/blog/2008/07/dac-2008-presentations-now-posted/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 15:37:50 +0000</pubDate>
		<dc:creator>JL Gray</dc:creator>
		
		<category><![CDATA[Conferences]]></category>

		<category><![CDATA[Methodology]]></category>

		<category><![CDATA[News]]></category>

		<category><![CDATA[SystemVerilog]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2008/07/dac-2008-presentations-now-posted/</guid>
		<description><![CDATA[Just a quick FYI&#8230; both David Robinson and I have posted our DAC presentations on Verification Planning and SystemVerilog Interoperability on the Verilab website.  Please check them out and let us know if you have any questions or comments!
]]></description>
			<content:encoded><![CDATA[<p>Just a quick FYI&#8230; both David Robinson and I have posted our DAC presentations on Verification Planning and SystemVerilog Interoperability on the <a href="http://www.verilab.com/resources/papers-and-presentations/">Verilab website</a>.  Please check them out and let us know if you have any questions or comments!</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/350598930" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2008/07/dac-2008-presentations-now-posted/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2008/07/dac-2008-presentations-now-posted/</feedburner:origLink></item>
		<item>
		<title>Response to Mentor CDC Whitepaper</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/256220295/</link>
		<comments>http://www.verilab.com/blog/2008/03/mentor-cdc-whitepaper-response/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 20:26:06 +0000</pubDate>
		<dc:creator>Kevin Johnston</dc:creator>
		
		<category><![CDATA[Methodology]]></category>

		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2008/03/mentor-cdc-whitepaper-flaws/</guid>
		<description><![CDATA[There was a recent surge of discussions about asynchronous clock domain crossings and metastability handling in Verilab email: Two people asked Mark Litterick essentially the same question just hours apart, and then a day later Jason Sprott noticed a Mentor CDC Verification paper that referenced Mark&#8217;s &#8220;Pragmatic Simulation-Based Verification of Clock Domain Crossing Signals and [...]]]></description>
			<content:encoded><![CDATA[<p>There was a recent surge of discussions about asynchronous clock domain crossings and metastability handling in Verilab email: Two people asked Mark Litterick essentially the same question just hours apart, and then a day later Jason Sprott noticed a <a href="http://www.mentor.com/techpapers/fulfillment/upload/mentorpaper_36758.pdf">Mentor CDC Verification paper</a> that referenced <a href="http://www.verilab.com/files/sva_cdc_paper_dvcon2006.pdf">Mark&#8217;s &#8220;Pragmatic Simulation-Based Verification of Clock Domain Crossing Signals and Jitter using SystemVerilog Assertions,&#8221; paper</a> (Best Paper at DVCon 2006).</p>
<p>One particular statement in the Mentor paper caught my eye: &quot;this model can still generate false errors: the waveforms show that input sequence A, B, C, D, E, F can result in output sequence A, B, E, E, E, where two consecutive inputs, C and D, are skipped&quot;. And this statement bothered me: I had spent a long time figuring out Mark&#8217;s model some while back, and while it was not at all intuitive to me, I did convince myself that it could never generate a simulated output sequence that was impossible in real hardware. So if the Mentor paper was correct, then I had missed something about Mark&#8217;s model, and I&#8217;ll be honest, I didn&#8217;t relish going back and studying it again.</p>
<p>Obviously I was just going to have to find a mistake in the Mentor paper instead. And to my considerable relief, I did. In fact, I found two:</p>
<ol>
<li>The schematic (Fig 8, p.9) of Mark&#8217;s synchronizer model is missing a small but important feature. </li>
<li>The waveform (Fig 9, p.9) of data signal values input to the model is a somewhat misleading representation of an async input. </li>
</ol>
<p><span id="more-63"></span></p>
<p>In the Mentor paper, the select inputs to both muxes are simply &quot;$random()&quot;. In Mark&#8217;s original model (Fig 11, p.5), the select input of the input mux is indeed just &quot;$random()&quot;, but the select input of the output mux is &quot;@(m2 or m3) $random()&quot;.</p>
<p>The result of the modified select term is to make the &quot;A,B,E,E,E&quot; behavior impossible except under specific conditions. But under the right conditions, it is indeed a possible behavior in hardware.</p>
<p>The waveform of the d input signal in Fig 9 of the Mentor paper gives a false impression that d is actually synchronous, rather than asynchronous, to the sampling clock clk. The stability of a transitioning async input cannot be inferred forward or backward from the sampling clock. If two consecutive samples are not equal, it is unknown when the transition occurred - it is only known that a transition occurred. So if the sampled values B, C, D, E in simulation were 0, 1, 1, 0, it is entirely possible for hardware to exhibit the output sequence 0, 0, 0, 0.</p>
<p>The fact that samples C and D were both 1 in simulation does not mean that d was stable for two complete clk periods, as implied in Fig 9: The 0-&gt;1 transition B-&gt;C could have occurred momentarily before the C sampling clock edge, and the 1-&gt;0 transition D-&gt;E could have occurred momentarily after the D sampling clock edge. And if both transitions violated the sampling setup/hold window, then the metastability could settle to the B value at the C clock edge, and the E value at the D clock edge.</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/256220295" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2008/03/mentor-cdc-whitepaper-response/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2008/03/mentor-cdc-whitepaper-response/</feedburner:origLink></item>
		<item>
		<title>SystemVerilog Gotcha: (when copying) a struct is not a class by another name</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/219799733/</link>
		<comments>http://www.verilab.com/blog/2008/01/gotcha-when-copying-a-struct-is-not-a-class-by-a-different-name/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 10:24:01 +0000</pubDate>
		<dc:creator>Jason Sprott</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[SystemVerilog]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2008/01/gotcha-when-copying-a-struct-is-not-a-class-by-a-different-name/</guid>
		<description><![CDATA[SystemVerilog has two &#8220;similar&#8221; data types that allow variables to be grouped together in a handy package: the struct and the class. I&#8217;ve heard it often said, when explaining what a class (an object-oriented data type)  is, that it is just like a C struct with functions. I used to have no problem with [...]]]></description>
			<content:encoded><![CDATA[<p>SystemVerilog has two &#8220;similar&#8221; data types that allow variables to be grouped together in a handy package: the struct and the class. I&#8217;ve heard it often said, when explaining what a class (an object-oriented data type)  is, that it is just like a C struct with functions. I used to have no problem with that, until, when reviewing and debugging testbench code,  I started seeing some problems related to the way classes have to be treated differently to structs. One of the most common errors I&#8217;ve found is when data structures composed of classes are copied. </p>
<p>Consider the following:  <span id="more-62"></span></p>
<pre>
class FooDataClass;
   integer D1;
   integer D2;
endclass

struct {
   integer D1;
   integer D2;
} FooDataStruct;

program test;
   FooDataClass  X[]  = new[5]; // array of classes
   FooDataClass  Y[];           // array of classes
   FooDataStruct A[]  = new[5]; // array of structs
   FooDataStruct B[];           // array of structs
   ...
   Y = X; // copy array of classes
   B = A; // copy array of structs
   ...
endprogram
</pre>
<p>In the case of the struct, it&#8217;s possible to copy the dynamic array A[] to B[], sizing B to the same as A automatically. It&#8217;s equivalent to:	</p>
<pre>
B = new[A.size()];
foreach(A[i]) begin
   B[i].D1 = A[i].D1; // copy value of A[i].D1 to B[i].D1
   B[i].D2 = A[i].D2; // copy value of A[i].D2 to B[i].D2
end
</pre>
<p>Importantly,  B[] has it&#8217;s very own copy of the values of variables D1 and D2 for each element in the array. So, if A[2].D1 was modified, B[2].D1 would not be.</p>
<p>In the case of the class, when we copy the dynamic array X[] to Y[], Y is still sized to the same as X automatically, but something subtly different happens (that often catches people out), with D1 and D2. When arrays of classes are copied, the references (aka handles) to the class are copied, not the values of the class members themselves.  It&#8217;s equivalent to:</p>
<pre>
Y = new[X.size()];
foreach(X[i]) begin
   Y[i] = X[i]; // copy reference to class X[i] into Y[i]
end
</pre>
<p>This means that Y[] does not have its own copy of the values of variables D1 and D2 for each element in the array. If X[2].D1 was modified Y[2].D1 would also be modified. In fact they are the same variable, pointed to by the reference Y[2],  which is equal to X[2]. That&#8217;s, most often times, not the desired behavior of the code. Coding errors like this can be tricky to track down and may stay hidden for some time.</p>
<p>Once you&#8217;ve created a class, people might start using it all over the place. People, who might not have access to modify your class code, only use it. This has an impact on the above mentioned difference between classes and structs. If you want to enable people to make copies of the data values, as opposed to just the references, then you (as the developer of the class), should provide a mechanism to &#8220;deep copy&#8221; the class. So with FooDataClass  we might do:</p>
<pre>
function void FooDataClass::copy(FooDataClass c);
   this.D1 = c.D1;
   this.D2 = c.D2;
endfunction
</pre>
<p>Here we copy the values of another class of the same type into our class. It is now possible to make Y[] have its very own copy of the values of variables D1 and D2 for each element in the array. So, if X[2].D1 was modified, Y[2].D1 would not be. However, we still have to do something different for classes than we do for structs. Something like:</p>
<pre>
// copy of values of values in X[] to Y[]
foreach(X[i]) begin
   Y[i] = new;   // create new instance of the class
   Y[i].copy(X[i]); // copies *values* in class from X to Y
end
</pre>
<p>So, when you are reviewing code, it&#8217;s always prudent to look for places where classes or things containing classes are explicitly or implicitly copied.</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/219799733" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2008/01/gotcha-when-copying-a-struct-is-not-a-class-by-a-different-name/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2008/01/gotcha-when-copying-a-struct-is-not-a-class-by-a-different-name/</feedburner:origLink></item>
		<item>
		<title>You’ve Got [Mail|Bugs]?</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/201014039/</link>
		<comments>http://www.verilab.com/blog/2007/12/youve-got-mailbugs/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 02:46:22 +0000</pubDate>
		<dc:creator>Kevin Johnston</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/12/youve-got-mailbugs/</guid>
		<description><![CDATA[I was having lunch with JL awhile ago, and we were talking about some recent Verilab email threads. Participation in email threads is fairly high at Verilab: If you ask a question, you&#8217;re pretty likely to get an answer. Or three. But even though participation is the norm, there is no guarantee that you&#8217;ll get [...]]]></description>
			<content:encoded><![CDATA[<p>I was having lunch with <A id=cgxs title=JL href="http://www.coolverification.com">JL</A> awhile ago, and we were talking about some recent Verilab email threads. <BR><BR>Participation in email threads is fairly high at Verilab: If you ask a question, you&#8217;re pretty likely to get an answer. Or three. <BR><BR>But even though participation is the norm, there is no <B>guarantee</B> that you&#8217;ll get an answer. There&#8217;s no <B>guarantee</B> that the person with the most useful knowledge will chime in. Well, these aren&#8217;t novel concerns, and there are tools to address them: Bug trackers. I&#8217;m rather a fan of bug trackers, and I think they could be used far more widely than is typical. And foolishly, I promised JL I&#8217;d write a blog on the subject. <BR><BR>So I started to organize my thoughts: My central themes would be the interface and the data model. I would argue that the bug tracker data model is far superior, but the interface is often far too cumbersome. <BR><BR>A bug tracker keeps state (and state history) and responsibility metadata. A bug tracker manages a to-do list, and if it weren&#8217;t a useful data model, then to-do lists would have gone extinct; and that ain&#8217;t happening. <BR><BR><B>Any</B> communication that desires a response is actually an addition to someone&#8217;s to-do list: &#8220;Please respond&#8221;. And the <B>vast</B> majority of communications <B>do</B> desire responses: &#8220;Please book me on a flight to Aruba&#8221;; &#8220;What&#8217;s the Emacs keystroke for &#8230;?&#8221;; &#8220;I&#8217;m going to see the new movie on Friday at 8, wanna come?&#8221;. <BR><BR>Why not use a bug tracker for all of them? <BR><BR><span id="more-61"></span>It seemed so obvious that email does <B>not</B> support this data model as to be hardly worth mentioning. So why is email so popular for a function that it&#8217;s not actually best suited? Or perhaps, why are bug trackers so <B>unpopular</B> for the very task they&#8217;re designed? <BR><BR>Consider: The actual message, the to-do item, is the same either way; so if it&#8217;s not the message, then it&#8217;s the medium. And the medium consists of the interface and the data model. <BR><BR>What&#8217;s the difference between the interface of a bug tracker and an email composer? <BR><BR>What do you see when you click &#8220;Create a New Bug&#8221;? Usually, a&nbsp;bazillion required fields you have to fill in. How many of them are actually relevant to the to-do item you want to create? Remember, I&#8217;m proposing to use a bug tracker for <B>all</B> your to-do communications, for work, home, and play. Probably less than half a dozen fields are actually useful for all: Title, Detail, Who&#8217;s responsible. Sure, other fields might be useful sometimes, but not every time. Now, what do you see when you click &#8220;Compose a New Message&#8221;? Subject, Body, Address list. Hmm. Not bad. Not bad at all&#8230; <BR><BR>And what&#8217;s the difference between the data model of a bug tracker and an email client? <BR><BR>I&#8217;ve already mentioned state, history, and responsibility, and I&#8217;ll come back to them again shortly. But there&#8217;s one other aspect that I think is actually the most important of all: Email uses a <B>decentralized</B> data model. All the bug trackers I&#8217;m familiar with operate on a centralized database, and centralized resources just don&#8217;t scale indefinitely. <BR><BR>Now back to the metadata: I hinted above that Responsible maps pretty well to Address list. And History maps pretty well to Thread. What about State? <BR><BR>And it just dawned on me that many email clients <B>do</B> support State annotation (&#8221;label&#8221; in gmail, &#8220;tag&#8221; in Thunderbird). I&#8217;ve never actually used it, because I never before recognized a compelling value for it. But now I want to experiment. Do you mark mail ToDo? Does it work for you? <BR><BR>Obvious question: How do I maintain consistent State across a distributed database? And it struck me: In a decentralized system, <B>self-organized consistency naturally emerges among cooperating peers</B>. If the people I communicate with cooperate, consistency just happens. And if they don&#8217;t, then the only state that matters <B>to me</B> is the state I assign in <B>my</B> database; consistency with an uncooperative correspondent&#8217;s database is completely worthless and completely irrelevant. <BR><BR>So while writing, I&#8217;ve argued myself clear around to the opposite of my original opinion: It seems entirely possible that email might be a quite effective bug tracking tool, if used properly. It just requires disciplined adherence to a usage model. <BR><BR>And now I have to ask instead, &#8220;Does a bug tracking tool have <B>any</B> benefit over email?&#8221;. I happen to still believe the answer is &#8220;Yes&#8221;, but it no longer seems such a self-evident Truth. For one thing, I still think it&#8217;s self-defeating to setup an input form with too many required fields. Could bug entry ever really be as easy as email composition? Think of a bug input form that you thought had too many required fields: How many of those fields could be replaced by a single &#8220;Keywords&#8221; field? What if the interface were sensitive to your login name, and you could configure a set of favorite keyword check boxes? What if the tool automatically presented check boxes for the keywords you use most often?<BR><BR>In a corporate environment, I think a centralized database is the primary benefit. The value of a decentralized database is &#8220;one database per identity&#8221;: It&#8217;s <B>your</B> communication, and <B>your</B> database. But a corporation is in many senses a group identity, so the paradigm shift is <B>our</B> database for <B>our</B> communication. State consistency is guaranteed, anybody can query it; even if group members join or leave; people can subscribe to keywords even if they weren&#8217;t in the address list; maybe you wouldn&#8217;t even need to supply an address list, people would just claim bugs that they knew how to deal with. Is this starting to sound like a mailing list? Wouldn&#8217;t you like to just compose an email to &#8220;us&#8221; and not care whether the back end is a list server or a bug tracker? Could the bug input form just be an email &#8220;template&#8221;? I&#8217;ve never used email templates, I don&#8217;t know what they can and cannot do, but now I want to experiment.<BR><BR>Someday (not today) I may write about marrying bug tracker with revision control. And another someday (also not today) I may write about marrying email with revision control. <BR></p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/201014039" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/12/youve-got-mailbugs/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/12/youve-got-mailbugs/</feedburner:origLink></item>
		<item>
		<title>DFT Digest: Secure Design-For-Test</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/193723551/</link>
		<comments>http://www.verilab.com/blog/2007/12/dft-digest-secure-design-for-test/#comments</comments>
		<pubDate>Sun, 02 Dec 2007 03:54:57 +0000</pubDate>
		<dc:creator>JL Gray</dc:creator>
		
		<category><![CDATA[Methodology]]></category>

		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/12/dft-digest-secure-design-for-test/</guid>
		<description><![CDATA[Folks interested in DFT would do well to head over to DFT Digest.  In his latest post, John Ford ponders about the potential for hackers to learn information about the inner workings of a device via a side channel attack using scan chains.  The topic reminds me of a presentation I attended at [...]]]></description>
			<content:encoded><![CDATA[<p>Folks interested in DFT would do well to head over to <a href="http://www.dftdigest.com">DFT Digest</a>.  In his <a href="http://www.dftdigest.com/scanatpg/secure-design-for-test/">latest post</a>, John Ford ponders about the potential for hackers to learn information about the inner workings of a device via a side channel attack using scan chains.  The topic reminds me of a presentation I attended at this year&#8217;s <a href="http://www.date-conference.com/">DATE conference</a> in Nice.  The presenter was discussing security issues and described how she wrapped her passport in aluminum foil to prevent would-be hackers from scanning info out of the embedded RFID chip.  </p>
<p>Separately, John is compiling a list of DFT related links.  If you&#8217;ve got some good ones to share head on over to his <a href="http://www.dftdigest.com/dft-bookcase/">DFT Bookcase</a> and or his <a href="http://www.dftforum.com/">DFT Forum</a> and let him know!</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/193723551" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/12/dft-digest-secure-design-for-test/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/12/dft-digest-secure-design-for-test/</feedburner:origLink></item>
		<item>
		<title>SystemVerilog User Group 2007 Fall Meeting Stats</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/180985196/</link>
		<comments>http://www.verilab.com/blog/2007/11/systemverilog-user-group-2007-fall-meeting-stats/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 08:44:51 +0000</pubDate>
		<dc:creator>Jason Sprott</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[SystemVerilog]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/11/systemverilog-user-group-2007-fall-meeting-stats/</guid>
		<description><![CDATA[SVUG started in March 2007 and has had a total of 8 meetings so far. It&#8217;s been a great first year for all of us involved with SVUG. The meetings and forum have been met with real enthusiasm. We&#8217;ve had some interesting technical discussions with new and experienced developers using SystemVerilog on their projects.  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.svug.org">SVUG</a> started in March 2007 and has had a total of 8 meetings so far. It&#8217;s been a great first year for all of us involved with SVUG. The meetings and forum have been met with real enthusiasm. We&#8217;ve had some interesting technical discussions with new and experienced developers using SystemVerilog on their projects.  We had some great presentations and tutorials, including me banging on about <a href="http://www.svug.org/Portals/0/Presentations/svug_fall07_js_presentation.pdf">functional coverage</a>, and Verilab&#8217;s Mark Litterick presenting some cool <a href="http://www.svug.org/Portals/0/Presentations/svug_fall07_ml_presentation.pdf">Assertion Based Verification</a> techniques. We even managed to get some users to share their own <a href="http://www.svug.org/TipsTricks/tabid/82/Default.aspx">tips and tricks</a>, including our very own JL Gray.
</p>
<p> I just got the stats for the fall 2007 <a href="http://www.svug.org/Events/PastEvents/tabid/65/Default.aspx">meetings</a>. 480 registered in total, 280 attended. Of the people surveyed (nearly everyone that attended the 5 meetings), 60% were using SystemVerilog today. Verification did pretty well out of that, with 67% of the share. Design got 10% and 23% said they used SystemVerilog for both design and verification.  From a verification point of view another interesting stat was that 33% of the verification slice, were using the advanced testbench features of the language, and 32% were using SVA.  It&#8217;s nice to see that more people are starting to use the HVL portion of the language for verification, not just writing assertions.  I think this is due in no small to much better tool support and stability by all the vendors.
</p>
<p>The growing attendance numbers of the SVUG meetings is a reflection of the interest and uptake of SystemVerilog by the design/verification community. I&#8217;m seeing an increase in our client projects using SystemVerilog Verification IP, and finding ways to hook SystemVerilog into their verification environments. Finally, it&#8217;s really beginning to feel like SystemVerilog is starting to make a bit of an impact.</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/180985196" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/11/systemverilog-user-group-2007-fall-meeting-stats/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/11/systemverilog-user-group-2007-fall-meeting-stats/</feedburner:origLink></item>
		<item>
		<title>Beautiful Code</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/176243925/</link>
		<comments>http://www.verilab.com/blog/2007/10/beautiful-code/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 14:50:12 +0000</pubDate>
		<dc:creator>Kevin Johnston</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/10/beautiful-code/</guid>
		<description><![CDATA[At the end of August, I picked up a copy of &#8220;Beautiful Code&#8221; (O&#8217;Reilly,&#160;edited by Andy Oram and Greg Wilson) that was lying around the Verilab office.&#160; I&#8217;d just finished the last Harry Potter book, and I was in the mood for some lighter fare.&#160; I&#8217;m about 90% through it, although I skipped a couple [...]]]></description>
			<content:encoded><![CDATA[<p>At the end of August, I picked up a copy of &#8220;<A id=c.99 title="Beautiful Code" href="http://www.amazon.com/Beautiful-Code-Leading-Programmers-Practice/dp/0596510047/">Beautiful Code</A>&#8221; (O&#8217;Reilly,&nbsp;edited by Andy Oram and Greg Wilson) that was lying around the Verilab office.&nbsp; I&#8217;d just finished the <A id=pjhy title="last Harry Potter book" href="http://www.amazon.com/Harry-Potter-Deathly-Hallows-Book/dp/0545010225/">last Harry Potter book</A>, and I was in the mood for some lighter fare.&nbsp; I&#8217;m about 90% through it, although I skipped a couple of chapters entirely.<BR><BR>I had every intention of really studying and understanding the code excerpts, and I stuck to it for exactly one chapter. After that, I just couldn&#8217;t force myself. I&#8217;m sure that must say something about me, not sure I want to know what.<BR><BR>However, I enjoyed several chapters. My favorite by far is &#8220;A Spoonful of Sewage&#8221; by Brian Cantrill. It&#8217;s the story of hunting and fixing a lock order bug in the Solaris 8 kernel. I think a big reason for its appeal is it&nbsp;really is written as a story. And along the way, I learned about priority inheritance as a solution to a common resource starvation issue. To me, priority inheritance is definitely a beautiful idea. My second favorite chapter&nbsp;is &#8220;The Quest for an Accelerated Population Count&#8221; by Henry S. Warren Jr. The divide and conquer approach is another beautiful idea.<BR><BR>Other highlights: &#8220;Beautiful Debugging&#8221; by Andreas Zeller, &#8220;Multidimensional Iterators in <A id=wc7r title=NumPy href="http://numpy.scipy.org/">NumPy</A>&#8221; by Travis E. Oliphant (I almost skipped this one!).<BR><BR>A couple of chapters that I was really looking forward to&nbsp;after browsing the TOC were disappointing: &#8220;Subversion&#8217;s Delta Editor&#8221; by Karl Fogel and&nbsp;&#8221;Distributed Programming with MapReduce&#8221; by Jeffrey Dean and Sanjay Ghemawat. I have a feeling I just may not be smart enough to appreciate the beauty here, but, well, I don&#8217;t.<BR><BR>The common element of my two favorite chapters is not that the code itself is beautiful per se, but rather the code embodies some non-obvious but elegant algorithm. The beauty is in the idea. So is the term &#8220;beautiful code&#8221; actually a vacuous, meaningless concept? No, I don&#8217;t think so. I think code itself can be beautiful: When a function, a purpose, a meaning, shines clearly, concisely, intuitively through an expression, that expression is beautiful in its own right; beauty in idiom vs beauty in idea. And if a language seems to offer such intuitive expressions regularly, you could conceivably consider that language beautiful.<BR><BR>But having said all that, I simply don&#8217;t believe that a crisp, sharp boundary between idea and idiom exists: Function is nothing more than interpretation of form. Language and thought are so deeply intertwined, and any concept can be considered at so many different levels of abstraction.<BR><BR>For example, the priority inheritance algorithm might seem to be far more idea than idiom, while a NumPy slice operator might seem more language bound; but the idea of a multidimensional iterator <I>abstraction</I> surely is not.<BR><BR>Of course, the complexity of &#8220;beauty&#8221; makes language and thought seem simple by comparison.</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/176243925" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/10/beautiful-code/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/10/beautiful-code/</feedburner:origLink></item>
		<item>
		<title>Casting Strings to Enums in SystemVerilog</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/173014532/</link>
		<comments>http://www.verilab.com/blog/2007/10/casting-strings-to-enums-in-systemverilog/#comments</comments>
		<pubDate>Sun, 21 Oct 2007 19:49:04 +0000</pubDate>
		<dc:creator>JL Gray</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[SystemVerilog]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/10/casting-strings-to-enums-in-systemverilog/</guid>
		<description><![CDATA[Every once and awhile, I want to convert a string to an enumeration in SystemVerilog.&#160; Casting from strings to enums is not supported in SystemVerilog, but luckily, it is possible to implement a function to do the appropriate conversion using&#160;built in methods designed for&#160;iterating over the enum values:&#160; 

///////////
// enum.sv
///////////
class cmd;
&#160;&#160;// My enumerated type 
&#160;&#160;typedef [...]]]></description>
			<content:encoded><![CDATA[<p>Every once and awhile, I want to convert a string to an enumeration in SystemVerilog.&nbsp; Casting from strings to enums is not supported in SystemVerilog, but luckily, it is possible to implement a function to do the appropriate conversion using&nbsp;built in methods designed for&nbsp;iterating over the enum values:&nbsp; </p>
<p><span id="more-56"></span></p>
<pre>///////////
// enum.sv
///////////
class cmd;
&nbsp;&nbsp;// My enumerated type 
&nbsp;&nbsp;typedef enum {UNKNOWN, ADD, SUB, MULT} cmd_e;
&nbsp;&nbsp;
&nbsp;&nbsp;// Store the string -&gt; enumerated type mappings.
&nbsp;&nbsp;static cmd_e enum_map[string];
&nbsp;&nbsp;
&nbsp;&nbsp;// Configure the mapping from string to enum the first
&nbsp;&nbsp;// time this data structure is created.
&nbsp;&nbsp;virtual function void config_enum_map();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd_e e;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string str;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e = e.first();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = e.name();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enum_map[str] = e;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Note - we've already processed the first element above. This loop
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// starts at the *second* element.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (int i = 1; i &lt; e.num(); i++) begin 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e = e.next();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = e.name(); 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enum_map[str] = e;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach (enum_map[m]) begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$display("enum_map[%5s] = %5s (%1d)", m, enum_map[m].name(), enum_map[m]);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end

&nbsp;&nbsp;endfunction: config_enum_map

&nbsp;&nbsp;function cmd_e get_enum(string s);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;get_enum = enum_map[s];
&nbsp;&nbsp;endfunction

&nbsp;&nbsp;function new();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (enum_map.num() == 0) begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;config_enum_map();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;endfunction: new

endclass: cmd

program test;
&nbsp;&nbsp;initial begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd&nbsp;&nbsp; c = new;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cmd::cmd_e ce;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string s = "ADD";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ce = c.get_enum(s);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$display("Enum = %s (%1d) for string %s", ce.name, ce, s);

&nbsp;&nbsp;end

endprogram
</pre>
<p>In VCS, run the above code using &#8216;vcsi -sverilog -ntb_opts dtm -R enum.sv&#8217; to see the following output:</p>
<pre>Compiler version VCSi Y-2006.06-SP1; Runtime version VCSi Y-2006.06-SP1;&nbsp; Oct 21 14:43 2007 

enum_map[ADD] = ADD (1)
enum_map[MULT] = MULT (3)
enum_map[SUB] = SUB (2)
enum_map[UNKNOWN] = UNKNOWN (0)
Enum = ADD (1) for string ADD
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; V C S&nbsp;&nbsp; S i m u l a t i o n&nbsp;&nbsp; R e p o r t 
</pre>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/173014532" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/10/casting-strings-to-enums-in-systemverilog/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/10/casting-strings-to-enums-in-systemverilog/</feedburner:origLink></item>
		<item>
		<title>Aligning With Emacs</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/166721327/</link>
		<comments>http://www.verilab.com/blog/2007/10/aligning-with-emacs/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 00:28:04 +0000</pubDate>
		<dc:creator>Tommy Kelly</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/10/aligning-with-emacs/</guid>
		<description><![CDATA[In a company like Verilab, full of consultants smarter than a brain pie, it&#8217;s not often the CEO gets to teach anyone anything technical. So forgive me for taking advantage of a rare opportunity.
This morning (well, morning to me in the US, afternoon to him in one of our European offices) one of the team [...]]]></description>
			<content:encoded><![CDATA[<p>In a company like Verilab, full of consultants smarter than a brain pie, it&#8217;s not often the CEO gets to teach anyone anything technical. So forgive me for taking advantage of a rare opportunity.</p>
<p>This morning (well, morning to me in the US, afternoon to him in one of our European offices) one of the team asked an emacs question on our lively, internal, intercontinental, questions-answered-almost-before-they-are-asked forum. Specifically, he wanted to know how to change this:</p>
<pre> a0_af0_high = a0_af0_high.get_write_data();
    a0_af0_low = a0_af0_low.get_write_data();
    a1_af0_high = a1_af0_high.get_write_data();
    a1_af0_low = a1_af0_low.get_write_data();
    a0_af1_high = a0_af1_high.get_write_data();
    a0_af1_low = a0_af1_low.get_write_data();
</pre>
<p>into this:</p>
<pre>a0_af0_high   = a0_af0_high.get_write_data();
a0_af0_low    = a0_af0_low.get_write_data();
a1_af0_high   = a1_af0_high.get_write_data();
a1_af0_low    = a1_af0_low.get_write_data();
a0_af1_high   = a0_af1_high.get_write_data();
a0_af1_low    = a0_af1_low.get_write_data();</pre>
<p>Such a simple problem, so many interesting comments and answers.</p>
<p><span id="more-55"></span></p>
<p>First, why is he even bothering about this? Who cares if the code is pretty? Answer - everyone with any sense. The most important reader of code is not the simulator but the next human <a href="http://en.wikipedia.org/wiki/Literate_programming">who has to read it</a> - including the author, three months from now. So, within reason, anything that can be done to improve readability is worthwhile. It is a constant mantra at Verilab that &#8220;Verification Engineering Is Software Engineering&#8221; and this is just one example of that in practice. Yes, it matters that you correct for metastability between clock domains; yes it&#8217;s important that if you gate clocks, you do it in a safe way; yes, it&#8217;s important that if you want a synchronous match flag to assert on the same clock edge that created the match you know which side of the relevant register&#8217;s flip-flops to look at. But on top of that, it&#8217;s important you code it right. Verification Engineering Is Software Engineering.</p>
<p>Next - why wasn&#8217;t he using an emacs major editing mode, which probably would have done all this for him. The well-known offering by the inestimable &#8220;Mac&#8221; was a good choice in my day. Well, turns out he *is* using <a href="http://www.verilog.com/verilog-mode.html">the mode</a>, it <strong>is</strong> Mac&#8217;s version, and, ahem, it&#8217;s not yet up to the task. Cue flurry of lisp hacking by Mac :-).</p>
<p>OK, so next - what&#8217;s the answer to the original question? Well, I came up with a simple two-stage approach. First, align the line-starts using &#8220;M-x kill-rectangle&#8221;. And then use the highly cool &#8220;M-x align-regexp&#8221; to align around those &#8220;=&#8221; signs. In emacs, as in Perl, there&#8217;s more than one way to do it. But those work.</p>
<p>And finally - how did I manage to figure this out? I mean, half an hour ago I didn&#8217;t know about align-regexp, I just sensed it would be out there. Why? Simple - I have had so much past exposure to emacs that I knew that someone just had to have done this before, so it was worth a search. And that raises a useful parting shot, still in the vein of &#8220;Verification Engineering Is Software Engineering&#8221;. One of the advantages of having a software view of verification (and, to some extent, design) is the tension it creates between the way much verification code <strong>is</strong> and the way it <strong>could be</strong>. The mature software mind has a language (perhaps some subtle combination of all the languages the individual concerned has seen, which is why <a href="http://www.catb.org/~esr/faqs/hacker-howto.html#skills1">learning languages is useful</a>) in which to think about problems and in which to propose solutions. The whole notion of design patterns is an example of this in action. This is in contrast with the mind which sees the world only in terms of electronics. In that case, sometimes it&#8217;s impossible for the engineer even to articulate a problem to themselves, let alone posit an answer. It&#8217;s like an English speaker who has had no exposure to German (or to the 1727 edition of the &#8220;Universal Etymological English Dictionary&#8221;) trying to conceptualize &#8220;<a href="http://en.wikipedia.org/wiki/Schadenfreude">schadenfreude</a>&#8220;. The software mind may have to tolerate for some time tangled code, tools that don&#8217;t respect each other and regression environments with more scope for bugs than the design itself. But the fact that it knows There Is A Better Way eventually has a positive impact. It is pretty much a universal experience of Verilab&#8217;s engagements with our clients that we start off working inside the client&#8217;s existing infrastructure, helping them solve their immediate problems in their chosen way, only to find, a few months down the road, client engineering managers peering over our shoulders saying, &#8220;Gosh, how cool is that; could you show everyone else how that works so we can roll it out across the whole team?&#8221;</p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/166721327" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/10/aligning-with-emacs/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/10/aligning-with-emacs/</feedburner:origLink></item>
		<item>
		<title>Reuseless Code</title>
		<link>http://feeds.feedburner.com/~r/VerilabBlog/~3/161806779/</link>
		<comments>http://www.verilab.com/blog/2007/09/reuseless-code/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 03:31:46 +0000</pubDate>
		<dc:creator>Avidan Efody</dc:creator>
		
		<category><![CDATA[News]]></category>

		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.verilab.com/blog/2007/09/reuseless-code/</guid>
		<description><![CDATA[Here&#8217;s a new English term I&#8217;ve just coined: reuseless code. It refers to code that was written in such a reusable way that it can&#8217;t be used in any way. Writing reusable code is a noble cause, but before you start it is better to clarify where, why and how you think your code will [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a new English term I&#8217;ve just coined: reuseless code. It refers to code that was written in such a reusable way that it can&#8217;t be used in any way. Writing reusable code is a noble cause, but before you start it is better to clarify where, why and how you think your code will ever be reused, if at all. Skip this step and you can be sure that, despite your good intentions, someone else will have to rewrite the whole thing later on. You can also be sure that your code will be unnecessarily and overwhelmingly complex.
<p>In a testbench different parts are likely to be reused in different ways. Standard interfaces are the number one candidates for reuse in the pure sense of the term; it is quite probable that they will be plugged in as is into an altogether different project later on. Data generators (i.e. an Ethernet packet generator), base class libraries and generic packages (register package) follow close. In fact, if you&#8217;re lucky enough, you will probably be reusing someone else&#8217;s code yourself.<br />
<span id="more-54"></span></p>
<p>As a rule of thumb, any part in your testbench that is tied to more than one DUT interface will probably remain attached to the same DUT for the rest of its life. Scoreboards, multi-interface sequences (&#8221;virtual sequences&#8221;) and some coverage collectors are good examples. Such code should be written with system level reuse in mind, but trying to write it for plug and play reuse with another DUT is, in most cases, a waste of time. Other parts of your testbench that are likely to be reused only on system level are coverage of DUT configuration or state machines, signal maps (connection of DUT signals to testbench signals) and the verification environment top file that normally does all the internal interconnect (i.e. connect a scoreboard to the BFMs ports). Since these parts will go together everywhere, they can, for example, rely on the fact that other parts exist. This means, that decoupling issues can be relaxed a little bit: For example, if a scoreboard refers to some public DUT specific configuration member by name, I wouldn&#8217;t consider it a crime. If a code for standard interface does something similar, that&#8217;s another thing.
<p>Finally, in most testbenches there exist some limited parts that are not going to be reused at all. For example, in a module level testbench you usually have a part that instantiates the DUT and the corresponding verification environment and connects the two together. Obviously, this will not be required anywhere else.
<p>As an example consider the following, over simplified and partly abridged, testbench for a serial to parallel DUT. The serial to parallel can convert words of up to 32 serial bits into one parallel word. The size configuration parameter can be used to determine how many serial bits are grouped into one parallel word. </p>
<pre>
// *** reused in another project

// monitors know nobody else
class serial_monitor;
   mailbox#(logic) data_bits;
   // implementation
endclass

class parallel_monitor;
   mailbox#(int) data_words;
   // implementation
endclass

// *** reused on system level only

class dut_config;
   logic[4:0] size;
endclass

// scoreboard can know about env
// object and everything that's
// underneath it. No point in
// passing info through mailboxes
// between config object and scoreboard
// because they always go together...

typedef class env;

class s2p_scoreboard;
   env env_p;

   mailbox#(logic) serial_in_p;
   mailbox#(int) parallel_out_p;

   task check();
      forever begin
         int data_in, data_out;

         for (int i = 0; i<=env_p.config_i.size; i++) serial_in_p.get(data_in[i]);
         parallel_out_p.get(data_out);

         assert (data_in != data_out);
      end
   endtask
endclass // s2p_scoreboard

class env;
   serial_monitor serial_monitor_i;
   parallel_monitor parallel_monitor_i;
   s2p_scoreboard s2p_scoreboard_i;
   dut_config config_i;

   function new();
      // instantiate and connect mailboxes
   endfunction
endclass // env

// *** not reused at all

module dut;
endmodule   

module tb;
   env env_i;
   dut dut_i();

   // connect the two;
endmodule
</pre>
<p>In such a testbench, it is expected that the intricate interfaces will be later dug out to be used in another project. Therefore, the interfaces don&#8217;t know the DUT, its configuration or the environment. In case they need to know anything, you should (a) ask yourself if they really need to know it (b) if yes, pass that info in some way that will maintain the interfaces decoupled. </p>
<p>On the other hand, the DUT config object, which is some representation of register values, the scoreboard and the env object are always expected to remain together and attached to the same DUT. Therefore, they can reference each other if this makes things more convenient. For example, there is no point in adding some sort of a port/mailbox/buffer between the scoreboard and the config object. The scoreboard can just have a look at the config, or at any other public parts under env, because it will always be used together with the env. Also, the env can connect the mailboxes together because it knows the interfaces and the scoreboard. This might not seem like a big saving, but when you have hundreds of configuration parameters and you insist on passing each of them to the scoreboard via some kind of a buffer you will note the difference. </p>
<p>So before you go crazy about reuse, it is always good to think ahead. Writing reusable code often comes with a high price tag attached. It demands more effort, and it might make your code more complex and verbose, and hence, harder to maintain. </p>
<img src="http://feeds.feedburner.com/~r/VerilabBlog/~4/161806779" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.verilab.com/blog/2007/09/reuseless-code/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.verilab.com/blog/2007/09/reuseless-code/</feedburner:origLink></item>
	</channel>
</rss>
