[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnucap-devel] System simulation

From: Scott Dattalo
Subject: Re: [Gnucap-devel] System simulation
Date: Sun, 18 Mar 2007 20:56:16 -0800 (PST)
User-agent: SquirrelMail/1.4.6

On Sun, 2007-03-18 at 11:07 +0100, Thomas Lundin wrote:

> My thought was to create a new logic device that works as an "digital
> generator" that can be changed between 1 and 0 from the command line.
> The plan was then that the MCU-simulator would interact with gnucap
> through a pipe.

Hi Thomas,

KTechLab implements a system simulator... sort of. It's not a full blown
extensible simulator like gnucap but it does combine Microcontroller
simulation with analog simulation. For the microcontroller simulation,
KTechLab uses gpsim.

> Would this be enough from a gnucap point of view to get gnucap and a
> MCU-simulator (gpsim for instance) be able to act as system simulator
> where you can simulate your software together with your electronics?

Since both gpsim and gnucap support a concept of plugins then
theoretically one could be plugged into the other. I don't know exactly
how gnucap implements the simulation model, but I'm certain it's different
than gpsim! So there would have to be some work to merge the two.

In a nutshell, gpsim is an event driven simulator. Nothing is done until
there is an event to trigger it. The I/O Pins of a microcontroller have
very simple analog models that support thevenin voltage, resistance and
capacitance. Inductance... what's that? gpsim supports a netlist concept.
External devices like LCD displays or UARTs can be plugged into gpsim and
interfaced to processors through the netlists.

gpsim's simulation event model is relatively simple to implement. The hard
part is working through all the damn details of a processor's peripherals
to understand how everything interacts.

> A second and required step would be to add ADC's and DAC's.

gpsim supports these already. The ADC's peripheral in both the midrange
and 16-bit core devices is implemented. A DAC can be simulated with a
pullup resistor (i.e. a pullup resistor exposes a 'resistance' and
'voltage' attribute which are user controllable; they can even be tied to
attribute stimuli so that you can construct an arbitrary waveform

> A relevant question is of course if this is useful even if it's
> possible? Personally I only simulate small sub-circuits most of the
> time. And I haven't really missed a system simulator, but I think that
> if I had one around I would probably use it to verify larger blocks on
> more of a system level. It could possibly be a tool for SW design as
> well for the pre-prototype coding.

It's difficult to answer the 'usefulness' question. I can only offer
anecdotal experience. I do some work on the side for a guy who makes RF ID
type devices. For each project I do, I construct system simulation models.
I make a deal with my client such that I'll cut him a break on price if he
allows me to release into the public some of the gpsim models I create
(the graphics LCDs are good examples).

My system simulations are tailored to firmware development. There are many
things that I can test and develop in a simulation environment. For
example, I've created behavioral models of the RF ID transmitters. I can
instantiate these in a gpsim simulation and evaluate how well my RF
receiver can tolerate a variety of corner case anomalies like slow
transmitter clocks, single bit errors, bit burst errors, etc. At the same
time I can simulate switches, and LCD display, LEDs, an RS232 interface,
etc. My gpsim configuration script is a couple hundred lines long
sometimes! But I've uncovered all sorts of weird bugs over the last few
years that would have been extremely difficult to capture with just an ICD
(or with MPLAB).

There are times I've wish gpsim had an even more accurate analog
simulator. For example, the sort of sigma delta style 1-pin A2D converter

If gpsim had accurate I/O pin models then I could better predict the
behavior of this example. Furthermore I could possibly optimize it and
evaluate it over corner cases.

So I could see some benefit in a system simulator that simultaneously
utilizes high level microcontroller behavioral models along with low level
gnucap analog models.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]