gnupic: Re: [gnupic] Remarks to gpsim of 05/12/2006
Subject:
Re: [gnupic] Remarks to gpsim of 05/12/2006
From:
Peter ####@####.####
Date:
23 May 2006 14:23:03 +0100
Message-Id: <j.eecx.xswq@flfk.vp.iu>
On Mon, 22 May 2006, Scott Dattalo wrote:
> The simplest file format I can imagine is one where each line contains a list
> of commands. For example, let's assume that N_hi and N_lo are the 16-bit
> input to the square root routine and that 'root' is the 8-bit result. Here's
> how a stimulus file might look:
>
> -------------------------
> N_hi = 0; N_lo = 0 # input condition
> (root == 0) # expected result
> N_hi = 0; N_lo = 1
> (root == 1)
> N_hi = 0; N_lo = 2
> (root == 1)
> N_hi = 0; N_lo = 3
> (root == 1)
> N_hi = 0; N_lo = 4
> (root == 2)
> # and so on
> ------------------------
I think that this is not quite a stimulus file, it is more like a
script. E.g. you are effectively promoting (demoting) gpsim with the
loaded program to a function, and you wish to have it perform
calculations and check them. So a more complete syntax would be to
consider gpsim a function that takes a set of initializers as arguments,
and can return a list of arguments (borrowing from Perl a little):
use Gpsim;
my prog = perlgpsim( 'program_to simulate' );
my rr,f,nhi,nlo;
prog->reset;
prog->breakpoint('somelocation');
foreach ($nhi,$nlo,$rr) $testlist {
prog->set('N_hi', $nhi, 'N_lo', $nlo);
prog->run;
($r, $f) = prog->get('root', 'flags');
($r != $rr) and die "Aargh: nhi=".$nhi." root=".$r." f=".$f."\n";
}
So gpsim would have a Perl object wrapper.
Another way to look at it is as a set of clauses (e.g. Horn c. - see
Prolog), and write something like:
testroot79 :- set N_hi=0, set N_lo=2, call rootfunc, root==1.
testroot79 !- write 'Aargh root=' root '\n';
All of these can be substituted with the simple stimulus format (input
and output) if gpsim can be driven by a script (for example expect(tk))
that can handle all the comparisons and so on.
> I think that was longer than Peter's post! And speaking of Peter's post, you
> probably notice that they're similar. I borrowed Peter's ideas and recast
> them into a gpsim form. The major difference is that the file stimulus as
> I've proposed it is nothing more than a list of gpsim commands that can be
> executed at the rate the user (or the simulation) requires.
I think that there must be a distinction between a stimulus or trace
file and a script. A stimulus is just a set of values for nodes (input
and output).
A script is something entirely different, and it may or may not want to
use stimuli (input or output).
For example, I believe that spawning gpsim from an expect shell should
open a number of interesting possibilities, but this is unrelated to
stimuli.
Peter