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

Re: gEDA-user: multiple attributes

It's well past time to realize that there is more to simulation 
than Spice.  A schematic should be able to be used with a 
variety of simulators, and the netlister should take care of  
the differences.

Symbols should not have anything specific to any output format.  
This is difficult considering how irregular the Spice format is, 
but hacking the symbols to compensate for shortcomings in one 
output format is short sighted, especially a format where the 
inventer of the format wishes it would be replaced by something 

In a schematic, attributes really need to have a type.  There 
are simulation attributes, layout attributes, etc.  To minimize 
the changes to code, for now let's identify the type of an 
attribute by a non-alnum first character.  How about prefixing 
simulation attributes with a dot.

A Verilog netlister would just emit the attributes marked as 
simulation attributes in the appropriate format, regardless of 
the meaning of a symbol.  

A Spice netlister could do this in some cases, but needs extra 
code to handle special cases.

So, for a mosfet, you have attributes like "l" and "w".  These 
must not be hard coded, because it cannot be known in general 
what attributes will be used.  A resistor would have an 
attribute "r", a capacitor would have an attribute "c".  Again, 
not hard coded but rather just by convention.

A Verilog netlister might output:
nmos1    #(.l(1u), .w(1u))      m12   (.d(3),.s(4),.g(9),.b(0));
resistor #(.r(10k))             r33   (.n(3), .p(8));
boxoid   #(.hat(10),.foot(.01)) xbox1 (.top(3), .bot(7));

A Spice netlister might output:
m12   (3 9 4 0) nmos1  l=1u w=1u
r33   (8 3)            10k
xbox1 (3 7)     boxoid hat=100 foot=.01

For the Verilog netlister, no funny business is needed.  All 
instances have the same syntax.  All attributes and connections 
are mapped by name.  It's easy.

For the Spice netlister, there are some issues.  In general, the 
attributes can be passed by just stripping the dot and copying, 
but that doesn't work for the resistor.  Different types have 
different syntax.  This must be determined from the type by the 
netlister.  In this case, the mosfet and subckt call can use the 
same syntax.  They are not special.  This behavior can be 
thought of as the default behavior.

The resistor is a special case.  One particular attribute "r" 
needs to be emitted without its name.  This is a netlister task, 
not part of a symbol.  This is where some kind of mapping is 

The resistor isn't the only special case.  Spice is seriously 
burdened with those special cases, which is why a spice 
netlister is so complicated.  Still, it is a netlister problem, 
not a symbol problem.  Let the symbols be consistent, and the 
spice netlister support the bugs in spice.

geda-user mailing list