Duplicating this error message, because apparently...
# xschem
c
Duplicating this error message, because apparently the ngspice
plot
instruction cannot handle lines of a bus, although
display
can handle signals like
io_out[11]
just fine.
t
Did you see my response (elsewhere) that you can get this to work by putting all the code from
.control
to
.endc
into a separate block that doesn't use
format="tcleval(@value )"
?
c
Yes. I merged your latest changes into the
tatzelbranch
of my
caravel_user_project_analog
clone on github, and
analog_wrapper_tb
runs a transient simulation successfully, but does not plot the results. Now
ngspice
complains:
Copy code
Error: bad v() syntax
t
@Christoph Maier: I know I used to run that and it worked. It appears that quotes around the netname, e.g.,
V("io_out[11]")
works. I'll update again with a fix.
c
Just tried the text
Copy code
name=s1
only_toplevel=false
value=".control
tran 10u 20m
plot V("io_out[11]") V("io_out[12]") V("io_out[15]") V("io_out[16]")
+ V("gpio_analog[3]") V("gpio_analog[7]")
.endc"
Still barfs
Copy code
Error: bad v() syntax
even when running ngspice from a shell:
Copy code
~/EDA/caravel_user_project_analog/xschem$ ngspice analog_wrapper_tb.spice
******
** ngspice-35+ : 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 Sep  7 22:34:17 UTC 2021
******

Compatibility modes selected: hs a

Warning: m=xx on .subckt line will override multiplier m hierarchy!


Circuit: **.subckt analog_wrapper_tb

option SCALE: Scale is set to 1e-06 for instance and model parameters
Warning: Model issue on line 2650 :
  .model sky130_fd_pr__diode_pw2nd_11v0 d level=3.0 tlevc=1.0 area=1.0e+12 ...
unrecognized parameter (vb) - ignored
unrecognized parameter (gap1) - ignored
unrecognized parameter (gap2) - ignored
unrecognized parameter (xw) - ignored
Warning: Model issue on line 2667 :
  .model sky130_fd_pr__diode_pd2nw_11v0 d level=3.0 tlevc=1.0 area=1.0e+12 ...
unrecognized parameter (vb) - ignored
unrecognized parameter (gap1) - ignored
unrecognized parameter (gap2) - ignored
unrecognized parameter (xw) - ignored
Doing analysis at TEMP = 27.000000 and TNOM = 27.000000

Warning: v3: no DC value, transient time 0 value used
Warning: v2: no DC value, transient time 0 value used
Warning: v1: no DC value, transient time 0 value used

Initial Transient Solution
--------------------------

Node                                   Voltage
----                                   -------
x1.x1.net9                        -6.59332e-46
x1.x1.xc1.a                                  0
x1.x1.xc1.b1                                 0
x1.x1.xc2.a                       -6.59332e-46
x1.x1.xc2.b1                      -6.59332e-46
x1.x1.net3                        -4.45253e-18
x1.x1.net7                        -1.01129e-19
x1.x1.net5                        -1.52249e-20
net1                                         0
x1.x1.net2                        -1.12558e-18
x1.x1.xr1.xsky130_fd_pr__res_xhigh_po_0p69.ra               0
x1.x1.net4                                   0
x1.x1.net6                          5.5919e-23
x1.x1.xr2.xsky130_fd_pr__res_xhigh_po_0p69.ra               0
x1.x1.net1                         6.22047e-22
x1.x1.net8                        -2.48369e-46
x1.x1.xr3.xsky130_fd_pr__res_xhigh_po_0p69.ra               0
x1.x1.net10                        8.22838e-19
net12[3]                          -5.78661e-18
net2                                         0
io_out[11]                        -8.60711e-18
io_out[12]                        -5.14082e-19
x1.x2.net9                          4.4075e-23
x1.x2.xc1.a                                  0
x1.x2.xc1.b1                                 0
x1.x2.xc2.a                         4.4075e-23
x1.x2.xc2.b1                        4.4075e-23
x1.x2.net3                        -7.29669e-18
x1.x2.net7                        -3.07985e-18
x1.x2.net5                        -2.30602e-20
net3[4]                            3.19794e-23
x1.x2.net2                        -6.49023e-19
x1.x2.xr1.xsky130_fd_pr__res_xhigh_po_0p69.ra     7.39038e-24
x1.x2.net4                         7.38354e-24
x1.x2.net6                        -1.08757e-20
x1.x2.xr2.xsky130_fd_pr__res_xhigh_po_0p69.ra     6.84464e-27
x1.x2.net1                         3.91336e-22
x1.x2.net8                         3.12925e-23
x1.x2.xr3.xsky130_fd_pr__res_xhigh_po_0p69.ra               0
x1.x2.net10                        -2.2204e-18
net12[7]                            3.0254e-18
io_out[15]                         -1.0695e-18
io_out[16]                         1.57581e-18
io_analog[4]                                 0
v3#branch                                    0
v2#branch                         -8.10299e-29
v1#branch                          -4.7643e-29

 Reference value :  1.94041e-02
No. of Data Rows : 2023
Error: bad v() syntax
ngspice 21 ->
Looks like the problem is the
ngspice
parser, or the parser for the
plot
command, if that's somewhat separate.
t
In xschem, you'll need to put three backslashes before the quote to escape it. There are more issues here, stemming from my originally doing the circuit without xschem, and then later drawing out a schematic for it. I just did another push after correcting a few things and actually checking this time that I can run ngspice on it and it works.
c
Took a while, because updating an existing local branch of
caravel_user_project_analog
from
main
is by no means as simple as it looks from the principal developer's point of view, but this actually works now — Thanks! [An automated test suite that is not hidden from honest analog designers inside an abstraction layer or container that hides the actual file system would be helpful for mine sweeping.]
s
@Christoph Maier square brackets in node names confuse ngspice, since the xspice extension uses bracket for denoting vectors. In this case use
plot "V(gpio_analog[7])"
@Christoph Maier when setting spice commands in the
code.sym
(or
code_shown.sym
) set the "`Edit Attr`" selector to "`value`". this way you just write the code you need, xschem takes care of escaping the quotes therein if any. Reason: The code to be placed in the netlist of a code.sym symbol is a
value
attribute (
value="...code..."
) if the code contains quotes, they must be escaped to avoid interpreting them as close quote for the value attribute. However if you set
Edit Attr
to
value
you just write whatever you want to be assigned to the value attribute, and xschem does all escaping.
t
That's useful to know!