[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: passing parameters to a subckt



On Sunday 24 October 2010, clif@xxxxxxxxxxxxx wrote:
> and have gnetlist spit out a line like this:
> 
> XU3 10 9 0 POT VALUE=10k SET=0.5
> 
> and pot.mod could be something like:
> 
> .SUBCKT POT 1 T 2 PARAMS: VALUE=1K SET=0.5
> RT 1 T {0.999 * VALUE * (1-SET) + 0.0005 * VALUE}
> RB T 2 {0.999 * VALUE * SET + 0.0005 * VALUE}
> .ENDS
> 
> I've googled hither and yon, looked at gnet-spice-sdb.scm but
> couldn't  find anything definitive. Is there some other
> attribute that you might put a list of parameters in?

The situation is less than ideal, but workable.  When netlisting 
to a spice format, the "value" attribute contains a string which 
is copied directly.

So, for XU3, you should set the "value" to the string
"VALUE=10k SET=0.5" .

What is less than ideal is that you must use the simulator's 
syntax there, which means you may need a different schematic for 
different simulators.  This is workable with variants of the 
spice format, but unworkable for non-spice formats.  For 
example, the Verilog netlister does not do attributes at all.

For example, of those using spice variants, the "PARAMS:" 
keyword is required on some, optional on some, and illegal on 
some.  It is optional for gnucap (recent snapshots, it is 
illegal for 0.35).  As I recall, it is required for Pspice, 
illegal for NGspice, but I could be wrong here, or it could have 
changed recently.  Regardless, when you make the schematic, it 
is part of the "value" string.

Another syntax nuisance is that some simulators using spice 
netlists use ticks ' ' instead of curly's to enclose an 
expression.  I believe Hspice uses ticks, Pspice uses curly's.  
Gnucap takes either.  I don't know what NGspice accepts.


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user