gnupic: gpsim CVS update


Previous by date: 27 May 2001 04:49:41 -0000 gpsim CVS, Scott Dattalo
Next by date: 27 May 2001 04:49:41 -0000 Re: gpsim CVS update, Alex Holden
Previous in thread: 27 May 2001 04:49:41 -0000 gpsim CVS update, Scott Dattalo
Next in thread: 27 May 2001 04:49:41 -0000 Re: gpsim CVS update, Alex Holden

Subject: gpsim CVS update
From: Scott Dattalo ####@####.####
Date: 27 May 2001 04:49:41 -0000
Message-Id: <Pine.LNX.4.21.0105262326350.15080-100000@tempest2.blackhat.net>

Added module attributes

A few days ago I added the "set" option to module command
with the idea of supporting attributes. This support has
now been added. A new file called "src/attribute.cc" has
been added. There's a new class called Attribute that serves
as the base to FloatAttribute, IntAttribute, and StringAttribute 
classes. From the names you probably can guess that integer,
float, and string type attributes are supported. 

The attributes are supported in a very generic/flexible way
(from a programming point of view). For example, attributes
can be dynamically created and attached to modules. While I
haven't tried it, you could create a user defined (via a 
program) attribute and attach it to a simulated PIC.


The pullup resistor is the only module that supports attributes
right now. Check out examples/modules/mod_test/ in CVS for an
example of the usage. Here's a brief summary:

A command file with these contents:


load s mod_test.cod
module library libgpsim_modules.so
module load pullup   R1
node n1
attach n1 portb0 R1

(whole command file:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/gpsim/examples/modules/mod_test/mod_test.stc
)

Then while in gpsim you can do this:

gpsim> module set R1
resistance = 2000
gpsim> module set R1 resistance 1000
gpsim> module set R1
resistance = 1000

The pullup resistor only has one attribute: its resistance.
The default value is 2k (there's an adhocness with this).
This is shown by "set"ting R1, but not specifying an attribute.
In other words, all attributes (only one in this case) are
displayed when no attributes are specified with the set
command.

Then the resistance is changed to 1000 and displayed.

---------

The next module is going to be a USART. This one will make
extensive use of the attribute command.

Scott


Previous by date: 27 May 2001 04:49:41 -0000 gpsim CVS, Scott Dattalo
Next by date: 27 May 2001 04:49:41 -0000 Re: gpsim CVS update, Alex Holden
Previous in thread: 27 May 2001 04:49:41 -0000 gpsim CVS update, Scott Dattalo
Next in thread: 27 May 2001 04:49:41 -0000 Re: gpsim CVS update, Alex Holden


Powered by ezmlm-browse 0.20.