Skip to content

Further Ngspice integration#33

Open
MiikkaMaki wants to merge 14 commits into
v1.14_RCfrom
ngspice_dev
Open

Further Ngspice integration#33
MiikkaMaki wants to merge 14 commits into
v1.14_RCfrom
ngspice_dev

Conversation

@MiikkaMaki

Copy link
Copy Markdown
Contributor

This branch has been used to integrate Ngspice to thesydekick, and should now have all relevant Ngspice simulation types implemented. This has been used by me for some months now and small bug fixes and features have been added from time to time. The code is trying to replicate the spectre class so that thesydekick testbenches don't need to do anything else than switch the simulator name. However, it should be noted that some simulation types and some features are not possible using Ngspice.

I recommend that this is merged to v1.14_RC somewhere before release. Note that the changes are not only in ngspice files, but also require modifications in general non-simulator specific files.

Ping @mkosunen.

@mkosunen

mkosunen commented Jun 12, 2026

Copy link
Copy Markdown
Member

@MiikkaMaki Without further study, this breaks inverter simulation with ngspice. You can verify that by cloning thesedk_template, schecking out this branch on the inverter and running ./configure && make sim for it.

Can not be merged as is. Output signal reading back to python fails

Note: No ".plot", ".print", or ".fourier" lines; no simulations run
10:26:08 [ERROR] inverter: Simulator (ngspice) returned non-zero exit code.
10:26:08 [INFO] ngspice: Number of lines: 2563434, reading with multiprocessing
10:26:08 [INFO] ngspice: Number of lines: 2563434, reading with multiprocessing
10:26:08 [INFO] ngspice: Number of lines: 2563434, reading with multiprocessing
10:26:10 [ERROR] spice_iofile: Traceback (most recent call last):
  File "/u/87/mkosunen/unix/projects/thesdk_template/Entities/spice/spice/spice_iofile.py", line 507, in read
    arr = self.sample_signal(event, tsamp)
  File "/u/87/mkosunen/unix/projects/thesdk_template/Entities/spice/spice/spice_iofile.py", line 650, in sample_signal
    closest_idx = np.argmin(np.abs(signal[:, 0] - tsamp))
TypeError: 'NoneType' object is not subscriptable

10:26:10 [FATAL] spice_iofile: Failed while reading files for Z.
Quitting due to fatal error in spice_iofile
make sim failed 410914?
make: *** [Makefile:10: sim] Error 1

@mkosunen

Copy link
Copy Markdown
Member

@MiikkaMaki Please check this. Verify with inverter, at least.

Comment thread spice/ngspice/ngspice.py Outdated
@mkosunen

Copy link
Copy Markdown
Member

In general, the commit has been made with precommit hooks inactive. @MiikkaMaki , let me know in which environment you have made the commit, and I can fix the precommit hook execution.

For now the value of cmdfile_ext for ngspice is '.ngcir'. Changing this
will break every simulation.

Lint spice/ngspice/ngspice.py with 'black -l 80 spice/ngspice/ngspice.py'
@MiikkaMaki

Copy link
Copy Markdown
Contributor Author

Could you specify what you need, and how do I avoid this in the future? I am not familiar with precommit hooks.

@MiikkaMaki

Copy link
Copy Markdown
Contributor Author

This change (d1c5f23) breaks sparam and noise simulations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants