Hello everyone, I'm learning how to use PySpice to simulate circuits using the PDK sky130, but first...
n
Hello everyone, I'm learning how to use PySpice to simulate circuits using the PDK sky130, but first I'm just starting with this doc example. The issue is that I'm getting following errors and I don't know why.
Copy code
Traceback (most recent call last):
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/tutorial2.py", line 28, in <module>
    analysis = simulator.operating_point()
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/Simulation.py", line 1194, in operating_point
    return self._run('operating_point', *args, **kwargs)
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/NgSpice/Simulation.py", line 76, in _run
    raw_file = self._spice_server(spice_input=str(self))
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/NgSpice/Server.py", line 162, in __call__
    return RawFile(stdout, number_of_points)
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/NgSpice/RawFile.py", line 170, in __init__
    raw_data = self._read_header(stdout)
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/NgSpice/RawFile.py", line 192, in _read_header
    self.circuit_name = self._read_header_field_line(header_line_iterator, 'Circuit')
  File "/home/nelson/myreps/obsidian-vault/PRACTICE/PYSPICE/pyspice-engineeringthings/tutorial/lib/python3.10/site-packages/PySpice/Spice/RawFile.py", line 243, in _read_header_field_line
    raise NameError("Expected label %s instead of %s" % (expected_label, label))
NameError: Expected label Circuit instead of Note
The error may come because my executable path of ngspice is
/home/nelson/cad/bin/ngspice
and I tried to modify it according to this doc part but nothing:
simulator = circuit.simulator(temperature=25, nominal_temperature=25, spice_command='/home/nelson/cad/bin/ngspice')
Could anyone help me with that? @proppy maybe could you give me some ideas about it?
šŸŒ 1
p
I'd also recommended printing the circuit before running the simulation. As it allows you to see the ngspice netlist and testbench that got generated.
n
I'll test the notebook. But yes, I printed the circuit and it was generated correctly, the issue is when I run
analysis = simulator.operating_point()
there all error I mentioned appear.
Note: I'm not using Anaconda, I created a virtual environment using
venv
then I installed PySpice there
p
other I could check: • version of ngspice (are you getting it thru a package manager?)
and if you could print the generated circuit and dump it here that would also be useful
Not sure if that helps?
šŸ™Œ 1
n
@proppy Absolutely! Sorry for the absence, I was in exams. Today I was looking for some

videosā–¾

about how to import models and libraries in PySpice, and studying some lines of code of the first notebook, because lot's of things are new for me. The latter one is easier to understand, thank you so much! I'm testing some stuff with ngspice first taking some ideas from the notebooks. Tomorrow I'll continue with them, my goal is to simulate a standard cell varying the corners in PySpice, I'll be telling you!
@proppy I was checking the first code block of the second notebook and I tried to repeat it but only with ngspice. The issue is that I don't know why I'm getting this error, where it appears there aren't some files, but it's strange because I can run others designs made with Xschem. Could you give me a light please? It's like ngspice were looking for since my current path?
p
I'd be curious to know you installed the PDK, and if you set
PDK_ROOT
n
I installed it using open_pdks script and I supposed I have that variable set (fig 1) It's weird because if I paste the spice file I'm trying to run into the folder where all the pdk files are, I can run it withouth any trouble (fig 2)
p
can you share the testbed you're trying to run? I'd love to give it a try.
n
Is this, I always have to run into:
/home/nelson/cad/share/pdk/sky130A/libs.tech/ngspice
which is where I installed my pdk using
open_pdks
script
@proppy don't bother, it already worked. Thanks you!