<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Observations from Uppsala &#187; C/C++</title>
	<atom:link href="http://jakob.engbloms.se/archives/tag/cc/feed" rel="self" type="application/rss+xml" />
	<link>http://jakob.engbloms.se</link>
	<description>Computer Technology: Simulation, Virtualization, Virtual Platforms, Embedded, Multicore and Multiprocessing (by Jakob Engblom)</description>
	<lastBuildDate>Sun, 29 Jan 2012 19:45:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<image>
    <title>Observations from Uppsala</title>
    <url>http://jakob.engbloms.se/favicon.png</url>
    <link>http://jakob.engbloms.se</link>
    <width>32</width>
    <height>32</height>
    <description>Observations from Uppsala - http://jakob.engbloms.se</description>
    </image>		<item>
		<title>Compiler Code Size Comparisons (for Possible Embarrassment)</title>
		<link>http://jakob.engbloms.se/archives/1068?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1068#comments</comments>
		<pubDate>Tue, 26 Jan 2010 11:34:48 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[embedded software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[code optimization]]></category>
		<category><![CDATA[code size]]></category>
		<category><![CDATA[compilers]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[John Regehr]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1068</guid>
		<description><![CDATA[An embedded researcher friend of mine has posted some data on code sizes from various compilers at http://embed.cs.utah.edu/embarrassing/. The &#8220;embarrassing&#8221; bit is the idea that compiler writes should be ashamed when other compilers do better than theirs. It is worth looking over the data, even though the methodology and benchmarks are not yet perfect by [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-166" title="whyc" src="http://jakob.engbloms.se/wp-content/uploads/2008/07/whyc.png" alt="whyc" width="100" height="106" />An embedded researcher friend of mine has posted some data on code sizes from various compilers at <a href="http://embed.cs.utah.edu/embarrassing/">http://embed.cs.utah.edu/embarrassing/</a>. The &#8220;embarrassing&#8221; bit is the idea that compiler writes should be ashamed when other compilers do better than theirs. It is worth looking over the data, even though the methodology and benchmarks are not yet perfect by any means.</p>
<p><span id="more-1068"></span></p>
<p>When this data was brought to the attention of the gcc developers on the gcc mailinglist, a very interesting and elucidating discussion followed. See <a href="http://gcc.gnu.org/ml/gcc/2009-12/msg00176.html">http://gcc.gnu.org/ml/gcc/2009-12/msg00176.html </a>and follow all the subthreads from there.</p>
<p>There is a key issue in the gcc discussions, about whether code that relies on uninitialized variables and similar make any sense. I personally think that any code that triggers warnings on one or more compilers should be disqualified, as only really portable code should be reasonable to compare in a shoot-out like this. Code that is &#8220;undefined&#8221; by the C standard really does not provide any interesting information.</p>
<p>Personally, I would also like to see some comparisons between compilers aiming for size, for targets where size really matters. For example, ARM Cortex-R or Cortex-M CPUs, with compilers from commercial players like ARM, IAR, GreenHills, etc. I understand that such a shoot-out is very hard to arrange in practice, however .</p>
<p>Another interesting measure would be the evenness or robustness of a compiler. Is a compiler consistently generating decent code, or does it swing wildly from very good to very bad? I guess you could approximate this if you compared the size for a function generated by a particular compiler to the average of all other compilers&#8217; code for that function. Could give an interesting graph for each compiler.</p>
<p>The code sources are quite interesting: it is isolated functions collected from a large spread of open-source projects. Quite often it looks like the extremes of differences from one compiler to another corresponds to extreme functions. I liked <a href="http://embed.cs.utah.edu/embarrassing/jan_10/harvest/source/E8/E88C5111.c">this one</a>, where <a href="http://embed.cs.utah.edu/embarrassing/jan_10/harvest/compare_clang-head_llvm-gcc-head/">clang created a file 20x the size of llvm</a>. I can see how a naive switch generator gets big here, while an optimized switch code generator can make some very simple comparison statements out of it (this is a bit from Qemu, from a PCI device model, which is close to my interest of virtual platforms, we get this kind of code a lot).</p>
<p><code>sh_pci_reg_write (void *p, target_phys_addr_t addr, uint32_t val)<br />
{<br />
uint32_t *__tmp__282;</code></p>
<p>switch ((int) addr)<br />
{<br />
case 0:<br />
case 1:<br />
case 2:<br />
case 3:<br />
case 4:<br />
case 5:<br />
case 6:<br />
case 7:<br />
case 8:<br />
case 9:<br />
case 10:<br />
case 11:<br />
case 12:<br />
case 13:<br />
case 14:<br />
case 15:<br />
case 16:<br />
case 17:<br />
case 18:<br />
case 19:<br />
case 20:<br />
case 21:<br />
case 22:<br />
case 23:<br />
case 24:<br />
case 25:<br />
case 26:<br />
case 27:<br />
case 28:<br />
case 29:<br />
case 30:<br />
case 31:<br />
case 32:<br />
case 33:<br />
case 34:<br />
case 35:<br />
case 36:<br />
case 37:<br />
case 38:<br />
case 39:<br />
case 40:<br />
case 41:<br />
case 42:<br />
case 43:<br />
case 44:<br />
case 45:<br />
case 46:<br />
case 47:<br />
case 48:<br />
case 49:<br />
case 50:<br />
case 51:<br />
case 52:<br />
case 53:<br />
case 54:<br />
case 55:<br />
case 56:<br />
case 57:<br />
case 58:<br />
case 59:<br />
case 60:<br />
case 61:<br />
case 62:<br />
case 63:<br />
case 64:<br />
case 65:<br />
case 66:<br />
case 67:<br />
case 68:<br />
case 69:<br />
case 70:<br />
case 71:<br />
case 72:<br />
case 73:<br />
case 74:<br />
case 75:<br />
case 76:<br />
case 77:<br />
case 78:<br />
case 79:<br />
case 80:<br />
case 81:<br />
case 82:<br />
case 83:<br />
case 84:<br />
case 85:<br />
case 86:<br />
case 87:<br />
case 88:<br />
case 89:<br />
case 90:<br />
case 91:<br />
case 92:<br />
case 93:<br />
case 94:<br />
case 95:<br />
case 96:<br />
case 97:<br />
case 98:<br />
case 99:<br />
case 100:<br />
case 101:<br />
case 102:<br />
case 103:<br />
case 104:<br />
case 105:<br />
case 106:<br />
case 107:<br />
case 108:<br />
case 109:<br />
case 110:<br />
case 111:<br />
case 112:<br />
case 113:<br />
case 114:<br />
case 115:<br />
case 116:<br />
case 117:<br />
case 118:<br />
case 119:<br />
case 120:<br />
case 121:<br />
case 122:<br />
case 123:<br />
case 124:<br />
case 125:<br />
case 126:<br />
case 127:<br />
case 128:<br />
case 129:<br />
case 130:<br />
case 131:<br />
case 132:<br />
case 133:<br />
case 134:<br />
case 135:<br />
case 136:<br />
case 137:<br />
case 138:<br />
case 139:<br />
case 140:<br />
case 141:<br />
case 142:<br />
case 143:<br />
case 144:<br />
case 145:<br />
case 146:<br />
case 147:<br />
case 148:<br />
case 149:<br />
case 150:<br />
case 151:<br />
case 152:<br />
case 153:<br />
case 154:<br />
case 155:<br />
case 156:<br />
case 157:<br />
case 158:<br />
case 159:<br />
case 160:<br />
case 161:<br />
case 162:<br />
case 163:<br />
case 164:<br />
case 165:<br />
case 166:<br />
case 167:<br />
case 168:<br />
case 169:<br />
case 170:<br />
case 171:<br />
case 172:<br />
case 173:<br />
case 174:<br />
case 175:<br />
case 176:<br />
case 177:<br />
case 178:<br />
case 179:<br />
case 180:<br />
case 181:<br />
case 182:<br />
case 183:<br />
case 184:<br />
case 185:<br />
case 186:<br />
case 187:<br />
case 188:<br />
case 189:<br />
case 190:<br />
case 191:<br />
case 192:<br />
case 193:<br />
case 194:<br />
case 195:<br />
case 196:<br />
case 197:<br />
case 198:<br />
case 199:<br />
case 200:<br />
case 201:<br />
case 202:<br />
case 203:<br />
case 204:<br />
case 205:<br />
case 206:<br />
case 207:<br />
case 208:<br />
case 209:<br />
case 210:<br />
case 211:<br />
case 212:<br />
case 213:<br />
case 214:<br />
case 215:<br />
case 216:<br />
case 217:<br />
case 218:<br />
case 219:<br />
case 220:<br />
case 221:<br />
case 222:<br />
case 223:<br />
case 224:<br />
case 225:<br />
case 226:<br />
case 227:<br />
case 228:<br />
case 229:<br />
case 230:<br />
case 231:<br />
case 232:<br />
case 233:<br />
case 234:<br />
case 235:<br />
case 236:<br />
case 237:<br />
case 238:<br />
case 239:<br />
case 240:<br />
case 241:<br />
case 242:<br />
case 243:<br />
case 244:<br />
case 245:<br />
case 246:<br />
case 247:<br />
case 248:<br />
case 249:<br />
case 250:<br />
case 251:<br />
case 252:;<br />
__tmp__282 = (uint32_t *) ((((SHPCIC *) p)-&gt;dev)-&gt;config + addr);<br />
*__tmp__282 = val;<br />
break;<br />
case 448:;<br />
((SHPCIC *) p)-&gt;par = val;<br />
break;<br />
case 452:;<br />
((SHPCIC *) p)-&gt;mbr = val;<br />
break;<br />
case 456:;<br />
((SHPCIC *) p)-&gt;iobr = val;<br />
break;<br />
case 544:;<br />
pci_data_write (((SHPCIC *) p)-&gt;bus, ((SHPCIC *) p)-&gt;par, val, 4);<br />
break;<br />
}<br />
return;<br />
}</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1068"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/1068" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/1068" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1068/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joel Spolsky: You cannot program parallel in C, period</title>
		<link>http://jakob.engbloms.se/archives/953?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/953#comments</comments>
		<pubDate>Sun, 11 Oct 2009 17:40:11 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Joel Spolsky]]></category>
		<category><![CDATA[stackoverflow.com]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=953</guid>
		<description><![CDATA[I found this quote in Stackoverflow Podcast #68 quite funny in its extreme dislike of parallel programming in C&#8230; Thanks to the community transcripts wiki: Spolsky: Quite probably. I mean C is a car, it&#8217;s very dangerous – it doesn&#8217;t have seatbelts, but it&#8217;s very powerful because it goes very fast. In fact, I&#8217;d go [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2008/10/stackoverflowlogo250hq2.png"><img class="alignleft size-full wp-image-300" style="margin: 5px 10px;" title="stackoverflowlogo250hq2" src="http://jakob.engbloms.se/wp-content/uploads/2008/10/stackoverflowlogo250hq2.png" alt="stackoverflowlogo250hq2" width="47" height="61" /></a>I found this quote in <a href="http://blog.stackoverflow.com/2009/09/podcast-68/">Stackoverflow Podcast #68 </a>quite funny in its extreme dislike of parallel programming in C&#8230;</p>
<p><span id="more-953"></span>Thanks to the <a href="https://stackoverflow.fogbugz.com/default.asp?W29083">community transcripts wiki</a>:</p>
<blockquote><p><strong>Spolsky: </strong>Quite probably. I mean C is a car, it&#8217;s very dangerous – it doesn&#8217;t have seatbelts, but it&#8217;s very powerful because it goes very fast. In fact, I&#8217;d go so far as to say, unless some people are gonna punch me about this one, but you cannot write multi-threaded code in the C programming language. You just can&#8217;t. Although technically all the capabilities are there, it is <em>beyond</em> the capability of mortal humans – and I know, some of you out there are very smart and you think that you have the capability of writing multi-threaded code in the C programming language, because you&#8217;re hot shit. Well, let me tell you, it is <em>beyond </em>the capability of humans on this planet, for their brains are just not adequate to the task of writing multi-threaded code in <em>most</em> languages, least of all low-level languages like C. It&#8217;s just not gonna work, it&#8217;s just not gonna make you happy. So there.</p></blockquote>
<p>The only problem with this statement is that it means we are all doomed: since all operating systems are written in C, and all low-level libraries, it means that we have no way to build the first level of abstraction needed to provide the higher-level primitives for C# and Python and everything else higher up the stack.</p>
<p>But in general, I think this is a fairly true statement for volume programming.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/953"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/953" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/953" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/953/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Questioning the Choice of C++</title>
		<link>http://jakob.engbloms.se/archives/692?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/692#comments</comments>
		<pubDate>Sat, 14 Mar 2009 20:37:01 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[desktop software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[FLOSS Weekly]]></category>
		<category><![CDATA[Leo Laporte]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Randall Schwartz]]></category>
		<category><![CDATA[xbmc]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=692</guid>
		<description><![CDATA[In FLOSS Weekly issue 57, about 20 minutes into the show, Randall Schwartz and Leo Laporte express genuine surprise that the XMBC media player application is all in C++. That is pretty telling, some parts of the computing world are indeed moving on to more modern pastures like Python, Perl, Ruby, and even Objective C [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-214 alignleft" style="margin: 5px;" title="flossweekly" src="http://jakob.engbloms.se/wp-content/uploads/2008/08/flossweekly.jpg" alt="flossweekly" width="70" height="70" />In <a href="http://www.twit.tv/floss57">FLOSS Weekly issue 57</a>, about 20 minutes into the show, Randall Schwartz and Leo Laporte express genuine surprise that the <a href="http://xbmc.org/">XMBC media player </a>application is all in C++. That is pretty telling, some parts of the computing world are indeed moving on to more modern pastures like Python, Perl, Ruby, and even Objective C (for the Mac people). And quite a contrast to the EDA world where C++ is still considered the new shiny thing, as I <a href="http://jakob.engbloms.se/archives/165"></a><a href="http://jakob.engbloms.se/archives/242">have </a>lamented <a href="http://jakob.engbloms.se/archives/186">before</a>&#8230; thanks for that small but golden genuine surprise, Randall and Leo!</p>
<p><span id="more-692"></span>But note that the application IS written in C++ still: that is the only choice on the xbox where the project started, by design by Microsoft. However, you can use my favorite scripting language Python to script and skin the application.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/692"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/692" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/692" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/692/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>In Praise of Scripting: Something for Modeling as Well?</title>
		<link>http://jakob.engbloms.se/archives/186?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/186#comments</comments>
		<pubDate>Sun, 03 Aug 2008 20:40:51 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[computer simulation technology]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DML]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scripting languages]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[software tools]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=186</guid>
		<description><![CDATA[In the July 2008 issue of IEEE Computer, there is short article called &#8220;In Praise of Scripting: Real Programming Pragmatism&#8220;, by Ronald P. Loui, a professor at Washington University (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-187 alignleft" style="margin: 5px 10px;" title="ieee-computer" src="http://jakob.engbloms.se/wp-content/uploads/2008/08/ieee-computer.gif" alt="" width="89" height="71" />In the <a href="http://www.computer.org">July 2008 issue of IEEE Computer</a>, there is short article called &#8220;<a href="http://doi.ieeecomputersociety.org/10.1109/MC.2008.228">In Praise of Scripting: Real Programming Pragmatism</a>&#8220;, by <a href="http://www.cs.wustl.edu/~loui/">Ronald P. Loui, a professor at Washington University</a> (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; langauge like Python or Ruby might be way better than Java (no doubt about that I think).</p>
<p>The interesting material in the article is the background on WHY he thinks that this is the case. He points to the immense popularity and rise of scripting in much of computing land. In the past ten years, it is clear to him (and I would agree with this too mostly) that languages like Perl, PHP, Awk, Ruby, JavaScript, and Python have eclipse Java and C++ as the most interesting and important programming languages for many practical tasks. Especially for web applications, where Java seems to have a presence but noone would dream of using something as clunky and impractical as C.</p>
<p>What can this teach us for the purpose of simulation and the creation of models of computer system hardware for the purpose of simulation? Maybe a fair bit&#8230;</p>
<p><span id="more-186"></span></p>
<p>The reason that scripting languages have gotten so popular is primarily that they let you get the job done faster. In web land, this is due to a few important factors listed or hinted at in the article:</p>
<ul>
<li>The overall code tends to be shorter and more to the point</li>
<li>A tendency to make any value into a string when needed (excellent debugging aid)</li>
<li>Dynamic typing, variables that just appear when needed</li>
<li>Automatic memory management</li>
<li>Ease of handling strings</li>
<li>Most tasks are pretty short</li>
<li>Performance of computation does not matter very much when processors are as fast as they are today and a single disk or network access operations is likely to dominate programming time</li>
</ul>
<p>What the article continues with a discussion that we need to focus on programming language <em>pragmatics</em> rather than syntax or semantics. How <em>practical </em>is the language for the everyday tasks of a programmer? And it seems that simple darwinian evolution has propelled scripting-style languages to the top of heap here. Purity and elegance and deep semantical properties are obviously less important than getting the job done in the shortest time possible.</p>
<p>What can this teach us modeling folks?</p>
<ul>
<li>A key takeaway is the focus on short code. Code has to be short and focused to be quick and easy to write. You should not need to consult several header files and lots of documentation to understand and formulate your code, which is an ill that keeps hitting C and C++ programs.</li>
<li>Memory management has nothing to do in a productive programming environment.</li>
<li>Basic types have to be appropriate to the task at hand.</li>
<li>Syntax has to be concise and powerful.</li>
<li>Dynamic typing is much faster to code with than static typing and variable declarations.</li>
<li>An interactive &#8220;try it out&#8221; environment is preferable to long compile/link/test cycles.</li>
</ul>
<p>Obviously, some of these do not translate well into hardware modeling. Hardware entities tend to have very-well-defined types by nature. If I have a 16-bit register containing a 13-bit counter and three status bits, I cannot very well let that counter be a dynamic variable that can take on any numeric value. Or the atom &#8220;foo&#8221;. It kind of has to be restricted in semantics to how the hardware would behave&#8230; it is not just a &#8220;value&#8221; to be manipulated quite abstractly. Which means that what you probably rather need are types well-suited for the task at hand.</p>
<p>It is also nice if variables can just pop into existence when needed, with the least amount of declaration possible. Another C-family performance killer is the annoying need to declare a function before calling it. That made sense in linearly scanning compilers back in the 1970s, but today, just let the compiler take the entire program into account and find the function. It is not that hard, especially not for the quite small and isolated context that a virtual platform device model is (few device models are more than a few thousand lines of code in my experience).</p>
<p>The interactive nature of scripting is also interesting. The ability to just write new code directly into a running system without an explicit compile usually rests on a virtual-machine approach and does have some cost in terms of performance. And unlike webservers, virtual platforms need all the raw CPU performance they can get! However, it make excellent sense to use an interactive environment to prototype and test things, and then move the resulting code to a harder compile stage.</p>
<p>Right now, we really do not have such a tool at hand. <a href="http://www.virtutech.com/whitepapers/virtutech_dml.html">Virtutech DML </a>is <a href="http://www.scdsource.com/article.php?id=166">in my opinion </a>the most promising step along this road, but it is not really &#8220;perl for modeling&#8221; at this time. SystemC has too many C++ roots to really behave well in this respect&#8230; you get all the drawbacks of explicit memory management, rampant headerfiles, and statically declared types. It might be good to compile, but it sure is an absolute pain to write.</p>
<p>And if we want virtual platforms to really fly, it is not so much &#8220;all about the models&#8221;, but really &#8220;all about model programming&#8221; &#8212; since there is a huge volume of models that need to written out there, and getting the time needed to write these models down is a primary concern. The total work invested in modeling any particular device is what we need to focus on, really.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/186"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/186" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/186" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/186/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

