Hi Mike… ok, some success but a couple of issues too.
First, not requiring params: seems to be working for me. Also true for single quotes on the Xcall and .subckt .
However, when I tried to run a couple of larger test cases I ran into a couple of more issues.
These are,
1- use of keyword value= in G & E elements does not work in qspice as in other spice flavors
I change these to B elements to fix
2- After switching to B elements with same equations, including single quotes, qspice gave an error that seemed related to the single quotes as removing the quotes allowed qspice to run.
The stripped down test case is below, 3 versions with step by step changes made until it ran.
Again, not strictly qspice errors, more of a backward compatibility issue I thought you would like to know about. … Kevin
Netlists are below
*=== Confirma Hierarchical Spice Netlister for KiCad… ver 0.1
- Schematic=tq_qspice_param_passing
- Number of schematic nodes= 5
XU2 INP INN OUT B_DIFF2SEBUF GAIN=2
V1 IN 0 SIN ( 0 1 70E6 0 0 0 )
XU1 0 IN INP INN S2DIFBUF_Q
*== End top level schem
*=== start existing subcircuit cir
.subckt B_DIFF2SEBUF INP INM OUT
- Schematic=B_DIFF2SEBUF
- Number of schematic nodes= 4
I2 INP 0 DC 1N AC 0
R1 0 OUT 1G
R3 INP 0 1G
R2 INM 0 1G
E1 OUT 0 VALUE=‘(V(INP)-V(INM))*GAIN’
I1 INM 0 DC 1N AC 0
.ends
- Single-ended to differential unity buffer with CM terminal
- XS2DIFBUF A4 A1 A2 A3 S2DIFBUF
.SUBCKT S2DIFBUF_Q 4 1 2 3
E1 2 4 1 0 0.5
E2 4 3 1 0 0.5
R18 1 0 1G
R20 4 0 1G
.ENDS
.end
qspice reports,
Fatal error: Error: too few nodes: e1 out 0 value=‘(v(inp)-v(inm))*gain’
Checking qspice docs I found,
- value= not permitted in vcvs
- corrected by changing E1 to BE1 etc
==================================================
Run 2
- Number of schematic nodes= 5
XU2 INP INN OUT B_DIFF2SEBUF GAIN=2
V1 IN 0 SIN ( 0 1 70E6 0 0 0 )
XU1 0 IN INP INN S2DIFBUF_Q
*== End top level schem
*=== start existing subcircuit cir
.subckt B_DIFF2SEBUF INP INM OUT
- Schematic=B_DIFF2SEBUF
- Number of schematic nodes= 4
I2 INP 0 DC 1N AC 0
R1 0 OUT 1G
R3 INP 0 1G
R2 INM 0 1G
*E1 OUT 0 VALUE=‘(V(INP)-V(INM))*GAIN’ <============= change here, switch to B element!
BE1 OUT 0 V=‘(V(INP)-V(INM))*GAIN’
I1 INM 0 DC 1N AC 0
.ends
- Single-ended to differential unity buffer with CM terminal
- XS2DIFBUF A4 A1 A2 A3 S2DIFBUF
.SUBCKT S2DIFBUF_Q 4 1 2 3
E1 2 4 1 0 0.5
E2 4 3 1 0 0.5
R18 1 0 1G
R20 4 0 1G
.ENDS
.end
qspice reports,
C:\Y\KiCad_UCOSMprojects\CMOS_lp_transceivers\tq_qspice_param_passing.src
Ignoring shorted resistor: “R20•XU1”
Warning: Error: Node voltages such as V(n01) can not be used in netlist parameter expressions because these parameters are evaluated before the simulation starts.
Fatal error: Error: no such function ‘’’
The problem occured while parsing the line:
“BE1•XU2 OUT 0 V•XU2=‘(V(INP)-V(INN))*GAIN•XU2’”
*** Removed the single quotes on the B element and that seemed to fix it.
This netlist ran fine
*=== Confirma Hierarchical Spice Netlister for KiCad… ver 0.1
- Schematic=tq_qspice_param_passing
- Number of schematic nodes= 5
XU2 INP INN OUT B_DIFF2SEBUF GAIN=2
V1 IN 0 SIN ( 0 1 70E6 0 0 0 )
XU1 0 IN INP INN S2DIFBUF_Q
*== End top level schem
*=== start existing subcircuit cir
.subckt B_DIFF2SEBUF INP INM OUT
- Schematic=B_DIFF2SEBUF
- Number of schematic nodes= 4
I2 INP 0 DC 1N AC 0
R1 0 OUT 1G
R3 INP 0 1G
R2 INM 0 1G
*E1 OUT 0 VALUE=‘(V(INP)-V(INM))*GAIN’ <============= change here, switch to B element!
BE1 OUT 0 V=(V(INP)-V(INM))*GAIN <============= change here, removed single quote around equation!
I1 INM 0 DC 1N AC 0
.ends
- Single-ended to differential unity buffer with CM terminal
- XS2DIFBUF A4 A1 A2 A3 S2DIFBUF
.SUBCKT S2DIFBUF_Q 4 1 2 3
E1 2 4 1 0 0.5
E2 4 3 1 0 0.5
R18 1 0 1G
R20 4 0 1G
.ENDS
.end