Simulation is Better than Barr & Massa Says

Cover of Programming Embedded Systems by Barr and MassaIn the book “Programming Embedded Systems — with C and GNU Development Tools“, authors Michael Barr and Anthony Massa make some statements on simulation that I just have to disagree with on principle. Read on for what. Note that overall this is a good book, I am not claiming that it is not. The Amazon reviews are pretty good, and having a foreword by Jack Ganssle is always a sign of quality. But I just have to correct them on one little fact…

In a section on “other development tools”, there is the following piece on simulation:

Cite about simulation not full and useful

I just had to scan the page to make it look more real, right?

Anyhow, the critical bit is at the end:

By far, the biggest disadvantage of a simulator is that it simulates only the processor.

That is simply not true. Not today. Note that this is a second edition of a book, and that when the first edition was created the market place looked different. Today, vendors like Virtutech, CoWare, Synopsys, VaST, and ARM routinely provide full-system simulators that simulate much more than just the core processor. These virtual platforms contain memory, peripherals, and often connections to the outside world or simulations of the environment in which an embedded system operates. For more on this, please read the piece I wrote for last year, or come visit my talk at the ESC SV this year (due in two weeks).

And next we have:

So you probably won’t do too much with the simulator once the actual embedded hardware is available.

This is not generally true either. Very often, a virtual hardware platform is used to develop software for a system even after hardware appears — simply because it is more convenient, available, and capable. It really is.

But finally, here is a quote that I like, finishing off this short section in their book:

Second quote from the book

That is a very good tip: use the simulator and compare notes with reality. It is a very powerful technique, but it is even better for a full-system simulator: there you can trace the actual virtual hardware-actual software interaction and see if any of the two parties are not following the data book. On hardware, you would have no chance to see that, as you cannot usually attach a trace unit to the device bus of an integrated chip.

I guess that was all I had on this topic. Barr and Massa are a bit wrong, but I guess it is mostly because they have not seen what can be done in virtualization and simulation today. Which means we in the business have more education and marketing to do to raise awareness of what tools can do today.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.