diff --git a/doc/xschem_man/instance_based_implementation_05.png b/doc/xschem_man/instance_based_implementation_05.png new file mode 100644 index 00000000..62a9d6f7 Binary files /dev/null and b/doc/xschem_man/instance_based_implementation_05.png differ diff --git a/doc/xschem_man/instance_based_implementation_06.png b/doc/xschem_man/instance_based_implementation_06.png new file mode 100644 index 00000000..a098db2b Binary files /dev/null and b/doc/xschem_man/instance_based_implementation_06.png differ diff --git a/doc/xschem_man/instance_based_implementation_07.png b/doc/xschem_man/instance_based_implementation_07.png new file mode 100644 index 00000000..f8cd9e74 Binary files /dev/null and b/doc/xschem_man/instance_based_implementation_07.png differ diff --git a/doc/xschem_man/tutorial_instance_based_implementation.html b/doc/xschem_man/tutorial_instance_based_implementation.html index bf126675..f6a27a70 100644 --- a/doc/xschem_man/tutorial_instance_based_implementation.html +++ b/doc/xschem_man/tutorial_instance_based_implementation.html @@ -94,6 +94,109 @@ p{padding: 15px 30px 10px;} spice_sym_def attribute with vhdl_sym_def, verilog_sym_def and tedax_sym_def respectively.



+ +

Instance based SPICE model

+

In some cases a device is specified by a model and if model parameters can not be set in the + instance line we need multiple models if we want to use multiple devices with different model parameters. + This can be done by specifying a model in the following way:

+
+type=mechanical_rotational
+format="@name @pinlist inertia@name
+.model inertia@name inertia_omega_tau J=@J"
+template="name=N1 J=1.1"
+ 
+

Note the model name is given as inertia@name, this will make each model instance have a + different and unique name. This will generate an instance line:

+
+N1 A B C inertiaN1
+.model inertiaN1 inertia_omega_tau J=1.4
+ 
+ +

A better way hat handles also vectored instances is the following:

+
+type=mechanical_rotational
+format="@name @pinlist #inertia#@name
+.model #inertia#@name inertia_omega_tau J=@J"
+template="name=N1 J=1.1"
+ 
+

This way if you place a vectored instance name=N1[3:0] it will expand in netlist as:

+
+N1[3] XAA XBB XCC inertiaN1[3]
+N1[2] XAA XX XCC inertiaN1[2]
+N1[1] XAA XX XCC inertiaN1[1]
+N1[0] XAA XX XCC inertiaN1[0]
+.model inertiaN1[3] inertia_omega_tau J=1.2
+.model inertiaN1[2] inertia_omega_tau J=1.2
+.model inertiaN1[1] inertia_omega_tau J=1.2
+.model inertiaN1[0] inertia_omega_tau J=1.2
+ 
+ +

Subcircuits with SPICE models given as parameters

+

In general SPICE allows parameters to be passed to subcircuits. This is the case for dimensions, like + W=2u, L=0.15u that are passed to a subcircuit. + The subcircuit uses these parameters (W, L) instead of numbers, + making the subcircuit truly parametric. However transistor models in a subcircuit can not be passed as parameters, + the following inverter instantiation is illegal:
+ + X1 A Y inverter W=2u L=0.15u modn=cmosn modp=cmosp
+ To overcome this problem Xschem must generate multiple subcircuits.
+ Consider the following inv3.sym symbol:

+ +

the symbol has the following attributes:

+
+type=subcircuit
+format="@name @pinlist @VCCPIN @VSSPIN @symname wn=@wn lln=@lln wp=@wp lp=@lp m=@m"
+template="name=x1 m=1 modn=xmodn modp=xmodp
++ wn=10u lln=1.2u wp=10u lp=1.2u 
++ VCCPIN=VCC VSSPIN=VSS"
+extra="VCCPIN VSSPIN modn modp"
+ 
+

In above attributes two parameters are defined that specify transistor models, modn and + modp, with default values (if unspecified in instance) xmodn and xmodp. + The inverter subcircuit transistors will use the @modn and @modp as SPICE models:

+ +

If an inv3.sym is placed n the schematic and no schematic=... parameter is given + to create an instance based subcircuit specialization:

+

The following netlist will be produced:

+
+x2 LDCP3_B LDCP vcc vss inv3 wn=8.4u lln=2.4u wp=20u lp=2.4u m=1
+...
+...
+.subckt inv3 y a VCCPIN VSSPIN      wn=10u lln=1.2u wp=10u lp=1.2u
+*.opin y
+*.ipin a
+m2 y a VCCPIN VCCPIN xmodp w=wp l=lp ad='wp *4.6u' as='wp *4.6u' pd='wp *2+9.2u' ps='wp *2+9.2u' m=1
+m1 y a VSSPIN VSSPIN xmodn w=wn l=lln ad='wn *4.3u' as='wn *4.3u' pd='wn *2+8.6u' ps='wn *2+8.6u' m=1
+.ends
+ 
+

However if another instance is placed:

+ +

with following attributes:

+
+name=x3 m=1 
++ wn=8.4u lln=2.4u wp=20u lp=2.4u
++ VCCPIN=vcc VSSPIN=vss
+schematic=@symname\_1.sch
+modn=yyn modp=yyp
+ 
+

the following netlist is generated:

+
+x3 LDCP_B LDCP vcc vss inv3_1 wn=8.4u lln=2.4u wp=20u lp=2.4u m=1
+...
+...
+.subckt inv3_1 y a VCCPIN VSSPIN      wn=10u lln=1.2u wp=10u lp=1.2u
+*.opin y
+*.ipin a
+m2 y a VCCPIN VCCPIN yyp w=wp l=lp ad='wp *4.6u' as='wp *4.6u' pd='wp *2+9.2u' ps='wp *2+9.2u' m=1
+m1 y a VSSPIN VSSPIN yyn w=wn l=lln ad='wn *4.3u' as='wn *4.3u' pd='wn *2+8.6u' ps='wn *2+8.6u' m=1
+.ends
+ 
+

You see that a second inv_1.sym is generated with changed models (yyn and yyp). + This allows you to reuse the same symbol with different model names. Xschem does the necessary work to + duplicate the subcircuit, since model names can not be set as parameters. +

+ +