<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>Jakob Engblom</title>
    
    
    <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/" />
    <id>tag:typepad.com,2003:weblog-86673406891497227</id>
    <updated>2012-01-23T08:28:33-08:00</updated>
    <subtitle>Real Virtuality</subtitle>
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/engblom" /><feedburner:info uri="engblom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://hubbub.api.typepad.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><entry>
        <title>Making a Faulty Serial Port</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2012/01/making-a-faulty-serial-port.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2012/01/making-a-faulty-serial-port.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e20168e5d0d743970c</id>
        <published>2012-01-23T08:28:33-08:00</published>
        <updated>2012-01-23T08:29:45-08:00</updated>
        <summary>As noted before, one common use case for Simics is doing fault injection. Fault injection is typically added to an existing system without changing it, since the goal is to maintain a fundamentally fast simulator when not injecting faults. There are a range of mechanisms available in Simics to implement fault injection. This blog post will take a look at two such mechanisms and how they are used in the context of injecting faults on a serial port. We will look at two ways to induce bad behavior into a serial port in the system shown below: First, we introduce...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>As noted <a href="blogs.windriver.com/engblom/2010/10/the-virtual-basil-fawlty.html" target="_blank">before</a>, one common use case for Simics is doing fault injection.  Fault injection is typically added to an existing system without changing it, since the goal is to maintain a fundamentally fast simulator when not injecting faults.  There are a range of mechanisms available in Simics to implement fault injection. This blog post will take a look at two such mechanisms and how they are used in the context of injecting faults on a serial port.</p>

We will look at two ways to induce bad behavior into a serial port in the system shown below:
<p><img alt="Initial system setup block diagram" border="0" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20162ffda459b970d" /></p>
<p>First, we introduce faults in the interface between the serial port and the processor using it.  I.e., on the register bank of the serial port that the software on the system processor(s) use to send and receive data from the port.  This simulates a device with flaky interface circuitry, or a bus that would sometimes fail to correctly pass the data from the device to the processor.  It does not directly correspond to a faulty device, since the device operation is not affected (unless of course an error is injected on a transaction that targets the configuration or control registers of the device and have unintended side effects).</p>
<p>On the surface, this might seem trivial to implement: just pass all transaction from the main memory map through an intercept module, and have that module corrupt the transactions as it sees fit.  However, this would burden all transaction with a cost and remove the ability of the simulator to cache values and optimize accesses to memory and other devices which are not affected by the fault injection. Instead, in Simics, we can introduce a level of indirection and intercept only accesses to the serial device.</p>
<p>As shown in the picture below, we do this by introducing a private little memory map for the serial device. The mapping in the main memory map is set to point to this new memory map, and it in turn maps the serial device.  The new memory map has an intercept module attached to it which can see and modify both read and write transactions.</p>
<p><img alt="System modified to include a new memory map and an intercept module" border="0" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2016760cecba3970b" /></p>
<p>This target system modification can be done in a few lines of Simics scripting, even in the middle of a simulation. Simics allows arbitrary reconfiguration of the simulation system at runtime, and the changing of the memory map to point to something new and the introduction of a new memory map and fault injection module can both be done and undone at runtime.  Using a module instead of just a script for the injection work makes the fault injection more robust, and ensures that the injection of faults is part of checkpoints and allow for reverse execution.  Any Simics user can create such modules themselves, using the Simics Extension Builder product.</p>
<p>If we program the fault injector to replace some output characters with other characters, we get something like this:</p>
<p><img alt="L33t fault in output on mpc8641" border="0" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20168e5d021f5970c" title="L33t fault in output on mpc8641" /></p>
<p>Note how the output is suddenly corrupted with a bit of L337-style text.  This is achieved by changing the values written to the serial port transmission register, on their way from the processor to the device. The processor is not affected, only the data in flight.</p>
<p>A second fault injection pattern hooks into the back end of the serial device. The serial device has a front end that handles the registers facing the processor, and a back end that handles the transmission and reception of characters (transactions) on the serial line.  The front end and back end are tied together by the core device functionality.</p>
<p>The back end implementation has the serial device modeling talking to a model of a serial console (or other hardware attached to a serial port) using the Simics "serial interface".  Note that the serial device does not interact directly with a user, but rather it expects some other model in the simulation to provide this service.  In this example, it is a serial console, but it could just as well be another virtual machine. It can also be a fault injection module that puts itself into the path of the data, as shown below:</p>
<p><img alt="System setup with an intercept device between serial port and serial console" border="0" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2016760cecef2970b" /></p>
<p>Unlike the previous case, here we put the fault injection module on the actual data path.  The fault injection module actually receives <em>all</em> data and passes it on to the other side of the connection. It is not selective in the same way as an intercept module. Just like with the intercept module, making this an explicit part of the simulation enables checkpointing and reverse execution to work during fault injection.</p>
<p>In the code, each output from the serial device calls a function in the serial interface of the fault injection module, which in turn calls the same function in the serial interface on the serial console. If data is just forwarded, neither the serial device nor the serial console sees anything different.  However, the fault injector can do anything with the data as part of passing it on, including changing data and dropping data. </p>
<p>It is also possible to introduce spurious data transmissions, simulating random noise on the line that looks like actual data transmissions to the devices in the system.  Note that since Simics does not actually simulate the analog encoding on the serial line, a model of random works by generating entire characters - essentially simulating a case where noise is interpreted as valid data by the receiver circuitry.  The intercept module used in the previous example could also create transactions, but would have to make use of additional interfaces to do it (it would essentially perform its own independent memory accesses).</p>
<p> </p>
<p><em>For additional information from Wind River, visit <a href="http://www.facebook.com/WindRiverSystems" title="http://www.facebook.com/WindRiverSystems">http://www.facebook.com/WindRiverSystems</a>.</em>  </p></div>
</content>



    </entry>
    <entry>
        <title>Simics for Networked Systems: An Interview with Dan Poirot</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/11/simics-for-distributed-systems-an-interview-with-dan-poirot.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/11/simics-for-distributed-systems-an-interview-with-dan-poirot.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e20162fc15ba89970d</id>
        <published>2011-11-16T06:44:34-08:00</published>
        <updated>2011-12-14T00:42:02-08:00</updated>
        <summary>Networked systems is one of the primary application areas for Simics. Simics can run many machines inside a single Simics simulation, and apply all Simics features to the system, not just to a single machine inside the system. This is something that Dan Poirot from Real-Time Innovations, RTI, has made quite extensive use of recently. It is a pretty cool use-case for Simics, so we arranged to interview Dan about his use of Simics. Jakob Engblom: We start with the basics. Can you introduce yourself? Daniel Poirot: Hello! My name is Daniel Poirot. I am the RTI Senior Field Applications...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Networking" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Tools" />
        
        
<content type="html" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;p&gt;&lt;img class="asset  asset-image at-xid-6a00d83451f5c369e20162fc15b677970d" style="margin: 0px 0px 5px 5px;" title="Dan Poirot" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20162fc15b677970d-800wi" border="0" alt="Dan Poirot" align="right" /&gt;&lt;/p&gt;
&lt;p&gt;Networked systems is one of the primary application areas for &lt;a href="http://www.windriver.com/products/simics/" target="_self"&gt;Simics&lt;/a&gt;. Simics can run many machines inside a single Simics simulation, and apply all Simics features to the system, not just to a single machine inside the system. This is something that Dan Poirot from Real-Time Innovations, RTI, has made quite extensive use of recently. It is a pretty cool use-case for Simics, so we arranged to interview Dan about his use of Simics.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Jakob Engblom&lt;/em&gt;: We start with the basics. Can you introduce yourself?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; Daniel Poirot&lt;/em&gt;: Hello! My name is Daniel Poirot. I am the &lt;a href="http://www.rti.com/" target="_self"&gt;RTI &lt;/a&gt;Senior Field Applications Engineer covering the Southeast US. I came to RTI following 13 years selling development tools in the embedded industry. Prior to that I worked for 15 years as a developer in the NASA Johnson Space Center community.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: That's a very impressive bio, I only have about 14 years myself in the embedded space. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: So, what does RTI do?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: &lt;a href="http://www.rti.com/" target="_self"&gt;Realtime Innovations &lt;/a&gt;sells tools and services supporting and extending the &lt;a href="http://omg.org/" target="_self"&gt;Object Modeling Group &lt;/a&gt;(OMG) &lt;a href="http://portals.omg.org/dds/" target="_self"&gt;Data Distribution Service &lt;/a&gt;(DDS) standard. RTI DDS accelerates the integration of real-time, mobile and embedded applications with each other and with enterprise and legacy applications. RTI DDS provides the developer a data-centric, dynamically configured, fully anonymous, publish/subscribe system with many powerful Qualities of Service (QoS). Applications can be written needing very little knowledge of the deployed system ahead of time.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: How do you use Simics?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: I have used Simics at RTI as well as at positions with two earlier companies. In each case, Simics has provided a binary compatible representation of networks of different CPU types running different target operating systems! Simics is also a great way to prototype a system of systems or service oriented architecture. Additionally, Simics gives RTI a robust platform for testing our products during development.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;&amp;nbsp;JE&lt;/em&gt;: So you simulate multiple target machines in a single Simics session, right?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: Yes indeed, including heterogeneous systems. I have used Wind River VxWorks and Wind River Linux as well as ‘kernel.org’ Linux on a number of simulated machines at the same time. I started with a single Power Architecture target and have progressed to different Power Architecture and Intel Architecture targets.&lt;/p&gt;
&lt;p&gt;Simics offers the developer (using Windows or Linux on their PC) access to other chips (including Intel, Power, MIPS, ARM) running other operating systems (VxWorks, VxWorks 653, WR Linux, and others).&lt;/p&gt;
&lt;p&gt;RTI offers a common API (OMG DDS) and interoperable network wire protocol (OMG RTPS) allowing applications written in different languages (C, C++, Java, .NET, Ada) to communicate seamlessly on these targets.&lt;/p&gt;
&lt;p&gt;If we put this together, by using Simics, we can demonstrate and test these combinations on a single PC, no need to cart around a case of different development boards.&lt;/p&gt;
&lt;p&gt;Here is an example screenshot (click to enlarge):&lt;/p&gt;
&lt;p&gt;&lt;a style="display: inline;" onclick="window.open( this.href, '_blank', 'width=640,height=480,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0' ); return false" href="http://blogs.windriver.com/.a/6a00d83451f5c369e20162fc7875a7970d"&gt;&lt;img class="asset  asset-image at-xid-6a00d83451f5c369e20162fc7875a7970d image-full" title="Rti-screenshot-with-comments" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20162fc7875a7970d-800wi" border="0" alt="Rti-screenshot-with-comments" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We see lots and lots of windows in a system where we are simulating multiple boards for use with Windriver Workbench.&lt;/p&gt;
&lt;p&gt;‘Simics Control’ shows the configuration of two dual-core p2020 RDB boards, ADAM and BERTIL. Their serial consoles are on the left displaying typical VxWorks 6.8 operations.&lt;/p&gt;
&lt;p&gt;Also included is CESAR, a p2020 DS board. It’s serial console is at the bottom left. It is showing WR Linux 4.0 commands.&lt;/p&gt;
&lt;p&gt;The ‘Simics Command Line’ window is used to configure the running system. Here we enter commands such as ‘connect-real-network-host’. Errors are logged here as well results from as my successful configuration.&lt;/p&gt;
&lt;p&gt;To the far right we see the ‘Advanced Device Development’ perspective of Windriver Workbench configured with Target Servers for the simulated boards.&lt;/p&gt;
&lt;p&gt;The ‘Host Shell’s at the bottom of the screen are attached to the Target Servers for ADAM and BERTIL. Here we see similar but different VxWorks output.&lt;/p&gt;
&lt;p&gt;In a typical development use case, RTI DDS may be loaded as a series of shared libraries and the target application.&lt;/p&gt;
&lt;p&gt;Each of the VxWorks windows shows the RTI DDS libraries, libnddscore, libnddsc and libnddscpp, as well as an application, either ‘rtiddsping’ or ‘rtiddsspy’.These Ping and Spy applications are used initially to confirm proper network connectivity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: Yes, using Simics like that can simplify both testing and demonstration of solutions. The final product obviously has to run a specific physical piece of hardware, but a large part of the development can be done in a virtual world with much more convenience, as you noticed. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: What kinds of network topologies are involved? &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: RTI DDS supports a wide variety of standard networking protocols as well as shared memory and ‘disadvantaged or intermittent’ links. RTI DDS applications can communicate using shared memory, UDP, TCP, DTLS, TLS, IPv4 and IPv6 without having to program directly to those protocols. Using Simics we can create networks of subnets and show how applications communicate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: So,you are not only using multiple machines, but also multiple network links inside of Simics?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: High speed, reliable communications across networks is fundamental to the RTI DDS product. It has be a challenge to setup a good demonstration of several networks. I always seem to need ‘n+1’ computers! With Simics we can virtualize the machines needed. The target operating systems are configured as they would on ‘real’ hardware. Testing and demonstration of a system of systems or service oriented architecture can actually be realized with different networks and different network IP numbers – just like in the ‘real’ world.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: Virtual&amp;nbsp; networks are convenient, I must say. The fact that&amp;nbsp; you can always add another machine without having to scavenge for lab hardware is something we have heard from many places as being a very valuable property of a virtual system compared to a physical one. &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;JE: Was there anything else in Simics that helped you get your tests done?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP:&lt;/em&gt; The high fidelity of the Simics targets allows us to use standard development tools such as Windriver Workbench. We are also able to use RTI networking tools such as Analyzer and Monitor to visualize DDS information. Open source tools such as Wireshark can even be used on the simulated networks.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: So you also connected the virtual machines to the outside physical network?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DP&lt;/em&gt;: Yes. I was pleased to see that Simics uses popular  network simulation tools. We use OpenVPN at RTI so adding additional  virtual interfaces using TAP-Win32 is very straightforward for me. The  tools are all scripted so the details only need to be set once.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;JE&lt;/em&gt;: Thanks for your time! This has been very interesting, seeing how Simics is applied to this kind of distributed networked system.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update, Dec 14, 2011. &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Below, you can see a video of another use of RTI DDS on Simics. We are running the RTI DDS "squares" demo on an MPC8548 target running VxWorks. We are using Simics 4.6 on a Linux host.  Simics is running in real-time-mode (slowed down so that the simulated target does not run away from host time). The target is connected to the host over a real-network connection, and runs the "squares" demo from the DDS demo suite. The visualization is on the host, based on computed messages from the MPC8548 code running on Simics. If we did not use real-time mode, it should just flicker as the target would be feeding updates far faster than a physical target would, since the code on the target is using "sleep" to produce updates at a reasonable rate.&lt;/p&gt;
&lt;iframe width="640" height="480" src="http://www.youtube.com/embed/daR3-xsFUp8" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
</content>



    </entry>
    <entry>
        <title>Why Simics won't Run Super Mario </title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/10/why-simics-wont-run-super-mario-.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/10/why-simics-wont-run-super-mario-.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e2015435b3f7f4970c</id>
        <published>2011-10-13T10:54:17-07:00</published>
        <updated>2011-10-13T10:54:17-07:00</updated>
        <summary>Emulating old computer gaming systems is a popular consumer-market application of simulation technology similar to Wind River Simics. There are a large number of emulators out there, emulating everything from old arcade games to the home computers of the 1980's to gaming consoles. These emulators might seem quite similar to Simics on the surface, but in practice, the simulation technology employed is quite different. You will never see Simics simulate an old Super NES running Super Mario Bros. It all comes down to the level of timing accuracy required. To accurately run games written to run well on the very...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Emulating old computer gaming systems is a popular consumer-market application of simulation technology similar to Wind River Simics. There are a large number of emulators out there, emulating everything from old arcade games to the home computers of the 1980's to gaming consoles.  These emulators might seem quite similar to Simics on the surface, but in practice, the simulation technology employed is quite different.  You will never see Simics simulate an old Super NES running Super Mario Bros. </p>
<p>It all comes down to the level of timing accuracy required.</p>

To accurately run games written to run well on the very limited hardware of the 1980s, you need a fairly detailed simulation of the hardware circuits and their timing.  Game programming on 1980's and early 1990's was a matter of writing code that was very tailored to the hardware and intimately depended on the hardware timing.  A typical trick applied on many system was to change the color palette, display mode settings, or even the contents of the screen buffer during the time that it was being redisplayed on the TV. Since every unit shipped was identical, this was a viable strategy.  I wrote code like this myself on my <a href="http://jakob.engbloms.se/archives/1360" target="_self">old ZX Spectrum</a>, achieving <a href="http://en.wikipedia.org/wiki/ZX_Spectrum_graphic_modes" target="_self">increased vertical color resolution,</a> by changing the <br />color data in the graphics display while the graphics "system" was sending display data to the attached TV.
<p>ArsTechnica ran <a href="http://arstechnica.com/gaming/news/2011/08/accuracy-takes-power-one-mans-3ghz-quest-to-build-a-perfect-snes-emulator.ars" target="_self">a very interesting article</a> in August of 2011, about the most accurate emulation yet of the Super Nintendo Entertainment System (SNES) (or Super Famicon as it was known in Japan).  The article describes how successive generations of SNES emulators have got closer and closer to the actual hardware timing.  The timing that needs to be simulated can be very detailed indeed, such as the interleaving of bus accesses between different hardware units.  At the same time, hardware requirements for running the emulator has increased hundredfold from the first emulators from 1997 until today. Precision costs compute power, and this is essentially about using 100 times more computation cycles on the host to run the target system just as fast.</p>
<p>As described in the article, the latest "BSNES" emulator is about 10 times more resource-intense than the previous "ZSNES" simulator, for an increase in accuracy of 10.  That is actually very impressive, usually precision tends to be exponential in cost.  However, the really interesting statistic is that this only gives you a few more playable games.  ZSNES manages to run about 95% of all games, for a much lower cost in computation and implementation. Only in a few cases is the additional accuracy of BSNES absolutely needded in order to correctly run games or render graphics effects correctly.</p>
<p>This is all very interesting, but in which way is the emulation of old video games relevant for what we do today with Simics and virtual platforms in the embeddded systems field? It offers a neat illustration of the tradeoff between speed of execution and level of detail (and accuracy) of the virtual platform model.  Simics is not trying to be BSNES, it is much more like ZSNES or its predecessors. </p>
<p>Simics is designed to emphasize speed of execution over detail of model. This is a deliberate choice, and it has proven critical in enabling the usage that Simics is seeing today.  By being fast enough to real-world software workloads in a reasonable time, Simics is acceptable to software developers as a daily tool. Interestingly, this was echoed in a <a href="http://mentor1.adobeconnect.com/p329yt36wr6/" target="_self">DAC 2011 panel on ESL </a>- without sufficient speed, software developers will not use a virtual platform. It is a crucial enabler.</p>
<p>The trade-off is pretty drastic: adding just a little detail to a simulator can quickly cut your speed down by a factor of ten. The diagram below has been shown in any number of variants in any number of venues, and the crucial fact that the curve is not straight. It drops very quickly initially as you go from left to right.</p>
<p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e2015435b3f78e970c-pi" style="display: inline;"><img alt="Speed vs detail" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e2015435b3f78e970c" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2015435b3f78e970c-800wi" style="display: block; margin-left: auto; margin-right: auto;" title="Speed vs detail" /></a> <br /><br /></p>
<p>The reason that building a fast simulator in the Simics style works is that current software does not rely on the physical system timing in the same way that old console games do. The hardware today is very variable in its timing (processor pipelines, multiple levels of cache, branch prediction, multiple processors competing for shared resources, etc., all conspire to make execution-time variable and <a href="http://jakob.engbloms.se/archives/1370" target="_self">unpredictable</a>). With the proliferation of levels of software abstraction, code that is tightly coupled to the hardware is almost impossible to write in general.  Instead, hardware-software interfaces have become event-driven, using interrupts to signal completion, or using poll loops on status bits for handshakes.  Code is also supposed to live across several generations of hardware, discouraging coding that is too tightly dependent on the characteristics of any particular hardware platform.</p>
<p>This is much more simulation-friendly since there is no need to know exactly how long an operation would take on hardware, as long as the simulator latency is of the right order of magnitude.  For most use cases, adding more detail than that just makes the simulation run slower, limiting its usefulness for the majority of software developers. It also makes the development of the models more expensive, since building a very accurate and detailed model is many times more costly than building a good enough model.</p>
<p>There is certainly software that does depend on the precise timing of the hardware. In real-time-critical software like signal processing and low-level firmware, there is hardware that does have very predictable timing, and software that depends on this timing.  Still,<br />such software is but a small part of the overall body of software that we run on today's systems. When needed, you can often build small workarounds into a simulator to make the software run right - just like the many game-specific patches in ZSNES discussed in the ArsTechnica article.  This is overall much more efficient than always simulating at a high level of detail just to make the really picky software happy.</p>
<p>In our experience, it is more valuable to run all of the software at a sufficient level of detail, than to run a small part of the software with a very high level of detail.  And just like we see with the ZSNES simulator, you can cover a very large base of software without going into too much detail on the hardware side. </p>
<p>I hope you now understand why Simics is not likely going to run Super Mario at the level of fidelity of BSNES - and why doing so really does not make sense for most uses of a virtual platform. But I still applaud and admire the effort and dedication that went into building BSNES, and the way in which this is preserving an important part of our digital heritage. </p>
<p> </p></div>
</content>



    </entry>
    <entry>
        <title>Stop, Think, and Tie Your Shoes Right</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/09/stop-think-and-tie-your-shoes-right.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/09/stop-think-and-tie-your-shoes-right.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e2015434eddcfe970c</id>
        <published>2011-09-21T09:42:31-07:00</published>
        <updated>2011-09-21T09:42:31-07:00</updated>
        <summary>I was sent a link to a past TED talk about how to tie your shoes. It is worth watching, and from the discussions I have seen on Facebook around the video, it seems that most people do it the "wrong" way. I have actually started to try to do it the "right" way, and the result is real improvement. Tying the "right" way does make the bands look better. However, it did require a little bit of practice and a conscious effort to change. Shoe tying is admittedly somewhat away from embedded systems development, but the principle is general....</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Wind River" />
        
        <category scheme="http://sixapart.com/ns/types#tag" term="Simics" />
        <category scheme="http://sixapart.com/ns/types#tag" term="simulation" />
        <category scheme="http://sixapart.com/ns/types#tag" term="system simulators " />
        <category scheme="http://sixapart.com/ns/types#tag" term="virtual platforms" />
        <category scheme="http://sixapart.com/ns/types#tag" term="Wind River" />
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e20153911a7399970b-pi" style="display: inline;"> </a><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e20153911a74a1970b-pi" style="float: left;"><img alt="Shoes 2" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e20153911a74a1970b" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20153911a74a1970b-800wi" style="margin: 0px 5px 5px 0px;" title="Shoes 2" /></a> I was sent a link to a past <a href="http://www.ted.com/talks/terry_moore_how_to_tie_your_shoes.html" target="_blank">TED talk about how to tie your shoes</a>. It is worth watching, and from the discussions I have seen on Facebook around the video, it seems that most people do it the "wrong" way.  I have actually started to try to do it the "right" way, and the result is real improvement. </p>
<p>Tying the "right" way does make the bands look better. However, it did require a little bit of practice and a conscious effort to change. </p>
<p>Shoe tying is admittedly somewhat away from embedded systems development, but the principle  is general.  Doing things in a better way requires three things: understanding that there is an issue with how things are done today (bad knots), knowledge of a better way of doing it (good knots), and the time and effort to change your habits (dedication).</p>

In our world of embedded systems, you will always find issues with how things are done.  Too slow, too expensive, too many bugs... finding problems is the easy part.  What is harder to find are better ways of doing things, and what is really hard to find is the time and motivation to actually effect change.
<p>A speaker at a Cadence event I attended last year pointed out that life is tough for hardware engineers.  In addition to doing their current job of designing hardware, they are supposed to start thinking about how to support software development.  How would you find time for that?  You are already too busy doing your assigned hardware design work to find time to care about the overall product design process.  To really make change happen, you would need room to stop, take a step back, and think about what you should do and how to do it.</p>
<p>We often encounter this when introducing Simics virtual platforms to new users.  Simics certainly seeems to provide many useful abilities and has the potential to change development processes for the better (browse through <a href="http://blogs.windriver.com/wind_river_blog/simics/" target="_blank">other Simics blog posts </a>for more on what Simics does).  Turning that potential into actual process improvement requires both understanding how it work, and the time to implement and change habits.</p>
<p>In the end, it comes down to leadership and management.  Individual engineers have to be given the time and incentive to try new tools and new ways to use old tools.  Some things could be as simple to implement as a better way of tying your shoes -- while others are more like gathering 1000 people and convincing them all that they really should use shoes with bands rather than velcro-based sandals <strong>and</strong> to tie these newfangled shoe things in a particular way. There are also people who have not realized that shoes have laces, and the reason that they are constantly tripping and hurting themselves are those loose laces. The good thing about such cases is that tying the shoe ever which way is an improvement.</p>
<p>By the way, for some reason most of my swing dancing friends already knew how to tie shoes the right way. I guess shoe-tying matters more in some cases. If you want to look sharp, you have to invest the time to do things right!</p></div>
</content>



    </entry>
    <entry>
        <title>Surfing the Web with Netscape 4</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/09/surfing-the-web-with-netscape-4-1.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/09/surfing-the-web-with-netscape-4-1.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e2015390d27c53970b</id>
        <published>2011-09-08T08:34:52-07:00</published>
        <updated>2011-08-22T01:49:24-07:00</updated>
        <summary>While looking into our old SPARC server targets for our new SPARC legacy offering, I opened up a Simics demo checkpoint that we have had around for a long time (at least eight years). This demo is an UltraSPARC II running Solaris 9, and it shows how web browsers looked around 2001. I used real-network to connect the machine to the Internet, and tried the default webbrowser - Netscape 4.78, built in June of 2001. Since the Javascript implementation in the browser is pretty poor, and its CSS support terrible, the main Wind River home page would not basically not...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>While looking into our old SPARC server targets for our new <a href="http://www.windriver.com/simics_sparc_offer/" target="_self">SPARC legacy offering</a>, I  opened up a Simics demo checkpoint that we have had around for a long time (<a href="http://blogs.windriver.com/engblom/2010/08/shiny-old-hardware.html" target="_self">at least eight years</a>). This demo is an UltraSPARC II running Solaris 9, and it shows how web browsers looked around 2001.  I used real-network to connect the machine to the Internet, and tried the default webbrowser - Netscape 4.78, built in June of 2001.</p>
<p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e2015434a5f6b3970c-pi" style="display: inline;"><img alt="Netscape 4.78 about box" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e2015434a5f6b3970c image-full" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2015434a5f6b3970c-800wi" title="Netscape 4.78 about box" /></a></p>

Since the Javascript implementation in the browser is pretty poor, and its CSS support terrible, the main Wind River home page would not basically not render in any useful form. Our blog page at <a href="http://blogs.windriver.com/wind_river_blog/simics/ " target="_self">http://blogs.windriver.com/wind_river_blog/simics/ </a>does render - but maybe not in the expected way:<br /><br /> <a href="http://blogs.windriver.com/.a/6a00d83451f5c369e2015434a5f760970c-pi" style="display: inline;"><img alt="Netscape 4 and wind river" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e2015434a5f760970c image-full" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2015434a5f760970c-800wi" title="Netscape 4 and wind river" /></a>
<p>As a friend of mine commented on Facebook - is the problem that there are too many Jakobs there?</p>
<p>For all its shortcomings, we also have to admit just how revolutionary  Netscape was. I still recall using version 1 to look at the few pages of  the nascent world-wide-web when I was still a university  undergraduate... And I am writing this blog using Firefox 6, which  essentially is the latest in the line of development leading up from  Netscape 4.</p>
<p>While it makes for some laughs to visit the past in this way, it can also be very useful.  If you have some old applications still living on an old machine like a Solaris 9 SPARC, what do you do?  Sometimes you can port the applications to more recent systems, but there are cases where it is just simpler, cheaper, and less risky to use a virtual machine to keep it running.  For example, if the source code is lost, the application is just a binary, the application depends on some device driver (which we can run on the virtual platform, since we run the complete OS stack), or even when there is source it has annoying word-length and endianness problems.</p>
<p>Note that if we would have liked to see a web site like it was back in 2002, we could have added a server to the virtual network to serve the pages like they looked back then. Preferably, running a contemporary web server on a contemporary OS to make it more "authentic" .</p>
<p> </p></div>
</content>



    </entry>
    <entry>
        <title>A Virtual Year</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/08/a-virtual-year.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/08/a-virtual-year.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e2015434886b92970c</id>
        <published>2011-08-19T08:36:43-07:00</published>
        <updated>2011-08-19T08:39:04-07:00</updated>
        <summary>A while after I woke up my laptop today, I realized that the fan was pretty noisy. That typically indicates that the processor is working busy on something, and then I spotted Simics in the task bar. Checking in on that Simics showed that it was indeed running, and pausing it did lower the load on machine to the point that the fans calmed down. Turned out that while I was doing other things, Simics had been busily simulating away on one of my cores. Indeed, it had simulated what was almost a complete year. As you can see on...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>A while after I woke up my laptop today, I realized that the fan was pretty noisy. That typically indicates that the processor is working busy on something, and then I spotted Simics in the task bar. Checking in on that Simics showed that it was indeed running, and pausing it did lower the load on machine to the point that the fans calmed down. Turned out that while I was doing other things, Simics had been busily simulating away on one of my cores. Indeed, it had simulated what was almost a complete year.</p>

<a href="http://blogs.windriver.com/.a/6a00d83451f5c369e20154348854aa970c-pi" style="float: right;"><img alt="I forgot to turn off Simics" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e20154348854aa970c" src="http://blogs.windriver.com/.a/6a00d83451f5c369e20154348854aa970c-800wi" style="margin: 0px 0px 5px 5px;" title="I forgot to turn off Simics" /></a> As you can see on the right, the time indicator in the Simics control window shows that the target had executed for 7988 hours. That is close to 333 days, which is pretty close to a year.
<p>This was achieved in about 4 hours and 20 minutes of host time. Simics was moving time forwards about 1800 times faster than real time. Just how can that be?</p>
<p>Simple - idle optimization, also known as hypersimulation. This old Power Architecture model was simply sitting at prompt, doing nothing. When a target does nothing, Simics can simply jump ahead in time to the next interesting event (a device interrupt or timer interrupt, typically) it knows about. The key to making this work is that all Simics devices that perform input or output talk to the outside world through Simics-provided virtual IO systems and never talk directly to the host. This gives the Simics simulation kernel the information it needs to perform good hypersimulation.</p>
<p>Having a target doing nothing might seem like a rare case, but in practice it is pretty common. For example, if you have a network or rack of target machines, only a few are typically active unless you manage to inject a very heavy load. On a multicore device, many programs only make use of one or a few cores. In both these cases, hypersimulation virtually makes the other machines and cores go away in terms of performance - almost all simulation time can be spent on the active units of the simulation, increasing performance many times compared to slogging through each and every cycle on each and every target processor.</p>
<p>There are also systems that are mostly idle per design. Sensor networks is one such example and long-running space missions another. Often, such systems wake up for an instant to check on the world, and then sleep for 99% or so of their time. In this case, hypersimulation enables you to speed up time 1000-fold and run through scenarios that just cannot be tested on physical hardware since it would take just as much real time - and who would sit around for five years watching a hardware mockup?</p></div>
</content>



    </entry>
    <entry>
        <title>How to Get Virtual</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/08/how-to-get-virtual-.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/08/how-to-get-virtual-.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e2014e8948481b970d</id>
        <published>2011-08-02T01:52:36-07:00</published>
        <updated>2011-08-02T01:52:36-07:00</updated>
        <summary>My blog posts about Simics tend to focus on how virtual platforms are used and what you can do with them. However, underlying all Simics use is the issue of getting a virtual platform in place. You need some kind of platform to run your software on in order to get the full benefit of Simics. Thus, creating virtual platforms is an important part of practical Simics use for many of our users. We have been working with Simics for more than a decade, and we have learnt a lot about modeling along the way. The approach we have ended...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>My blog posts about Simics tend to focus on how virtual platforms are used and what you can do with them. However, underlying all Simics use is the issue of getting a virtual platform in place. You need some kind of platform to run your software on in order to get the full benefit of Simics. Thus, creating virtual platforms is an important part of practical Simics use for many of our users.</p>
<p>We have been working with Simics for <a href="http://blogs.windriver.com/engblom/2011/05/twenty-thirty-and-sixty-years-ago.html" target="_self">more than a decade</a>, and we have learnt a lot about modeling along the way. The approach we have ended up with is a top-down methodology, where we start by investigating the <em>target system as a whole</em> from the perspective of the intended use cases<em>, </em>and then explore the details of each subsystem in order to determine how best to model it.  We then switch to bottom-up, applying an iterative modeling flow that delivers something useful as quickly as possible. During development, the goal is to always keep a useful (albeit probably incomplete) platform available at all times.</p>

It is easy to get distracted by the details when creating a virtual platform.  If you start with a list of all the components of a system without considering the system context, you are likely to assume you need to model everything, as well as every function of everything. This is usually an overwhelming task, resulting in a protracted development project without clear focus or any chance of delivering something early. So, we need a better way. 
<p>The method we typically use with Simics is to start by investigating how the system is going to be used, and which hardware units are involved in these use cases. In this way, we can often exclude parts of the target system from consideration. Certain subsystems or subsystem functions might not be needed at all, or needed only at a later stage of the project.  Even when modeling an SoC with the eventual goal of a complete model, it is possible to create a priority list and staging sequence that quickly gets something into the hands of users that applies to their initial use cases.</p>
<p>Once this analysis is complete, the existing library of Simics models might well cover a large part of what is needed. There could also be "near misses", where a small adjustment to an existing model is all that is needed. In this way, the ever-growing library of Simics models provides significant short-cuts towards a final system model.</p>
<p>Next, it is time to start building the new models needed to complete the target system. This process is run in an iterative, agile way. We strive to define a minimal subset of the target system that we start with, so that software can be run on the target as soon as possible. The outer loop of the modeling effort is the extension of the overall system model and the testing of software on it.  The inner loop is the  creation and changing of individual device models, using both  model-level unit tests and software tests to drive the development.</p>
<p>The net result is an flexible project where the virtual platform can be updated in reaction to changes to the target system design. Often, modeling projects are begun before the details of the eventual target hardware are completely known. As shown in the picture below, the result is a series of incremental model deliveries that represent the current design state of the hardware.</p>
<p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e201538f551163970b-pi" style="display: inline;"><img alt="Iterative hardware development" border="0" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201538f551163970b-800wi" title="Iterative hardware development" /></a></p>
<p>This modeling method applies regardless of whether the modeling being performed is <a href="http://blogs.windriver.com/engblom/2010/06/travelling-into-64bit-land-with-simics.html" target="_self">pre-hardware </a>(for a new chip that might not even be announced yet or a new board built on existing components), post-hardware for a board or system that exists right now, or post-obsolence for an <a href="http://blogs.windriver.com/engblom/2010/08/shiny-old-hardware.html" target="_self">old system that still needs to be maintenaned</a>.</p>
<p>Modeling can be done by Wind River, Simics users themselves, or third-party services firms. All Simics users are equal in what they can model and their access to the Simics modeling tools and APIs.</p>
<p>To learn more about system modeling with Simics, please read <a href="http://www.windriver.com/whitepapers/whitepaper.php?f=Simics_WP_Creating_Virtual_Platforms_0511.pdf" target="_self">our new white paper</a> on creating virtual platforms with Simics.</p>
<p>Happy modeling! And remember - <a href="http://blogs.windriver.com/engblom/2011/05/twenty-thirty-and-sixty-years-ago.html" target="_self">resistance is futile, you will be simulated</a>!</p></div>
</content>



    </entry>
    <entry>
        <title>Software at the Toddler Stage</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/06/software-at-the-toddler-stage.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/06/software-at-the-toddler-stage.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e201543312bc03970c</id>
        <published>2011-06-29T08:37:22-07:00</published>
        <updated>2011-06-29T08:37:22-07:00</updated>
        <summary>Developing software is an adventure where you explore the unknown, one line of code at a time. At some point, the program reaches the stage where you can actually run it and try it - and that's where the real fun begins. The software will sometimes behave as expected, but more often than not it will not. It will do something else, or crash, or generally do the wrong thing. It is very much like a toddler - you can rely on it to some extent, but you never know when it will decide to do something unexpected, funny, or...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Developing software is an adventure where you explore the unknown, one line of code at a time.  At some point, the program reaches the stage where you can actually run it and try it - and that's where the real fun begins.  The software will sometimes behave as expected, but more often than not it will not. It will do something else, or crash, or generally do the wrong thing.  It is very much like a toddler - you can rely on it to some extent, but you never know when it will decide to do something unexpected, funny, or just throw a fit over something that would have seemed inconsequential.</p>

I have spent quite a bit of time recently with toddler stage of Simics 4.6 (prereleases and betas).  The end result is really good and qualifies as an adult specimen (as discussed <a href="http://blogs.windriver.com/engblom/2011/05/simics-46-initial-impressions.html" target="_blank">previously on this blog</a>), but there was a lot of entertaining (and frustrating) things that went by as Simics 4.6 was a toddler. All software developers have stories like these to tell, but I just wanted to share a few of the funnier ones and give a glimpse of just how much work it is to get something like Simics running.
<p>My favorite issue was the strange memory allocation happening in Eclipse on 64-bit Windows host.  <a href="http://blogs.windriver.com/.a/6a00d83451f5c369e201543312b8ec970c-pi" style="float: right;"><img alt="Slider causing grief" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e201543312b8ec970c" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201543312b8ec970c-800wi" style="margin: 0px 0px 5px 5px;" title="Slider causing grief" /></a> When I opened the Simics timeline view, the Eclipse process grew by exactly 4 GB plus 4 bytes.  When I closed it, the memory was deallocated, all nice and tidy.  It worked perfectly well on all other hosts.  It turns out that the reason was that our magnification slider (see picture) used a Windows widget that when running in 64-bit mode allocated exactly 4 bytes for each step of<br />the slider.  Since we wanted a slider that could handle a very large data set as the worst case, we had set it to allow 1 billion as maximum value.  Reducing this to a few hundred thousand allows<br />for sufficient resolution and causes no memory issues.  One still wonders why Microsoft made the widget behave that way.  I guess it just wasn't tested for anything but a volume control with 11 steps or something.  Once again, users violate the assumptions of software designers.</p>
<p>In another case, the debugger got a bit confused about endianness, and managed to display some variables as BE and others as LE. In the same view, for the same target program, at the same time.  Gave me a good laugh seeing it and diagnosing why some variables with the value "1" were shown as 16777216. I am a nerd at heart, I admit.  A bit like a child writing letters backwards as they learn to write.</p>
<p>The Simics toddler also was confused about directions sometimes. Pressing the "reverse" button instead made it go forward.  Pressing "stop" when it was stopped also made it run forward, which was a bit more surprising. All was easily sorted by wiring the right buttons to the right functions.</p>
<p>All software developers have many stories like these to tell, and it underscores the continued importance of creative and intensive testing.  Many issues do not show up until you start to put all the pieces together, and that aspect of integration testing is one of the main uses of Simics itself.</p></div>
</content>



    </entry>
    <entry>
        <title>They Just Upgraded our Coffee Machine</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/06/they-just-upgraded-our-coffee-machine.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/06/they-just-upgraded-our-coffee-machine.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e201538f3fb3fd970b</id>
        <published>2011-06-17T04:44:58-07:00</published>
        <updated>2011-06-17T04:44:58-07:00</updated>
        <summary>They just upgraded our coffee machine in the office. When I came out into the kitchen to get another cup, a service technician was there with a laptop perched on the sink and a USB cable running into the innards of the coffee machine, into the back of its open front panel. When I asked what was going on, he said that he was updating the coffee machine. In particular, he was adding the feature of selecting the strength of the coffee being brewed. A software update to add features to a coffee machine? It is a bit weird, but...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>They just upgraded our coffee machine in the office. When I came out into the kitchen to get another cup, a service technician was there with a laptop perched on the sink and a USB cable running into the innards of the coffee machine, into the back of its open front panel. When I asked what was going on, he said that he was updating the coffee machine. In particular, he was adding the feature of selecting the strength of the coffee being brewed.</p>
<p>A software update to add features to a coffee machine? It is a bit weird, but also a perfect illustration of how pervasive embedded software has become in all manners of systems.</p>

It is not easy to explain to non-technical people just what an embedded system is and what software does when it is not running as an application on a PC (or smartphone or tablet or other familiar computing device). Our coffee machine upgrade does offer a nice illustration of what is going on, and how software and hardware combine to form cyberphysical systems.
<p>Mechanically, the machine contains a grinder and a water heater and a water dispenser. Software controls these mechanical components to determine how much coffee to grind and how fine to grind it. The software controls the amount of water to use and how much to heat it. With these few variables, almost infinite variety is possible. As our machine also contains a milk dispenser, milk heater, and some other bells and whistles, it can easily provide quite a wide selection of beverages by combining various units and varying their operating parameters.</p>
<p>The importance of the software is clear to anyone who attempts to do the same tasks manually. If it is badly written or contains flawed control algorithms, the result can be almost arbitrarily awful. But it does make the system far more flexible. Decades ago, there would have been a few buttons on the front and each button would have been tied to a set of parameters for the mechanical units. The parameters would have been set by manual tuning of some adjustment screws on the circuit board. Now, the software can just set the parameters at any point in time, making it possible to adjust on the fly, and vary their value in order to vary the strength of the coffee.</p>
<p>The front panel of the machine demonstrates how embedded software can actually become visible to users. I understand the designer convenience of using a graphical display along with a numeric keyboard (!) to make selections. But it does make the machine feel more like a 1980's DOS adventure game than a user-friendly coffee machine. It takes a few keypresses (never less than three) to navigate the maze of menus and get something dispensed. It also allowed the programmers to include a service menu which definitely moves the machine from the realm of a simple appliance into being outed as a computer:</p>
<p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e201538f3fb053970b-pi" style="display: inline;"><img alt="Operatormenu" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e201538f3fb053970b" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201538f3fb053970b-800wi" style="display: block; margin-left: auto; margin-right: auto;" title="Operatormenu" /></a> <br />Maybe a coffee machine should not reveal its true identity quite as easily as that.</p>
<p>Anyway, now I know how to explain why software matters and what I do for a living. We at Wind River create the tools that let programmers createthe programs that makes your coffee machine able to adjust the strength of the coffee it brews.</p>
<p> </p></div>
</content>



    </entry>
    <entry>
        <title>Simics 4.6 Initial Impressions</title>
        <link rel="alternate" type="text/html" href="http://blogs.windriver.com/engblom/2011/05/simics-46-initial-impressions.html" />
        <link rel="replies" type="text/html" href="http://blogs.windriver.com/engblom/2011/05/simics-46-initial-impressions.html" thr:count="2" thr:updated="2011-05-31T05:40:01-07:00" />
        <id>tag:typepad.com,2003:post-6a00d83451f5c369e20154328e5ed0970c</id>
        <published>2011-05-31T02:44:00-07:00</published>
        <updated>2011-05-31T05:30:16-07:00</updated>
        <summary>Simics 4.6 is now out, and I would like to share some of my initial impressions of the new Simics version. The most visible new feature is probably the Simics source code debugger in Eclipse. Source code debug might seem a yawn, but the way it has been integrated with Simics provides some new and unique abilities that at least I have never seen before in a debugger. Most importantly, the debugger works on the system level with a single debug connection. An example is shown in the screenshot below, where we have two machines in the same Simics simulation...</summary>
        <author>
            <name>Jakob Engblom</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Simics" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://blogs.windriver.com/engblom/">
<div xmlns="http://www.w3.org/1999/xhtml"><p>Simics 4.6 is now out, and I would like to share some of my initial impressions of the new Simics version.</p>


<p>The most visible new feature is probably the Simics source code debugger in Eclipse.  Source code debug might seem a yawn, but the way it has been integrated with Simics provides some new and unique abilities that at least I have never seen before in a debugger.  Most importantly, the debugger works on the <em>system </em>level with a single debug connection. </p>
<p>An example is shown in the screenshot below, where we have two machines in the same Simics simulation - "Tuna" is a dual-core Power Architecture P2020 running VxWorks, and "Herring" is a dual-core Intel Architecture Pentium 4 running Wind River Linux. </p>
<p>   <a href="http://blogs.windriver.com/.a/6a00d83451f5c369e201538ebad29c970b-pi" style="display: inline;"><img alt="Blog-Simics-debug-view-heterogeneous-multicores" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e201538ebad29c970b" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201538ebad29c970b-800wi" style="display: block; margin-left: auto; margin-right: auto;" title="Blog-Simics-debug-view-heterogeneous-multicores" /></a></p>
<p>OS awareness shows the active processes, tasks, and threads, and you can see which threads are active on which processors. This is very convenient for multicore multithread debugging.  You can debug both from the hardware view and the software view of the system.    <a href="http://blogs.windriver.com/.a/6a00d83451f5c369e201538ebad9aa970b-pi" style="display: inline;"><img alt="Blog-Simics-debug-view-with-source-code" border="0" class="asset  asset-image at-xid-6a00d83451f5c369e201538ebad9aa970b image-full" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201538ebad9aa970b-800wi" title="Blog-Simics-debug-view-with-source-code" /></a> <br /><br /></p>
<p>Obviously, reverse execution is fully supported. We even highlight the last few instructions so the direction of execution is clear:</p>
<p><a href="http://blogs.windriver.com/.a/6a00d83451f5c369e2015432954d47970c-pi" style="display: inline;"><img alt="Single step backwards highlight" class="asset  asset-image at-xid-6a00d83451f5c369e2015432954d47970c" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2015432954d47970c-750wi" style="width: 750px;" title="Single step backwards highlight" /></a></p>
<p>The debugger also allows the Simics backend to take control over the execution. This means that you can set breakpoints and write and run arbitrary scripts on the Simics command-line, and then have the debugger update its view whenever and wherever Simics stops the execution. All the existing advanced breakpoint features in Simics can be used, and the source code debugger just makes it easier to understand what is going on in the target software.  This gives us a debugger that combines the power of a virtual platform command-line debugger with the convienience and overview of an Eclipse visual debugger.</p>
<p>There is another small but very useful improvement to the Simics user interface. When you use Simics checkpoints (see for example <a href="http://blogs.windriver.com/engblom/2010/10/physical-or-virtual.html" target="_self">blog </a>and <a href="http://blogs.windriver.com/engblom/2010/08/transporting-bugs-with-checkpoints.html" target="_self">blog</a>), you can now add text annotations to the checkpoint. This makes it so much easier for a user to understand what a checkpoint contains and why it was created. The checkpoint is also automatically annotated with who created it, when, and on which machine. Some of this metadata has been present in Simics checkpoints for the past few versions, but not exposed to users until now. In the screenshot below, you can see an example from one my demonstrations. It shows a checkpoint that captures an intermittent bug, and which was created a few years ago on an old machine I no longer use, and in Simics 4.2. It opens nicely in 4.6, and the bug behavior is exactly the same.</p>
<p><img alt="" src="http://blogs.windriver.com/.a/6a00d83451f5c369e201538ebb0382970b-pi" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>Without checkpoint annotations, you would have to provide this information in some README file or in an email, and it could easily lose its association with the checkpoint. With checkpoint annotations, Simics checkpoints become much easier to communicate between people and between teams. Checkpoints can also be handled by workflow system and checked into source code repositories with the metadata integrated and available for inspection.</p>
<p>Yet another user interface addition is the new system panel build kit, which lets you build models of typical board front panels as part of your Simics hardware models. It can also be used to build arbitrary dashboards to display information about a target, based on custom scripts and trace modules. The screenshot below shows a simple panel for a board with 10 LEDs, a configuration switch, and a reset button. We also see the software animating the LEDs running in the debug view, as the tLedAnimate task in VxWorks.</p>
<p>   <a href="http://blogs.windriver.com/.a/6a00d83451f5c369e2014e88aec9d3970d-pi" style="display: inline;"><img alt="Blog-system-panel-demo" class="asset  asset-image at-xid-6a00d83451f5c369e2014e88aec9d3970d" src="http://blogs.windriver.com/.a/6a00d83451f5c369e2014e88aec9d3970d-700wi" style="width: 651px; display: block; margin-left: auto; margin-right: auto;" title="Blog-system-panel-demo" /></a> <br />Apart from these highly visible additions, just like with every release of Simics, Simics 4.6 contains many small fixes and improvements. We are constantly trying to remove little annoyances and make the tool easier and more logical to use.</p>
<p>One example that I like particularly is the introduction of a general way to describe OS awareness nodes in Simics scripts. You can now specify that you want to track a certain thread by its OS process ID or by the name of the binary. You can ask OS awareness to return all tracked software units in a system that match a certain criteria (like "all threads inside the process called rule30 inside an OS called vxworks"). Previously, users had to manually scan the process lists to find what they needed, now they can essentially use Simics to do "find" over the entire simulation. For setups involving a hypervisor, multiple guest operating systems, and hundreds or thousands of active processes, this is a huge usability benefit. It also makes automating things with OS awareness much easier.</p>
<p>There are many other new and improved things in Simics 4.6, but I have to stop somewhere. However, there is one final thing that I have to include.  Simics now supports Windows 64-bit hosts. This is very beneficial to Simics users on Windows, as the better register model on 64-bit x86 provides an immediate speedup for the simulator. It also makes it practical to run much larger simulations on Windows host, thanks to removing the 32-bit addressing limit. </p>
<p> </p></div>
</content>



    </entry>
 
</feed><!-- ph=1 -->

