<?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; Domain-specific languages</title>
	<atom:link href="http://jakob.engbloms.se/archives/tag/domain-specific-languages/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>Register Design Languages &#8211; DSL or not?</title>
		<link>http://jakob.engbloms.se/archives/1462?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1462#comments</comments>
		<pubDate>Wed, 27 Jul 2011 20:20:25 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[ESL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[Gary Stringham]]></category>
		<category><![CDATA[Register Design Languages]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1462</guid>
		<description><![CDATA[Recently, Gary Stringham has been running a series of interviews with providers of register design tools on his website. Register design tools seems to be an active area with several small companies (and some open-source tools) fighting for the market. I have written about Gary Stringham and register designs before, and it is an area [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2009/04/gears1.png"><img class="alignleft size-full wp-image-737" style="margin: 5px 10px;" title="gears1" src="http://jakob.engbloms.se/wp-content/uploads/2009/04/gears1.png" alt="" width="56" height="57" /></a>Recently, Gary Stringham has been running a series of <a href="http://www.garystringham.com/rdt.shtml">interviews with providers of register design tools on his website</a>. Register design tools seems to be an active area with several small companies (and some open-source tools) fighting for the market. I have written about Gary Stringham and register designs <a href="http://jakob.engbloms.se/archives/358">before</a>, and it is an area that keeps fascinating me. There is something about the task of register design that keeps it separate from the main hardware design languages, tools, and flows.The different approaches taken by the tools supporting the register design task also illustrates some points about programming language standards, domain-specific languages, and exchange formats that I want to address.</p>
<p><span id="more-1462"></span>First of all, what makes register design such a special task? My guess is because it is a higher-level aspect of the design: it  describes an interface, which can be implemented in many different ways  in hardware. Regular HDLs do not help you reason about register layouts in a good way. The register specification should also be used in other places than the hardware: in address definitions for device drivers, in manuals, and other documentation. All of this indicates that the information needs to be explicit, high-level, and in a format that facilitates automatic processing by tools. It basically screams for a domain-specific language (DSL) at some level of ambition (read my old post about how <a href="http://jakob.engbloms.se/archives/747">languages are grown from problems </a>for more background on just how simple a DSL can be).</p>
<p>If you look at the register design tool vendors that Gary interviewed, you can essentially see two different approaches to how to support the task of register design. In particular, the input language differs quite radically between the tools.</p>
<p>There is <em>domain-specific programming language</em> approach. A register-design DSL makes it easy to work with register designs, and pretty hard to do anything else (imagine writing a sorting algorithm in a register-design language &#8211; I don&#8217;t think it can be done, and if it can be done, the result has to be absolutely contorted). The DSL approach assumes a willingness  on the part of a user to learn a new language, but it seems that for this domain, the languages are simple enough that learning them saves you time in the end. Especially if you maintain large register maps that keep changing or is updated and extended across generations of chips (indeed, ease of maintenance is an undersold aspect of most DSLs in my experience).</p>
<p>The underlying assumption of the DSL approach is that the entry language is not too important, as long as you can export data into other formats. To me, this makes sense. From a single source with sufficient descriptive power, you can ideally generate both HDL code to implement the decoder in hardware, as well as documentation, header files, and maybe even skeletons for virtual platform models. And standard formats like IP-XACT to feed into any other tool.</p>
<p>It does not matter if there is a single tool using each input language, since the outputs are what matters. This leaves the vendors free to invent on the input side, and provide a really powerful tool.</p>
<p>The second approach is <em>transformation-based</em>. Its idea is to not use a dedicated input language, but rather powerful import functions to read whatever specifications already exist in text files, Microsoft Word documents, Microsoft Excel spreadsheets, Framemaker documentation files, IP-XACT, or whatever you can come up with.  The assumption is that the tool is really about transforming data and not about compiling a language. Register designs kind of already exist, and since there is no standard language to compile, you just import whatever there is. It makes the assumption that the user base is not willing to learn a new language to handle register design. A funky side-effect is that we might end up actually doing programming work in <a href="http://www.garystringham.com/rdt/AgnisysInterview.shtml">Word docs</a>.</p>
<p>Still, the transformation approach ends up generating the same outputs as the DSL approach. In  both cases, some of the outputs can be considered &#8220;industry standards&#8221;, like IP-XACT, while others are decidedly ad-hoc, like Excel sheets. To me, this demonstrates that the true value in standards is to enable tool interoperability, and not so much as a way to provide inputs.</p>
<p>Indeed, there is a clear difference between good input languages and good exchange formats. An input language tends to drive for expressive power and human readability, and it is OK to have a heavy compilation process associated with it. An exchange format like IP-XACT does not need to be human-readable, nor efficient to code in. It needs to be easy to parse and compile, so that as many tools as possible can work on it.</p>
<p>A typical example from the field of register design is dealing with repeated groups of registers (such as banks of registers for a DMA channel) and parametrized register designs. The input languages used by the tools that Gary Stringham covers all allow this &#8211; while the standard for register design exchange, IP-XACT, only uses a flat compiled map. It just lists all registers with sizes and offsets, not how these offsets were arrived at or if there is some logical grouping or iterated structure. Quite OK for a tool to work on, but not very useful as a repository for the actual information.</p>
<p>This distinction is worth to keep in mind.</p>
<p>I definitely side with the DSL idea, as that fits my idea of a good tool, but I can see why many people find the transformation from other formats attractive. In all cases, the goal is to have an original design specification that is as clear, succinct, and flexible as possible.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1462"></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/1462" 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/1462" 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/1462/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concurrency in Lego Mindstorms NXT</title>
		<link>http://jakob.engbloms.se/archives/1058?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1058#comments</comments>
		<pubDate>Fri, 08 Jan 2010 21:19:54 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[parallel computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[LabView]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[Mindstorms]]></category>
		<category><![CDATA[NXT]]></category>
		<category><![CDATA[parallelized software]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1058</guid>
		<description><![CDATA[For my parental leave, I have just bought myself a Lego Mindstorm NXT 2.0 kit. It is not much fun for our youngest, who mostly gets a bit scared by a piece of Lego driving around making noises, but I hope to be able to use it to teach my older child (almost five) to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1057" style="margin: 5px 10px;" title="lego mindstorms nxt2" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png" alt="lego mindstorms nxt2" width="146" height="126" /></p>
<p>For my parental leave, I have just bought myself a <a href="http://www.mindstorms.com">Lego Mindstorm NXT 2.0 kit</a>. It is not much fun for our youngest, who mostly gets a bit scared by a piece of Lego driving around making noises, but I hope to be able to use it to teach my older child (almost five) to program. Let&#8217;s see how that turns out. It looks hard to make the NXT environment provide the kind of <a href="http://www.boardgamegeek.com/boardgame/18/roborally">Roborally</a>-style programming blocks that I had hoped to create, as I cannot for some reason get a sufficiently custom icon onto custom blocks.</p>
<p>It also presented me with an opportunity to try some domain-specific high-level graphical programming. The programming environment provided for the NXT series of Mindstorms kits is based on LabView from National Instruments, and it really does seem to work. It even features parallel tasks, which I tried to use&#8230;</p>
<p><span id="more-1058"></span>It turned out that it is not that easy to get it right. I was trying to have a few different tasks look at different sensors and steer the robot in different directions based on the sensor readings. However, this quickly turned into a literal deadlock: the robot just sat there, doing nothing, after the first time that my ultrasound sensor task tried to steer it. Failure.</p>
<p>The manual is quite silent on the tasking semantics, and there are no (or I have not yet found) shared variables, locks, or message-passing mechanisms to synchronize the tasks.</p>
<p>Looking for an answer on the web, I came across a nice tutorial on tasking:</p>
<ul>
<li><a href="http://www.ortop.org/NXT_Tutorial/tasks.html">http://www.ortop.org/NXT_Tutorial/tasks.html</a></li>
</ul>
<p>It is a video, and it ends with the note that the only reliable way to multitask in the NXT environment is to NOT try to control the same thing from multiple tasks. If I want to listen to multiple sensors, the only way is to create a loop with switching on inputs. I.e., manual polling. So much for using the natural language of tasks to handle naturally concurrent activities. At some point, I might figure out if I can construct it from tasks and data value transfers, but for now, I will just go with the flow and write (or rather draw) some polling loops.</p>
<p>Here is an example from the manual. Note that the top &#8220;beam&#8221; controls motor A, and the bottom controls motors B and C:</p>
<p><img class="aligncenter size-full wp-image-1059" title="mindstorms manual excerpt" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/mindstorms-manual-excerpt.png" alt="mindstorms manual excerpt" width="691" height="448" /></p>
<p>That last part about data wires is intriguing&#8230; but I will need to find some more reference materials.</p>
<p>Anyway, the way to express parallel tasks here is really quite neat. At least as long as they are dealing with completely separate aspects of the control of the robot.</p>
<p>If this had been a more hard-core environment, it would have been fun to put different tasks on the ARM7 and AVR processors that are inside the NXT 2.0 brick. Yes, it is a true multiprocessor, if very limited in capabilities. At <a href="http://mindstorms.lego.com/en-us/whatisnxt/default.aspx">http://mindstorms.lego.com/en-us/whatisnxt/default.aspx </a>you have the specs. ARM7, 256 kB of FLASH, 64 kB of RAM, and the AVR has 512 bytes of RAM and 4 kB of FLASH. A nice real embedded machine!</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1058"></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/1058" 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/1058" 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/1058/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MCC 2009 Presentations Online</title>
		<link>http://jakob.engbloms.se/archives/1023?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1023#comments</comments>
		<pubDate>Thu, 03 Dec 2009 08:29:35 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[appearances]]></category>
		<category><![CDATA[computer architecture]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[embedded software]]></category>
		<category><![CDATA[multicore debug]]></category>
		<category><![CDATA[multicore software]]></category>
		<category><![CDATA[Andras Vajda]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[Ericsson]]></category>
		<category><![CDATA[heterogeneous]]></category>
		<category><![CDATA[homogeneous]]></category>
		<category><![CDATA[keynote]]></category>
		<category><![CDATA[LTE]]></category>
		<category><![CDATA[MCC]]></category>
		<category><![CDATA[UpMarc]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1023</guid>
		<description><![CDATA[The presentations from the 2009 Swedish Workshop on Multicore Computing (MCC 2009) are now online at the program page for the workshop. Let me add some comments on the workshop per se. This was the first multicore event that I have been to where we did not have a keynote speaker or technical paper from [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1016" style="margin-top: 5px; margin-bottom: 5px;" title="UPMARC_700x150" src="http://jakob.engbloms.se/wp-content/uploads/2009/11/UPMARC_700x150.gif" alt="UPMARC_700x150" width="122" height="45" />The presentations from the 2009 Swedish Workshop on Multicore Computing (MCC 2009) are now online at the <a href="http://www.it.uu.se/research/upmarc/MCC09/prog">program page for the workshop</a>. Let me add some comments on the workshop per se.</p>
<p><span id="more-1023"></span>This was the first multicore event that I have been to where we did not have a keynote speaker or technical paper from a hardware company. So there was really nothing here directly about how to build multicore chips. Rather, the workshop tended to be about how to program, use, measure performance on, verify software for, and generally work with multicore chips. From the perspective of software people, rather than hardware designers.</p>
<p>Obviously, hardware aspects enter into such talks, but it is the perspective of a user, not a designer. For example, a hardware designer could explain how an atomic compare-and-swap is optimized in a multicore device. But here, we saw measurements on the actual operation latencies observed on real machines using such operations. Quite refreshing, and closer to my personal interests.</p>
<p>The keynote by <a href="http://a-vajda.eu/blog/">Andras Vajda</a> of Ericsson was quite interesting. The slides are not online, but the main points that I picked up and that I might not have considered before:</p>
<ul>
<li>Software development costs can mean that the cheapest, fastest, most efficient hardware is not necessarily the most economic. Too hard to code for means the software development time and effort removes the advantage. Obvious, but worth reiterating. Software is king.</li>
<li>The workload on a cellular basestation can sometimes be highly linear and single-threaded. For example, serving a single terminal with a very high bandwidth LTE connection. And suddenly shift to a massively parallel workload as a crowd of a thousand all suddenly appear and start doing data downloads. And then go back to serial again. This means that the age-old argument that signal processing naturally &#8220;<a href="http://www.edn.com/blog/980000298/post/50023005.html">conveniently concurrent</a>&#8221; (<a href="http://www.scdsource.com/article.php?id=87">and here</a>) is not always true. Nice point!</li>
<li>Thus, we need adaptable architectures that can trade serial and parallel performance over time, and rebalance quite quickly. In the same chip.</li>
<li>He is a firm believer that homogeneous systems will win out in the end, I still hold on to a belief in accelerators and offload engines and DSPs. This is partially because of an admitted focus on servers and services processors, and not on the baseband and signalling side. Makes sense.</li>
<li>Domain-specific languages (DSL) are the future of efficient programming. Agree.</li>
</ul>
<p>On the topic of DSLs, there was a question about the cost to support them. To me, that is a non-issue. In the organizations that I have worked, it seems that maintaining a useful DSL requires at most one engineer. Developing one, a few good computer scientists for a fairly limited time. In any case, they tend to appear organically when good programmers <a href="http://jakob.engbloms.se/archives/747">generalize repeated tasks</a>.</p>
<p>I gave a keynote about how multicore has impacted virtual platforms (in particular, <a href="http://www.virtutech.com/products/simics">Virtutech Simics</a>) with the following main points:</p>
<ul>
<li>Multicore targets increase the performance pressure on a virtual platform, as more processors will have to be simulated.</li>
<li>Multicore hosts means that sequential performance of the host is going down compared to the aggregate parallel performance demands from the targets.</li>
<li>To handle large target systems, the virtual platform itself has to run multithreaded on a multicore host. Getting this in place is a major, interesting, and sometimes painful process.</li>
<li>Once you have a parallel virtual platform, multicore hosts provide a very nice boost in scalability and the manageable system sizes. A single multithreaded virtual platform process is also a bit easier to manage from a user perspective.</li>
<li>All features in the virtual platform have to be multicore and multimachine-aware&#8230; meaning that they often get a bit harder to use initially, as there is no &#8220;default processor&#8221; you can fall back to for debugging setups etc. Everything has to be explicitly targeted.</li>
<li>Multicore targets have proven to  be a great sales driver for virtual platforms, as debugging software on a physical multicore, multichip, multiboard system is just too painful.</li>
</ul>
<p>Overall, this was a fun event, looking forward to next year at Chalmers!</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/1023"></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/1023" 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/1023" 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/1023/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ericsson Blog Post about DSL</title>
		<link>http://jakob.engbloms.se/archives/976?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/976#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:29:19 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[embedded software]]></category>
		<category><![CDATA[multicore software]]></category>
		<category><![CDATA[Andras Vajda]]></category>
		<category><![CDATA[Domain-specific languages]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=976</guid>
		<description><![CDATA[Andras Vajda of Ericsson wrote an interesting blog post on domain-specific languages (DSLs). Thanks for some success stories and support in what sometimes feels like an uphill battle trying to make people accept that DSLs are a large part of the future of programming. In particular for parallel computing, as they let you hide the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2009/10/ericsson_logo.gif"><img class="alignleft size-full wp-image-977" title="ericsson_logo" src="http://jakob.engbloms.se/wp-content/uploads/2009/10/ericsson_logo.gif" alt="ericsson_logo" width="127" height="62" /></a><a href="http://a-vajda.eu/blog/?p=184">Andras Vajda of Ericsson wrote an interesting blog post on domain-specific languages (DSLs).</a> Thanks for some success stories and support in what sometimes feels like an uphill battle trying to make people accept that DSLs are a large part of the future of programming. In particular for parallel computing, as they let you hide the complexities of parallel programming.</p>
<p><span id="more-976"></span></p>
<p>Quotes from the blog post:</p>
<p>Sequential languages hiding parallelism:</p>
<blockquote><p>Sequential imperative languages are notoriously good at hiding or at least obfuscating inherent parallelism in the applications – which may be good news for compiler providers who spend – and charge – big bucks for building reverse engineering technologies that can detect parallelism from sequential code; as well as for highly skilled programmers capable of building parallel code using sequential tools; however, it weights heavily on the total cost of developing software, not to mention the recurring cost of porting to newer HW with e.g. more cores.</p></blockquote>
<p>Applying DSLs to signal processing:</p>
<blockquote><p>During the work on the domain-specific language for DSP programming we have seen some interesting results; for example, several pages of optimized C code were re-written to one PowerPoint slide worth of DSL code, while the DSL to C compiler was able to output efficient code comparable in size to the original code.</p></blockquote>
<p>I agree fully with the final note:</p>
<blockquote><p>The big question is not anymore if DSLs will take off – it’s more if your pain level is higher than the cost of accepting an alternative and different approach; as the cost for taking in a new language tends to stay constant while the complexity of developing software is increasing, odds are that there will be an uptake of domain-specific languages.</p></blockquote>
<p>Go and read the full article!</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/976"></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/976" 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/976" 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/976/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cadence Industry Insight: &#8220;Virtual Platforms Unite HW and SW&#8221;</title>
		<link>http://jakob.engbloms.se/archives/784?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/784#comments</comments>
		<pubDate>Fri, 22 May 2009 06:41:09 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[embedded software]]></category>
		<category><![CDATA[embedded systeme]]></category>
		<category><![CDATA[ESL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[Cadence]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[ISX]]></category>
		<category><![CDATA[Richard Goering]]></category>
		<category><![CDATA[scdsource]]></category>
		<category><![CDATA[software testing]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=784</guid>
		<description><![CDATA[Another Cadence guest blog entry, about the overall impact of virtual platforms on the interaction between hardware and software designers. Essentially, virtual platforms are a great tool to make software and hardware people talk to each other more, since it provides a common basis for understanding. My entry is called &#8220;Virtual Platforms unites Hardware, Software [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-654" style="margin-left: 5px; margin-right: 5px;" title="opinion" src="http://jakob.engbloms.se/wp-content/uploads/2009/02/opinion.png" alt="opinion" width="91" height="69" />Another Cadence guest blog entry, about the overall impact of virtual platforms on the interaction between hardware and software designers. Essentially, virtual platforms are a great tool to make software and hardware people talk to each other more, since it provides a common basis for understanding.</p>
<p><span id="more-784"></span>My entry is called &#8220;<a href="http://www.cadence.com/Community/blogs/ii/archive/2009/05/21/guest-blog-virtual-platforms-unite-hardware-software-designers.aspx">Virtual Platforms unites Hardware, Software Engineers</a>&#8220;, and is presented by <a href="http://www.cadence.com/community/posts/rgoering.aspx">Richard Goering </a>(who used to be with <a href="http://www.scdsource.com">SCDSource</a>), in his &#8220;<a href="http://www.cadence.com/Community/blogs/ii/default.aspx">Industry Insights</a>&#8221; section of the Cadence community of blogs. Richard Goering has a personal post pointing in the same direction, about <a href="http://www.cadence.com/Community/blogs/ii/archive/2009/05/13/meeting-the-embedded-software-challenge.aspx?postID=17593">EDA tackling embedded software</a>. Worth reading.</p>
<p>Note that I do <em>not </em>say that hardware and software engineers should use the same <em>programming languages</em> as a result of using virtual platforms. Programming languages efficient for hardware design are quite different from those efficient for virtual platform creation, which are in turn different from good software engineering languages.  In some cases, some of them coincide, but in general, I believe in using the best tool for each job, and a programming language is just a tool. And the more designed it is for its task, the better. Some older posts of mine on this topic:</p>
<ul>
<li><a href="http://jakob.engbloms.se/archives/747">DSL: Purpose-built languages</a></li>
<li><a href="http://jakob.engbloms.se/archives/681">DSL: The tyranny of syntax</a></li>
<li><a href="http://jakob.engbloms.se/archives/283">Multicore programming and DSLs</a></li>
<li><a href="http://jakob.engbloms.se/archives/165">What is the obsession with C in EDA?</a></li>
<li><a href="http://jakob.engbloms.se/archives/157">Kunle Olukotun on DSLs</a></li>
<li><a href="http://jakob.engbloms.se/archives/709">Modeling hardware at a high level for software development</a></li>
</ul>
<p>And there is the <a href="http://jakob.engbloms.se/archives/306">ChipDesign article </a>from last year about using virtual platforms in the hardware design process all the way out to customers.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/784"></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/784" 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/784" 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/784/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mike Shapiro on Purpose-Built Languages</title>
		<link>http://jakob.engbloms.se/archives/747?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/747#comments</comments>
		<pubDate>Sun, 26 Apr 2009 07:58:38 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Communications of the ACM]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[Mike Shapiro]]></category>
		<category><![CDATA[purpose-built languages]]></category>
		<category><![CDATA[Sun]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=747</guid>
		<description><![CDATA[In the April 2009 issue of Communications of the ACM, Mike Shapiro of Sun (or should we say Oracle now?) has an interesting technical article about what he calls &#8220;purpose-built languages&#8220;. The article was earlier published in ACM Queue. Essentially, it is about domain-specific languages. He describes how many of the most useful little languages [...]]]></description>
			<content:encoded><![CDATA[<p>In the April 2009 issue of <a href="http://www.acm.org/cacm">Communications of the ACM</a>, Mike Shapiro of Sun (or should we say Oracle now?) has an interesting technical article about what he calls &#8220;<a href="http://portal.acm.org/citation.cfm?id=1498765.1498781&amp;coll=ACM&amp;dl=ACM&amp;CFID=32026164&amp;CFTOKEN=89659518">purpose-built languages</a>&#8220;. The article was earlier published in <a href="http://mags.acm.org/queue/200901/?folio=18&amp;CFID=32026164&amp;CFTOKEN=89659518">ACM Queue</a>. Essentially, it is about domain-specific languages. He describes how many of the most useful little languages in use for the developmentof large systems have grown up without formal design, a grammar, or even a name.</p>
<p><span id="more-747"></span>His experience is just like mine: programmers create the tools they need to solve a problem, and over time, certain useful point solutions get generalized and suddenly appear as full-blown or semi-full-blown languages. He traces the interesting case of the UNIX &#8220;adb&#8221; debugger &#8220;macro language&#8221; from its beginnings as list of very simple operations in the PDP &#8220;odt&#8221; debugger (octal address plus single-character operator) to something that was used to encode quite complex OS kernel inspection operations in Solaris. And how he found it necessary to provide an implementation of the adb macros for the mdb debugger created for the Solaris 64-bit port. Good tools just won&#8217;t die&#8230;</p>
<p>Another point that I had missed but that really shows the prevalence of domain-specific languages in highly complex systems and advanced development practice is that Solaris 10 shipped with a few new languages added. The &#8220;D&#8221; language used for dTrace is the best-known example, but there were a few other ones as well&#8230; It sounds like the point I made at a DATE 2008 panel debate (last year, missed this year due to conflicts with other duties in my life) where I took issue with the idea that &#8220;embedded software is written in C or C++&#8221; and said that &#8220;any real system contains at least 10 different languages&#8221; and that &#8220;there is a zoo in there&#8221;.</p>
<p>The last important point, I think, made in the article is the common design pattern of taking the expression syntax of an existing language and use that as the core of a domain-specific language. C is especially popular for this, since it also makes compiling simple: just generate a C-language program containing the snippets of C expressions in your language (the yacc model). It also avoid reinventing the wheel&#8230;</p>
<p>So overall, I found this article a very interesting read, not the least thanks to its long historical view of language design and tools.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/747"></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/747" 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/747" 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/747/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Tyranny of Syntax on Stackoverflow</title>
		<link>http://jakob.engbloms.se/archives/681?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/681#comments</comments>
		<pubDate>Mon, 09 Mar 2009 20:51:51 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[stackoverflow.com]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=681</guid>
		<description><![CDATA[The 44th episode of the Stackoverflow podcast contains an interesting discussion on what I have liked to call &#8220;the tyranny of syntax&#8221;.They note that for some reason people are scared of anything that does not look like C, but still lament some of the less good design patterns in C, such as the fact that [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-300" style="margin: 5px;" title="stackoverflowlogo250hq2" src="http://jakob.engbloms.se/wp-content/uploads/2008/10/stackoverflowlogo250hq2.png" alt="stackoverflowlogo250hq2" width="47" height="61" />The <a href="http://itc.conversationsnetwork.org/shows/detail4028.html">44th episode of the Stackoverflow podcast </a>contains an interesting discussion on what I have liked to call &#8220;the tyranny of syntax&#8221;.They note that for some reason people are scared of anything that does not look like C, but still lament some of the less good design patterns in C, such as the fact that closing braces have no annotations as to what is being closed. They also talk about the use of &#8220;little languages&#8221;, and an old favorite song of mine.</p>
<p><span id="more-681"></span></p>
<p>The best bit is the discussion around named parameters and how that was introduced into Visual Basic for Application in Excel &#8212; and at the same time they reduced the argument counts to most functions by replacing them with manipulating properties of objects. I think that approach does make some sense, if you have something that lends itself to that kind of expression. Their comparison of having a single function call with 83 arguments to change the style of text in Word by silently effecting a dialog box, or actually setting each of 83 properties of a dialog box object makes eminent sense&#8230; Sense that applies to simulators as well: in Simics, we do have a system like that, with attributes on all objects in the simulation that can be set to change their behavior and connections. Trying to configure that in the SystemC-style with function calls and constructors from scratch would be a pain, definitely.</p>
<p>Another topic that struck a chord with me was the notion that we are moving towards a world of &#8220;little languages&#8221; built for particular purposes. I definitely think this is the right way to go, as domain-specific languages do make getting particular things done easier. The more general a language is, the worse it is at any particular task. Better then to use a smaller language built to do one thing. As Jeff put it, for databases uses SQL, for text processing using Perl, etc&#8230; Using a multitude of languages is the hallmark of good software design and a natural instinct for a computer scientist.</p>
<p>They also found a <a href="http://www.youtube.com/watch?v=XHosLhPEN3k">YouTube video </a>of the old computer science (CS) song &#8220;<a href="http://www.mmilan.com/write-in-c/">Write in C</a>&#8220;. They do not seem to get that this is a really old song, I remember singing it way back when I was a fresh <a href="http://www.datavetenskap.nu/">undergrad CS student </a>here in Uppsala&#8230; and it was part of the first edition of our nice leather-bound songbook called &#8220;Manualen&#8221;. The lyrics are starting to feel a bit dated, but it is still a very elegant piece of writing that I think took place in the mid-1980s, judging from the other languages referenced.</p>
<p>Anyway, an unusually listen-worthy edition of Stackoverflow.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/681"></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/681" 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/681" 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/681/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The JVM as Universal Parallel Glue?</title>
		<link>http://jakob.engbloms.se/archives/264?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/264#comments</comments>
		<pubDate>Fri, 12 Sep 2008 20:45:08 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[multicore computer architecture]]></category>
		<category><![CDATA[multicore software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[kunle olukotun]]></category>
		<category><![CDATA[multicore]]></category>
		<category><![CDATA[SiCS Multicore days]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=264</guid>
		<description><![CDATA[The two days of the SiCS Multicore Days is now over, and it was a really fun event this year too. I will be writing a few things inspired by the event, and here is the first. Kunle Olukotun&#8216;s presentation on the work of the Stanford Pervasive Parallelism lab included a diagram where they showed [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-265" style="margin: 5px 10px;" title="javalogo" src="http://jakob.engbloms.se/wp-content/uploads/2008/09/javalogo.png" alt="" width="40" height="74" /><em>The two days of the SiCS Multicore Days is now over, and it was a really fun event this year too. I will be writing a few things inspired by the event, and here is the first. </em></p>
<p><a href="http://ogun.stanford.edu/~kunle/">Kunle Olukotun</a>&#8216;s presentation on the work of the <a href="http://ppl.stanford.edu/">Stanford Pervasive Parallelism lab </a>included a diagram where they showed a range of domain-specific languages (DSL) being compiled to a universal implementation language. That language is currently Scala, and in the end all applications end up being compiled into Scala byte codes, which are then optimized and dynamically reoptimized and executed on a particular hardware system based on the properties of that system. Fundamentally, the problem of creating and compiling a DSL, and combining program segments written in different DSLs, is solved by interposing a layer of indirection.</p>
<p>But this idea got me thinking about what the best such intermediary might be for large-scale general deployment.</p>
<p><span id="more-264"></span></p>
<p>And my conclusion is that the Java Virtual Machine might be the best candidate. Not the JVM as it is today, though. Here is my idea:</p>
<ul>
<li>The Sun Java JDK and its optimized HotSpot VM is now open-source, thanks to the <a href="http://www.openjdk.org/">OpenJDK</a>. This opens the door to new innovation based on solid technology.</li>
<li>The HotSpot is a pretty good VM, and therefore other languages are starting to use it as a potential backend. For example, Python can be compiled to the JVM, as can <a href="http://en.wikibooks.org/wiki/Ada_Programming/Platform/VM/Java">Ada</a>, and I expect many other language environments to follow suit. The reason is that developing and optimizing a VM is hard work, and if there already is a good one in existence, targeting that is easier than doing you own.</li>
<li>I think that long-term, this might well replace C as the universal language that you target when you do special-purpose code generators from custom languages&#8230; which are really DSLs.</li>
<li>Thanks to this foreseen ubiquity of the OpenJDK JVM as a universal byte-code execution machine, it will provide a single point of leverage across a large range of applications in a multitude of programming languages.</li>
<li>As demonstrated by the work of the PPL and the approach taken by RapidMind, the idea of using an abstract byte code for software delivery makes very much sense in a heterogeneous and networked environment. It also provides a good infrastructure for analysis and optimization. It simply is very sensible.</li>
</ul>
<p>However, the JVM as it stands today is not really suitable for this. It will need some extensions, which I am not the man to invent. With an open-source common JVM, such innovation will be easier to do. Thanks to Sun for opening up Java! For example:</p>
<ul>
<li>Support for dynamic languages like Ruby and Python: not the same dependence on Java-type static typing and Java types. They work well for Java, but less so for other languages. It would be nice with lists for real as well, and not just as a library container.</li>
<li>Support for threads. Not OS threads, but the typical very light-weight threads used in environments like <a href="http://www.erlang.org/">Erlang</a> and <a href="http://www.mozart-oz.org/">OZ</a>. Or even lighter, like the serial units of computations in the kernels of RapidMind and CUDA and similar GPGPU efforts.</li>
<li>Support for SIMD operations, to express data-level parallelism which is often pretty easy to find on a source-code level.</li>
<li>Support for data blocking, locality, tiling of some kind, to control data locality. Maybe this already exists in X10 (which I heard about at last year&#8217;s <a href="http://jakob.engbloms.se/archives/17">Multicore Day</a>).</li>
<li>Support for communication using messages, and I assume that the best model for expressing the threads is through local data, share-nothing, message passing. With a special case for sharing large data blocks.</li>
<li>Some kind of data sharing mechanism that is more structured and understandable for a runtime system than pure locks &amp; shared data.</li>
<li>And a system that takes such an advanced byte code and makes it run well on any particular machine, be it a Tilera Tile, an 8-core P4080, a 128000-core BlueGene, a GPGPU, or a plain middle-of-the-road UltraSparc T2.</li>
</ul>
<p>So there is some work to be done. But I really think this idea has some merit&#8230; if only I had research funding and some good students. Or a crazy VC. <img src='http://jakob.engbloms.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/264"></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/264" 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/264" 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/264/feed</wfw:commentRss>
		<slash:comments>4</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>
		<item>
		<title>Kunle Olukotun Interview: Heterogeneity, Domain-Specific Programming</title>
		<link>http://jakob.engbloms.se/archives/157?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/157#comments</comments>
		<pubDate>Sun, 20 Jul 2008 20:44:49 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[computer architecture]]></category>
		<category><![CDATA[multicore computer architecture]]></category>
		<category><![CDATA[CUDA]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[DSP]]></category>
		<category><![CDATA[heterogeneous]]></category>
		<category><![CDATA[kunle olukotun]]></category>
		<category><![CDATA[Motorola]]></category>
		<category><![CDATA[Niagara]]></category>
		<category><![CDATA[QUICC]]></category>
		<category><![CDATA[Stanford Pervasive Parallelism Laboratory]]></category>
		<category><![CDATA[Sun]]></category>
		<category><![CDATA[TI]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=157</guid>
		<description><![CDATA[The Radio Register has a nice interview with Kunle Olukotun, the man most known for the Afara/Sun Niagara/UltraSparc T1-2-etc. design. It is a long interview, lasting well over an hour, but it is worth a listen. A particular high point is the story on how Kunle worked on parallel processors in the mid-1990s when everyone [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-115 alignleft" style="margin: 10px;" src="http://jakob.engbloms.se/wp-content/uploads/2008/05/rtfm_logo.png" alt="TheRegister Radio Logo" width="48" height="48" />The <a href="http://www.theregister.co.uk/2008/07/18/scc18_kunle_olukotun_ppl/">Radio Register has a nice interview </a>with <a href="http://ogun.stanford.edu/~kunle/">Kunle Olukotun</a>, the man most known for the Afara/Sun Niagara/UltraSparc T1-2-etc. design. It is a long interview, lasting well over an hour, but it is worth a listen. A particular high point is the story on how Kunle worked on parallel processors in the mid-1990s when everyone else was still chasing single-thread performance. He really was a very early proponent of multicore, and saw it coming a bit before most other (general-purpose) computer architects did. Currently, he is working on how to program multiprocessors, at the <a href="http://en.wikipedia.org/wiki/International_Symposium_on_Computer_Architecture">Stanford Pervasive Parallelism Laboratory (PPL)</a>. In the interview, I see several themes that I have blogged about before being reinforced&#8230;</p>
<p><span id="more-157"></span></p>
<p>The themes are:</p>
<ul>
<li>The way there is to provide programming environments that express algorithms in a way that is clear in terms on intent but that does not constrain the implementation too much. It should hide parallelism to the user, and make that a property of the compiler and implementation, not the program. But to make this work, you need higher-level expressivity. For example, Kunle says that you want to say &#8220;do a matrix multiply&#8221; rather than &#8220;here is a pile of loops and expressioins implementing a matrix multiply&#8221;. Very sensible.</li>
<li>The proper way to do parallel programming this is to be domain-specific. Create domain-specific languages that map to how domain experts think about a problem, and then have a compiler and runtime take care of how to implement it for a particular machine. Rather than provide a low-level language that lets you express parallelism explicitly, like CUDA, Brook, threading libraries, etc, you should be using MatLab if you are doing science (which is something that National Instruments have been doing with their LabView tools).</li>
<li>Future hardware will be heterogeneous, with a mix of control-oriented simple cores (Niagara-style), data-processing-oriented cores (DSPs, security accelerators, etc.), and the occasional heavy-weight ILP-oriented core (Intel Core 2-style) for the occasional program that just needs maximal single-thread performance.</li>
<li>Operating systems today were created in an era where processors were precious resources that had to be efficiently shared. This is no longer really the case, it makes sense to dedicate single cores to single tasks for extended periods of time, as this maximizes efficiency. There are cores to spare, no problem on that accord. Nice to hear this from a general-purpose proponent, and not just embedded people.</li>
</ul>
<p>I fully agree with all of these, and I find the use of domain-specific languages and frameworks especially important. Software people in all ages have become more efficient by designing better languages, more suited for a particular task than a very general language. A language is a just a tool, after all, not a religion (even if some people seem to view it that way), and should be changed depending on the task at hand.</p>
<p>Final note for us embedded folks: when Kunle talks about how he realized around 1995 that lots of simple processors on a chip becoming feasible thanks to Moore&#8217;s law, the first real multicore chips were already shipping. Motorola had the QUICC 68000+CPM heterogeneous network processors on the market by then, and Texas Instruments had the C80 four-simple-DSPs-plus-a-simple-RISC multicore chip for digital video also out. But the <a href="http://en.wikipedia.org/wiki/International_Symposium_on_Computer_Architecture">ISCA </a>crowd really did not notice this development at all, at the time.</p>
<p>Obscure note two: Virtutech Simics was actually used by Afara to help in the design work of the Niagara, since Simics had very good support for 64-bit SPARC architectures thanks to the early work done with Sun.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/157"></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/157" 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/157" 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/157/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

