Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Ngspice DC analysis #107

@Jetsama

Description

@Jetsama

I think that the Ngspice netlister has some errors for DC analysis.
The param value is created but not used in (because of missing brackets).

param = an.indep_name
## Interpret the sweep
sweep_type = an.sweep.WhichOneof("tp")
if sweep_type == "linear":
sweep = an.sweep.linear
line = (
f".dc param start={sweep.start} stop={sweep.stop} step={sweep.step}\n\n"
)

I was able to get the simulation to run by updating the line to:

            line = (
                f".dc {param} {sweep.start} {sweep.stop} {sweep.step}\n\n"
            )

Because I believe Ngspice does not use the start,step, and stop keywords.

I also had issues afterwords with the reading of the results:

  File "/ic_tools/miniconda3/envs/Grimoire/lib/python3.10/site-packages/vlsirtools/spice/ngspice.py", line 119, in parse_results
    raise RuntimeError(msg)
RuntimeError: Cannot read results for analysis dc {
  analysis_name: "op"
  indep_name: "v.xtop.vvdc"
  sweep {
    linear {
      stop: 1
      step: 2
    }
  }
}

It cannot find the following dc enum value in the data:

an_name_dispatch = dict(
op="Plotname: Operating Point\n",
dc="Plotname: DC Analysis\n",
ac="Plotname: AC Analysis\n",
tran="Plotname: Transient Analysis\n",
noise="FIXME! do we still want this setup?",
)

if analysis_name not in data:

I plan to finish debugging the data output.

Here is my DC testcase that I based on the existing mos test:
https://github.com/Jetsama/VLSI_Grimoire/blob/48ff1236e710a27c04ce9a3bf745fdc536ebaeae/MOS/hdl21_test.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions