add example with xspice inst parameters

This commit is contained in:
Florian Ballenegger 2020-10-07 12:10:31 +02:00
parent 7fc395b38d
commit 486026a8ec
2 changed files with 25 additions and 2 deletions

View File

@ -22,12 +22,12 @@ in the corresponding PARAMETER_TABLE under the new Parameter_Scope keyword.
The value can be "model", "instance", or "both".
model : parameter can be set only to a model
instance : the parameter can be set to instances, but not on models
both : the parameter can be set both to instances or models.
both : the parameter can be set either to instances or models, or both.
Default scope is "model".
If the scope is "both" and the instance parameter is not set, the value of the
corresponding model parameter will be used. If the parameter is not set on the model either, the default value will be used.
This is nothing special to do in the cfunc.mod file, the same PARAM() access will works for all parameters. The codemodel file however need to be recompiled.
This is nothing special to do in the cfunc.mod file, the same PARAM() access will works for all parameters. The codemodel however need to be recompiled.
(you need to touch cfunc.mod to trigger a re-compilation even if ifspec.ifs is modified).
Binary compatibility of codemodels

View File

@ -0,0 +1,23 @@
*xspice codemodel with instance parameters
V1 n1 0 DC 1
V2 n2 0 DC 1.2
V3 n3 0 DC 1.4
Asum [n1 n2 n3] q !summer in_gain=1,2,3 out_gain=5
Asum2 [n1 n2 n3] q2 !summer in_gain=3,2,1 out_gain=2
Amult [n1 n2] qmult !mult in_gain=3,4 out_gain=0.1 out_offset=-1 in_offset=1,2
Amult2 [n1 n2] qmult2 multmod out_offset=0
.model multmod mult (in_gain=[3 4] out_gain=0.1 out_offset=-1 in_offset=[1 2])
* digital
alut [d1 d2 d3] qlut !d_lut table_values="01101001"
aset [d1 d2 d3] !d_const word="011" strength="s"
apu d1 !d_pullup
adff dat clk null null qdff null !d_dff ic=0
Vvdd vdd 0 DC 3.3
aropd [d1 d2 d3] [%gd(v1 0) %gd(v2 0) %gd(v3 0)] !da_switch r_on=1e3 r_off=1e9
aropu [~d1 ~d2 ~d3] [%gd(v1 vdd) %gd(v2 vdd) %gd(v3 vdd)] !da_switch r_on=3e3 r_off=1e9