From 486026a8ec966b18f1cf2c625822779f5ae7c980 Mon Sep 17 00:00:00 2001 From: Florian Ballenegger Date: Wed, 7 Oct 2020 12:10:31 +0200 Subject: [PATCH] add example with xspice inst parameters --- README.xspice | 4 ++-- examples/xspice/xspice_instparam.cir | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 examples/xspice/xspice_instparam.cir diff --git a/README.xspice b/README.xspice index 0e06159e7..53d73a9c1 100644 --- a/README.xspice +++ b/README.xspice @@ -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 diff --git a/examples/xspice/xspice_instparam.cir b/examples/xspice/xspice_instparam.cir new file mode 100644 index 000000000..1baa69062 --- /dev/null +++ b/examples/xspice/xspice_instparam.cir @@ -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