Yet, when I remove the external cap. and put it in...
# analog-design
t
Yet, when I remove the external cap. and put it inside the amp. instead, it gives me the response I expect without complaining about a singular matrix. See images below: Does anyone know what might be going on here/if this could be an ngspice bug? I've attached the netlist too.
s
@Tom i can not simulate the netlist as there is an undefined subcircuit: sev2diffv. It is called in the netlist and it is probably defined in some include file. [EDIT] I found this component in a previous thread. Will look forward.
@Tom, after inserting the sev2diffv and pointing the pdk includes to my installation i got simulation running without singular matrix warning:
Copy code
schippes@mazinga:~/.xschem/simulations$ ngspice bgr_amp_test.spice
******
** ngspice-34 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2020, The ngspice team.
** Please get your ngspice manual from <http://ngspice.sourceforge.net/docs.html>
** Please file your bug-reports at <http://ngspice.sourceforge.net/bugrep.html>
** Creation Date: Sat Jan 30 12:16:19 UTC 2021
******

Compatibility modes selected: hs


Circuit: **.subckt bgr_amp_test

Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

Warning: include: has no value, DC 0 assumed
Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Note: One successful gmin step
Trying gmin =   1.0000E-04 Note: One successful gmin step
Trying gmin =   1.0000E-05 Note: One successful gmin step
Trying gmin =   1.0000E-06 Warning: Further gmin increment
Trying gmin =   5.6234E-06 Note: One successful gmin step
Trying gmin =   2.3714E-06 Note: One successful gmin step
Trying gmin =   6.4938E-07 Warning: Further gmin increment
Trying gmin =   1.7154E-06 Note: One successful gmin step
Trying gmin =   1.0554E-06 Note: One successful gmin step
Trying gmin =   5.0937E-07 Warning: Further gmin increment
Trying gmin =   8.7970E-07 Note: One successful gmin step
Trying gmin =   6.6940E-07 Note: One successful gmin step
Trying gmin =   4.4433E-07 Note: One successful gmin step
Trying gmin =   2.4029E-07 Note: One successful gmin step
Trying gmin =   9.5562E-08 Note: One successful gmin step
Trying gmin =   2.3967E-08 Note: One successful gmin step
Trying gmin =   3.0102E-09 Note: One successful gmin step
Trying gmin =   3.0102E-10 Note: One successful gmin step
Trying gmin =   3.0102E-11 Note: One successful gmin step
Trying gmin =   3.0102E-12 Note: One successful gmin step
Trying gmin =   1.0000E-12 Note: One successful gmin step
Note: True gmin stepping completed
 Reference value :  0.00000e+00
No. of Data Rows : 1
Reset re-loads circuit **.subckt bgr_amp_test
...
...
Did you compile ngspice with the 'XSPICE' feature?
t
Did you @Stefan Schippers Thank you for trying it out (sorry about the missing sev2diffv I forgot about that). I'm not sure if I have the XSPICE feature, let me check. What is it?
s
@Tom: Xspice is an extension to Spice3C1 that provides code modelling support and simulation of digital components through an embedded event driven algorithm. Some devices are simulated by the Xspice subsystem (B sources, devices with equations etc)
t
Ah ok, but why would that be required in order for my sim to work with the cap external?
s
@Tom build with: ../configure --with-x --enable-xspice --disable-debug --enable-cider --with-readline=yes --enable-adms
I am not sure it is needed in your case, but if anything else fails try building in xspice (if not already in)
t
I'll give that a try!
s
@Tom the voltage controlled voltage source is simulated with xspice if the gain is set with an expression (uses a B source): EP vop vc vi vc { 0.5*gain} try setting it to a number: EP vop vc vi vc 0.5 In this case the native vcvs devices is used.
t
I'm building it now with
../configure --with-x --enable-xspice --disable-debug --enable-cider --with-readline=yes --enable-openmp --enable-adms
so it's what you said plus
--enable-openmp
as per the section entitled "A fully featured ngspice on LINUX may be obtained with the following commands:".
Which I'm fairly sure is what I did last time. If it fails, I'll remove the openmp to get exactly what you had and try again
That still fails for me @Stefan Schippers. This is what I tried: I built with
../configure --with-x --enable-xspice --disable-debug --enable-cider --with-readline=yes  --enable-adms
as you suggested, removed the
{0.5*gain}
expressions and just used
0.5
, and I still get the same error. What is the commit of your build of ngspice? I want to try that next so we're on exactly the same page, and if that fails I'm going to try and boil it down to a simple failing test case.
Copy code
******
** ngspice-34 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2020, The ngspice team.
** Please get your ngspice manual from <http://ngspice.sourceforge.net/docs.html>
** Please file your bug-reports at <http://ngspice.sourceforge.net/bugrep.html>
** Creation Date: Tue Feb  9 17:19:56 UTC 2021
******

No compatibility mode selected!


Circuit: **.subckt bgr_amp_test

Scale set to 1e-06
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

Warning: include: has no value, DC 0 assumed
Warning: singular matrix:  check nodes net1 and net1

Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes net1 and net1

Warning: Further gmin increment
Trying gmin =   5.6234E-03 Warning: singular matrix:  check nodes net1 and net1

Warning: Further gmin increment
Trying gmin =   8.6596E-03 Warning: singular matrix:  check nodes net1 and net1

Warning: Further gmin increment
Trying gmin =   9.6466E-03 Warning: singular matrix:  check nodes net1 and net1

Warning: Further gmin increment
That was with sev2diffv:
Copy code
* single-ended to differential voltage buffer
.subckt sev2diffv vi vc vop von PARAMS: gain=1
EP vop vc vi vc  0.5
EN von vc vi vc -0.5
.ends
and ngspice git hash
279edff5d9877b13ddd7708285553ea20d6f14cd
s
@Tom, the only diffs i see in the logs is that you dont have the 'set ngbehavior=hs' in a .spiceinit file. Create a .spiceinit file in your home or in the directory where you run ngspice with this line in it: set ngbehavior=hs
t
Ah good point. Let me add that and get back to you
Where does xschem run ngspice from?
I'd rather put it in there if that would make it part of my project
s
in the ~/.xschem/simulations directory by default. To check click 'Simulations->set netlist dir'
this is what i do indeed, a .spiceinit file in ~/.xschem/simulations
t
perfect, so I have that set to a netlist folder in my project, so putting it in there should be ok right?
s
yes create the .spiceinit file where the .spice file is generated (and ngspice run)
t
ok trying it now. The only reason I didn't have that before is because I remember we tested it and it didn't seem to be required if the .option was set correctly to use the models based on fingers
@Stefan Schippers that doesn't seem to be the issue either actually. This is so bizarre. As you can see it's picked up the hspice compatibility directive correctly
Copy code
******
** ngspice-34 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2020, The ngspice team.
** Please get your ngspice manual from <http://ngspice.sourceforge.net/docs.html>
** Please file your bug-reports at <http://ngspice.sourceforge.net/bugrep.html>
** Creation Date: Tue Feb  9 17:19:56 UTC 2021
******

Compatibility modes selected: hs


Circuit: **.subckt bgr_amp_test

Scale set to 1e-06
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

Warning: include: has no value, DC 0 assumed
Warning: singular matrix:  check nodes net1 and net1

Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes net1 and net1
This is my netlist for refrence. I've removed my
analoglib
and the
sev2diffv
component with the same result. What git hash did you build ngspice from @Stefan Schippers?
Copy code
******
** ngspice-34 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Copyright 2001-2020, The ngspice team.
** Please get your ngspice manual from <http://ngspice.sourceforge.net/docs.html>
** Please file your bug-reports at <http://ngspice.sourceforge.net/bugrep.html>
** Creation Date: Tue Feb  9 17:19:56 UTC 2021
******

Compatibility modes selected: hs


Circuit: **.subckt bgr_amp_test

Scale set to 1e-06
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

Warning: include: has no value, DC 0 assumed
Warning: singular matrix:  check nodes net1 and net1

Note: Starting true gmin stepping
Trying gmin =   1.0000E-03 Warning: singular matrix:  check nodes net1 and net1
s
@Tom can you try the netlist i am running (you need to change the prefix of the pdk .includes, according to your installation).
just do ngspice bgr_amp_test.spice
t
That worked! Even without hs compatibility (since i was running it from a different folder). I noticed that I hadn't updated my lib symbol to the one which replaces
.inc
with
.include
, so I'm goint to see if that makes my netlist work all of a sudden. What's your theory?
Unsurprisingly @Stefan Schippers replacing
.include
with
.inc
in your netlist doesn't break it.
s
so, at the end, @Tom was the singularity due to the .inc vs .include? hard to believe, but with ngspice i have had more strange surprises like this... some don't have a rational explanation... i just managed to accept life the way it is...
t
haha, no it wasn't, @Stefan Schippers. I'm actually just about to dive in and try and figure it out. I suspect that it may be to do with the
lib
statement? since it looks like you don't have that in your version (the passing version) of the netlist but let's see. I'll get back to you with an update shortly
@Stefan Schippers, I've got to the bottom of it. I'm sorry for the trouble and thank you for the help. The issue was that the amp labels the net connected to the
vcomp
pin
v1
, and that was the cause of the singularity since the
vcomp
pin in the
.subckt
definition wasn't actually connected to a subcircuit net as the net in the subcircuit was called
v1
. So in the top-level, the cap. was connected to an amp. pin which didn't actually go anywhere in the
.subckt
. I just noticed that the ERC info. window actually reports this "short", so I'll be sure to check that next time. The netlist which was passing was the one with the cap inside the amp. so that was actually a red herring. That's my fault for uploading so many netlists.
💪 1
a
@Eslam Morsie