vacask-bin 0.3.2.dev2__py3-none-macosx_14_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vacask_bin/__init__.py +19 -0
- vacask_bin/_version.py +1 -0
- vacask_bin/data/bin/lib/libLLVM.dylib +0 -0
- vacask_bin/data/bin/lib/libamd.3.3.4.dylib +0 -0
- vacask_bin/data/bin/lib/libbtf.2.3.3.dylib +0 -0
- vacask_bin/data/bin/lib/libcamd.3.3.5.dylib +0 -0
- vacask_bin/data/bin/lib/libccolamd.3.3.5.dylib +0 -0
- vacask_bin/data/bin/lib/libcholmod.5.3.4.dylib +0 -0
- vacask_bin/data/bin/lib/libcolamd.3.3.5.dylib +0 -0
- vacask_bin/data/bin/lib/libgcc_s.1.1.dylib +0 -0
- vacask_bin/data/bin/lib/libgfortran.5.dylib +0 -0
- vacask_bin/data/bin/lib/libklu.2.3.6.dylib +0 -0
- vacask_bin/data/bin/lib/libomp.dylib +0 -0
- vacask_bin/data/bin/lib/libquadmath.0.dylib +0 -0
- vacask_bin/data/bin/lib/libsuitesparseconfig.7.12.2.dylib +0 -0
- vacask_bin/data/bin/lib/libunwind.1.0.dylib +0 -0
- vacask_bin/data/bin/lib/libzstd.1.5.7.dylib +0 -0
- vacask_bin/data/bin/openvaf-r +0 -0
- vacask_bin/data/bin/vacask +0 -0
- vacask_bin/data/lib/vacask/inc/builtins.inc +9 -0
- vacask_bin/data/lib/vacask/mod/bsim3v3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/bsim4v8.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/bsimbulk106.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/capacitor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/diode.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/inductor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/opamp.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/psp103v4.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/resistor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/bjt.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/bsim3v3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/bsim4v8.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/capacitor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/diode.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/bjt.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/bsim3v3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/capacitor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/diode.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/inductor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/jfet1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/jfet2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mes1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mos1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mos2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mos3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mos6.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/mos9.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/full/vdmos.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/inductor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/jfet1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/jfet2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mes1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mos1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mos2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mos3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mos6.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/mos9.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/resistor.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/bjt.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/diode.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/jfet1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/jfet2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mes1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mos1.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mos2.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mos3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mos6.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/sn/mos9.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/spice/vdmos.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/vbic_1p3.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/vbic_1p3_4t.osdi +0 -0
- vacask_bin/data/lib/vacask/mod/vbic_1p3_5t.osdi +0 -0
- vacask_bin/data/lib/vacask/python/__pycache__/rawfile.cpython-314.pyc +0 -0
- vacask_bin/data/lib/vacask/python/__pycache__/runtest.cpython-314.pyc +0 -0
- vacask_bin/data/lib/vacask/python/ng2vc.py +114 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/__init__.py +0 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/converter.py +146 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/dfl.py +118 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/exc.py +10 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/generators.py +81 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_devices.py +51 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_file.py +377 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_inst_d.py +44 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_inst_n.py +33 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_inst_passive.py +186 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_inst_q.py +43 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_inst_x.py +40 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_masters.py +240 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_model.py +68 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_output.py +182 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/m_params.py +295 -0
- vacask_bin/data/lib/vacask/python/ng2vclib/patterns.py +42 -0
- vacask_bin/data/lib/vacask/python/rawfile.py +182 -0
- vacask_bin/data/lib/vacask/python/runtest.py +21 -0
- vacask_bin/data/lib/vacask/python/sg13g2tovc.py +505 -0
- vacask_bin/data/lib/vacask/python/sg13g2xschem.tcl +149 -0
- vacask_bin/data/lib/vacask/python/xschem2vc.py +93 -0
- vacask_bin-0.3.2.dev2.dist-info/METADATA +6 -0
- vacask_bin-0.3.2.dev2.dist-info/RECORD +102 -0
- vacask_bin-0.3.2.dev2.dist-info/WHEEL +4 -0
- vacask_bin-0.3.2.dev2.dist-info/entry_points.txt +2 -0
- vacask_bin-0.3.2.dev2.dist-info/top_level.txt +1 -0
vacask_bin/__init__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Prebuilt VACASK circuit simulator binaries."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
_HERE = os.path.dirname(os.path.abspath(__file__))
|
|
7
|
+
_EXE = '.exe' if sys.platform == 'win32' else ''
|
|
8
|
+
|
|
9
|
+
BIN_DIR = os.path.join(_HERE, 'data', 'bin')
|
|
10
|
+
MOD_DIR = os.path.join(_HERE, 'data', 'lib', 'vacask', 'mod')
|
|
11
|
+
VACASK_CMD = os.path.join(BIN_DIR, 'vacask' + _EXE)
|
|
12
|
+
OPENVAF_CMD = os.path.join(BIN_DIR, 'openvaf-r' + _EXE)
|
|
13
|
+
|
|
14
|
+
from ._version import __version__
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _run_vacask():
|
|
18
|
+
"""Entry point for the 'vacask' console script."""
|
|
19
|
+
os.execvp(VACASK_CMD, [VACASK_CMD] + sys.argv[1:])
|
vacask_bin/_version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2.dev2"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
# Ngspice to VACASK netlist converter
|
|
4
|
+
# Use as module, i.e. python3 -m ng2vc ...
|
|
5
|
+
# or edit hashbang line and make it executable.
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
from pprint import pprint
|
|
9
|
+
from ng2vclib.converter import Converter
|
|
10
|
+
from ng2vclib import dfl
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
help="""Ngspice to VACASK netlist converter.")
|
|
14
|
+
Usage: python3 -m ng2vc [<args>] <input file> [<output file>]
|
|
15
|
+
|
|
16
|
+
If no output file is provided, the converted netlist is printed to
|
|
17
|
+
the standard output.
|
|
18
|
+
|
|
19
|
+
If output file is a relative path it is considered relative to
|
|
20
|
+
the input file.
|
|
21
|
+
|
|
22
|
+
Creates destination directory, if needed.
|
|
23
|
+
|
|
24
|
+
Arguments:
|
|
25
|
+
-h --help print help
|
|
26
|
+
-dr --read-depth maximal depth to which sources are loaded
|
|
27
|
+
(infinite by default)
|
|
28
|
+
-dp --process-depth maximal depth to which sources are processed
|
|
29
|
+
(infinite by default)
|
|
30
|
+
-do --output-depth maximal depth to which sources are output
|
|
31
|
+
(infinite ba default)
|
|
32
|
+
-sp --sourcepath add a directory to the sourcepath where
|
|
33
|
+
.include and .lib files are found. By default
|
|
34
|
+
sourcepath already contains the current directory.
|
|
35
|
+
-am --all-models dumps all models, not just those that are used
|
|
36
|
+
(disabled by default)
|
|
37
|
+
"""
|
|
38
|
+
ndx = 1
|
|
39
|
+
fromFile = None
|
|
40
|
+
toFile = None
|
|
41
|
+
read_depth = None
|
|
42
|
+
process_depth = None
|
|
43
|
+
output_depth = None
|
|
44
|
+
sourcepath = [ "." ]
|
|
45
|
+
all_models = False
|
|
46
|
+
while ndx<len(sys.argv):
|
|
47
|
+
arg = sys.argv[ndx]
|
|
48
|
+
if arg[0]=="-":
|
|
49
|
+
if arg == "--help" or arg == "-h":
|
|
50
|
+
# Print help and exit
|
|
51
|
+
print(help)
|
|
52
|
+
sys.exit(0)
|
|
53
|
+
elif arg == "-dr" or arg == "--read-depth":
|
|
54
|
+
if ndx+1>=len(sys.argv):
|
|
55
|
+
print("Too few arguments.")
|
|
56
|
+
sys.exit(1)
|
|
57
|
+
ndx += 1
|
|
58
|
+
read_depth = int(sys.argv[ndx])
|
|
59
|
+
elif arg == "-dp" or arg == "--process-depth":
|
|
60
|
+
if ndx+1>=len(sys.argv):
|
|
61
|
+
print("Too few arguments.")
|
|
62
|
+
sys.exit(1)
|
|
63
|
+
ndx += 1
|
|
64
|
+
process_depth = int(sys.argv[ndx])
|
|
65
|
+
elif arg == "-do" or arg == "--output-depth":
|
|
66
|
+
if ndx+1>=len(sys.argv):
|
|
67
|
+
print("Too few arguments.")
|
|
68
|
+
sys.exit(1)
|
|
69
|
+
ndx += 1
|
|
70
|
+
output_depth = int(sys.argv[ndx])
|
|
71
|
+
elif arg == "-sp" or arg == "--sourcepath":
|
|
72
|
+
if ndx+1>=len(sys.argv):
|
|
73
|
+
print("Too few arguments.")
|
|
74
|
+
sys.exit(1)
|
|
75
|
+
ndx += 1
|
|
76
|
+
sourcepath.append(sys.argv[ndx])
|
|
77
|
+
elif arg == "-am" or arg == "--all-models":
|
|
78
|
+
all_models = True
|
|
79
|
+
else:
|
|
80
|
+
print("Unknown argument:", arg)
|
|
81
|
+
print(help)
|
|
82
|
+
sys.exit(1)
|
|
83
|
+
else:
|
|
84
|
+
# Need 1 or 2 more args
|
|
85
|
+
if ndx+1>len(sys.argv):
|
|
86
|
+
print("Need input file.")
|
|
87
|
+
print(help)
|
|
88
|
+
sys.exit(1)
|
|
89
|
+
|
|
90
|
+
fromFile = arg
|
|
91
|
+
|
|
92
|
+
if ndx+2<len(sys.argv):
|
|
93
|
+
print("Too many arguments.")
|
|
94
|
+
print(help)
|
|
95
|
+
sys.exit(1)
|
|
96
|
+
|
|
97
|
+
if ndx+2==len(sys.argv):
|
|
98
|
+
toFile = sys.argv[ndx+1]
|
|
99
|
+
else:
|
|
100
|
+
toFile = None
|
|
101
|
+
break
|
|
102
|
+
|
|
103
|
+
ndx += 1
|
|
104
|
+
|
|
105
|
+
cfg = dfl.default_config()
|
|
106
|
+
cfg["sourcepath"] = [ ".", "/home/arpadb/sim/IHP-Open-PDK/ihp-sg13g2/libs.tech/ngspice/models" ]
|
|
107
|
+
cfg["read_depth"] = read_depth
|
|
108
|
+
cfg["process_depth"] = process_depth
|
|
109
|
+
cfg["output_depth"] = output_depth
|
|
110
|
+
cfg["all_models"] = all_models
|
|
111
|
+
|
|
112
|
+
converter = Converter(cfg)
|
|
113
|
+
converter.convert(fromFile, toFile)
|
|
114
|
+
|
|
File without changes
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
from .m_file import FileLoaderMixin
|
|
2
|
+
from .m_masters import MastersMixin
|
|
3
|
+
from .m_output import OutputMixin
|
|
4
|
+
from .m_model import ModelMixin
|
|
5
|
+
from .m_inst_passive import InstancePassiveMixin
|
|
6
|
+
from .m_inst_d import InstanceDMixin
|
|
7
|
+
from .m_inst_n import InstanceNMixin
|
|
8
|
+
from .m_inst_q import InstanceQMixin
|
|
9
|
+
from .m_inst_x import InstanceXMixin
|
|
10
|
+
from .m_devices import DevicesMixin
|
|
11
|
+
from .m_params import ParamsMixin
|
|
12
|
+
|
|
13
|
+
from . import dfl
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
class Converter(
|
|
18
|
+
FileLoaderMixin,
|
|
19
|
+
MastersMixin,
|
|
20
|
+
OutputMixin,
|
|
21
|
+
ModelMixin,
|
|
22
|
+
InstancePassiveMixin,
|
|
23
|
+
InstanceDMixin,
|
|
24
|
+
InstanceNMixin,
|
|
25
|
+
InstanceQMixin,
|
|
26
|
+
InstanceXMixin,
|
|
27
|
+
DevicesMixin,
|
|
28
|
+
ParamsMixin
|
|
29
|
+
):
|
|
30
|
+
"""
|
|
31
|
+
Ngspice to VACASK netlist converter.
|
|
32
|
+
*cfg* is the configuration dictionary with the following keys:
|
|
33
|
+
* sourcepath .. a list of directories where .include and .lib files
|
|
34
|
+
are located
|
|
35
|
+
* type_map .. a list of model types (tuples) with entries
|
|
36
|
+
* SPICE name (npn, pnp, nmos, pmos, ...)
|
|
37
|
+
* parameters to add when converting to VACASK
|
|
38
|
+
* family (used as key in other tables)
|
|
39
|
+
* remove_level .. True if level parameter should be removed
|
|
40
|
+
* remove_version .. True if version parameter should be removed
|
|
41
|
+
* family_map .. maps tuples of the form
|
|
42
|
+
* family
|
|
43
|
+
* level (integer, None is default)
|
|
44
|
+
* version (string, None is default)
|
|
45
|
+
into tuples of the form
|
|
46
|
+
* osdi file to load
|
|
47
|
+
* module name
|
|
48
|
+
* default_models .. maps device letters to default models
|
|
49
|
+
Values are tuples holding
|
|
50
|
+
* osdi file name
|
|
51
|
+
* module name
|
|
52
|
+
* default_model_prefix .. prefix for default model names
|
|
53
|
+
* as_toplevel .. treat input file as toiplevel netlist. Possible values
|
|
54
|
+
* auto .. detect automatically based on .end
|
|
55
|
+
* no .. treat as toplevel
|
|
56
|
+
* yes .. do not treat as toplevel
|
|
57
|
+
* all_models .. if True writes all models to the output,
|
|
58
|
+
otherwise ony used models are written
|
|
59
|
+
* original_case_subckt .. True if you want to keep the original case of
|
|
60
|
+
subcircuit definition names
|
|
61
|
+
* original_case_model .. True if you want to keep the original case of
|
|
62
|
+
model names
|
|
63
|
+
* original_case_instance .. True if you want to keep the original case of
|
|
64
|
+
instance names
|
|
65
|
+
* read_depth .. include/lib depth up to which the files are read.
|
|
66
|
+
Default (None) is equivalent to no depth limit.
|
|
67
|
+
* process_depth .. include/lib depth up to which the files are processed.
|
|
68
|
+
Default (None) is equivalent to no depth limit.
|
|
69
|
+
* output_depth .. include/lib depth up to which the files are written
|
|
70
|
+
to a VACASK netlist. Default (None) is equivalent to no depth limit.
|
|
71
|
+
* patch .. a dictionary of patches with file name for key. Files are
|
|
72
|
+
matched to this key with the last part of their name.
|
|
73
|
+
Values are lists of pairs of the form (old, new). If the old string is
|
|
74
|
+
found in the beginning of a line the whole line is replaced with the
|
|
75
|
+
new string.
|
|
76
|
+
* columns .. number of columns per line
|
|
77
|
+
|
|
78
|
+
The data member dictionary holds the following keys:
|
|
79
|
+
* title .. unprocessed first line of toplevel file
|
|
80
|
+
* control .. control block lines
|
|
81
|
+
* models .. a dictionary of available models, key is subcircuit name
|
|
82
|
+
where None represents the toplevel circuit. values are dictionaries
|
|
83
|
+
with model name as key holding tuples of the form
|
|
84
|
+
holding elements:
|
|
85
|
+
* builtin .. is it a SPICE builtin
|
|
86
|
+
* model type (npn, pnp, nmos, pmos, ...)
|
|
87
|
+
* model family
|
|
88
|
+
* level (integer)
|
|
89
|
+
* version (string)
|
|
90
|
+
* params .. list of (name, value) pairs.
|
|
91
|
+
* model_usage .. a dictionary tracking where individual models are used.
|
|
92
|
+
Key is a pair of the form (model name, subcircuit where model is defined).
|
|
93
|
+
Value is a set of subcircuit names (None for toplevel circuit)
|
|
94
|
+
where this model is used.
|
|
95
|
+
* default_models_needed .. set of device letters
|
|
96
|
+
* osdi_loads .. set of files loaded by pre_osdi in control block
|
|
97
|
+
* subckts .. a dictionary of subcircuit definitions with name for key
|
|
98
|
+
and values that are tuples holding
|
|
99
|
+
* terminals .. list of terminals
|
|
100
|
+
* parameters .. list of (name, value) pairs for parameters
|
|
101
|
+
* is_toplevel .. True if input file is a toplevel netlist
|
|
102
|
+
"""
|
|
103
|
+
def __init__(self, cfg=None, indent=4, debug=0):
|
|
104
|
+
# If no config is given, use default config
|
|
105
|
+
if cfg is None:
|
|
106
|
+
cfg = dfl.default_config()
|
|
107
|
+
self.cfg = cfg
|
|
108
|
+
self.data = {
|
|
109
|
+
"control": [],
|
|
110
|
+
"models": {},
|
|
111
|
+
"subckts": {},
|
|
112
|
+
"model_usage": {},
|
|
113
|
+
"default_models_needed": set(),
|
|
114
|
+
"osdi_loads": set(),
|
|
115
|
+
}
|
|
116
|
+
self.dbgindent = indent
|
|
117
|
+
self.debug = debug
|
|
118
|
+
|
|
119
|
+
def convert(self, fromFile, toFile=None):
|
|
120
|
+
_, deck, canonical_file_path = self.read_file(fromFile)
|
|
121
|
+
self.data["deck"] = deck
|
|
122
|
+
self.data["canonical_input_path"] = canonical_file_path
|
|
123
|
+
|
|
124
|
+
self.collect_masters()
|
|
125
|
+
|
|
126
|
+
out = self.vacask_file()
|
|
127
|
+
|
|
128
|
+
if toFile is None:
|
|
129
|
+
for l in out:
|
|
130
|
+
print(l)
|
|
131
|
+
else:
|
|
132
|
+
if not os.path.isabs(toFile):
|
|
133
|
+
# Relative path, get directory of input file
|
|
134
|
+
dest = os.path.join(os.path.dirname(self.data["canonical_input_path"]), toFile)
|
|
135
|
+
else:
|
|
136
|
+
dest = toFile
|
|
137
|
+
|
|
138
|
+
# Create destination directory
|
|
139
|
+
destdir = os.path.dirname(dest)
|
|
140
|
+
os.makedirs(destdir, exist_ok=True)
|
|
141
|
+
|
|
142
|
+
with open(dest, "w") as f:
|
|
143
|
+
for l in out:
|
|
144
|
+
f.write(l)
|
|
145
|
+
f.write("\n")
|
|
146
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
def default_config():
|
|
3
|
+
"""
|
|
4
|
+
Returns a default configuration.
|
|
5
|
+
"""
|
|
6
|
+
return {
|
|
7
|
+
"signature": "// Converted by ng2vc converter\n",
|
|
8
|
+
"sourcepath": [ "." ],
|
|
9
|
+
"merge_vector_instance_params": {
|
|
10
|
+
"q": set(["ic"])
|
|
11
|
+
},
|
|
12
|
+
"remove_instance_params": {
|
|
13
|
+
"c": set(["ic"]),
|
|
14
|
+
"l": set(["ic"]),
|
|
15
|
+
"d": set(["ic", "off"]),
|
|
16
|
+
"q" : set(["ic", "off"]),
|
|
17
|
+
},
|
|
18
|
+
"merge_vector_model_params": {
|
|
19
|
+
},
|
|
20
|
+
"remove_model_params": {
|
|
21
|
+
},
|
|
22
|
+
"type_map": {
|
|
23
|
+
# name params family remove level remove version
|
|
24
|
+
"r": ( {}, "r", False, False),
|
|
25
|
+
"res": ( {}, "r", False, False),
|
|
26
|
+
"c": ( {}, "c", False, False),
|
|
27
|
+
"l": ( {}, "l", False, False),
|
|
28
|
+
"d": ( {}, "d", False, False),
|
|
29
|
+
"npn": ( { "type": "1" }, "bjt", True, False),
|
|
30
|
+
"pnp": ( { "type": "-1" }, "bjt", True, False),
|
|
31
|
+
"njf": ( { "type": "1" }, "jfet", True, False),
|
|
32
|
+
"pjf": ( { "type": "-1" }, "jfet", True, False),
|
|
33
|
+
"nmf": ( { "type": "1" }, "mes", True, False),
|
|
34
|
+
"pmf": ( { "type": "-1" }, "mes", True, False),
|
|
35
|
+
"nhfet": ( { "type": "1" }, "hemt", True, False),
|
|
36
|
+
"phfet": ( { "type": "-1" }, "hemt", True, False),
|
|
37
|
+
"nmos": ( { "type": "1" }, "mos", True, True),
|
|
38
|
+
"pmos": ( { "type": "-1" }, "mos", True, True),
|
|
39
|
+
"nsoi": ( { "type": "1" }, "soi", True, True),
|
|
40
|
+
"psoi": ( { "type": "-1" }, "soi", True, True),
|
|
41
|
+
},
|
|
42
|
+
"family_map": {
|
|
43
|
+
# family, level, version file module params
|
|
44
|
+
("r", None, None): ( "spice/resistor.osdi", "sp_resistor", {} ),
|
|
45
|
+
("c", None, None): ( "spice/capacitor.osdi", "sp_capacitor", {} ),
|
|
46
|
+
("l", None, None): ( "spice/inductor.osdi", "sp_inductor", {} ),
|
|
47
|
+
|
|
48
|
+
("d", None, None): ( "spice/diode.osdi", "sp_diode", {} ),
|
|
49
|
+
("d", 1, None): ( "spice/diode.osdi", "sp_diode", {} ),
|
|
50
|
+
("d", 3, None): ( "spice/diode.osdi", "sp_diode", {} ),
|
|
51
|
+
|
|
52
|
+
("bjt", None, None): ( "spice/bjt.osdi", "sp_bjt", {} ),
|
|
53
|
+
("bjt", 1, None): ( "spice/bjt.osdi", "sp_bjt", {} ),
|
|
54
|
+
("bjt", 4, None): ( "spice/vbic.osdi", "sp_vbic", {} ),
|
|
55
|
+
("bjt", 9, None): ( "spice/vbic.osdi", "sp_vbic", {} ),
|
|
56
|
+
|
|
57
|
+
("jfet", None, None): ( "spice/jfet1.osdi", "sp_jfet1", {} ),
|
|
58
|
+
("jfet", 1, None): ( "spice/jfet1.osdi", "sp_jfet1", {} ),
|
|
59
|
+
("jfet", 2, None): ( "spice/jfet2.osdi", "sp_jfet2", {} ),
|
|
60
|
+
|
|
61
|
+
("mes", None, None): ( "spice/mes1.osdi", "sp_mes1", {} ),
|
|
62
|
+
("mes", 1, None): ( "spice/mes1.osdi", "sp_mes1", {} ),
|
|
63
|
+
|
|
64
|
+
("mos", None, None): ( "spice/mos1.osdi", "sp_mos1", {} ),
|
|
65
|
+
("mos", 1, None): ( "spice/mos1.osdi", "sp_mos1", {} ),
|
|
66
|
+
("mos", 2, None): ( "spice/mos2.osdi", "sp_mos2", {} ),
|
|
67
|
+
("mos", 3, None): ( "spice/mos3.osdi", "sp_mos3", {} ),
|
|
68
|
+
("mos", 6, None): ( "spice/mos6.osdi", "sp_mos6", {} ),
|
|
69
|
+
("mos", 9, None): ( "spice/mos9.osdi", "sp_mos9", {} ),
|
|
70
|
+
|
|
71
|
+
("mos", 8, None): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
72
|
+
("mos", 8, "3.3"): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
73
|
+
("mos", 8, "3.3.0"): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
74
|
+
("mos", 8, "3.2"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2"' } ),
|
|
75
|
+
("mos", 8, "3.20"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.20"' } ),
|
|
76
|
+
("mos", 8, "3.2.2"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.2"' } ),
|
|
77
|
+
("mos", 8, "3.22"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.22"' } ),
|
|
78
|
+
("mos", 8, "3.2.3"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.3"' } ),
|
|
79
|
+
("mos", 8, "3.23"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.23"' } ),
|
|
80
|
+
("mos", 8, "3.2.4"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.4"' } ),
|
|
81
|
+
("mos", 8, "3.24"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.24"' } ),
|
|
82
|
+
("mos", 8, "3.1"): ( "spice/bsim3v1.osdi", "sp_bsim3v1", {} ),
|
|
83
|
+
("mos", 8, "3.0"): ( "spice/bsim3v3.osdi", "sp_bsim3v0", {} ),
|
|
84
|
+
|
|
85
|
+
("mos", 49, None): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
86
|
+
("mos", 49, "3.3"): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
87
|
+
("mos", 49, "3.3.0"): ( "spice/bsim3v3.osdi", "sp_bsim3v3", {} ),
|
|
88
|
+
("mos", 49, "3.2"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2"' } ),
|
|
89
|
+
("mos", 49, "3.20"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.20"' } ),
|
|
90
|
+
("mos", 49, "3.2.2"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.2"' } ),
|
|
91
|
+
("mos", 49, "3.22"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.22"' } ),
|
|
92
|
+
("mos", 49, "3.2.3"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.3"' } ),
|
|
93
|
+
("mos", 49, "3.23"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.23"' } ),
|
|
94
|
+
("mos", 49, "3.2.4"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.2.4"' } ),
|
|
95
|
+
("mos", 49, "3.24"): ( "spice/bsim3v2.osdi", "sp_bsim3v2", { "version": '"3.24"' } ),
|
|
96
|
+
("mos", 49, "3.1"): ( "spice/bsim3v1.osdi", "sp_bsim3v1", {} ),
|
|
97
|
+
("mos", 49, "3.0"): ( "spice/bsim3v0.osdi", "sp_bsim3v0", {} ),
|
|
98
|
+
},
|
|
99
|
+
"all_models": False,
|
|
100
|
+
"default_models": {
|
|
101
|
+
# letter osdi file module
|
|
102
|
+
"r": ( "spice/resistor.osdi", "sp_resistor" ),
|
|
103
|
+
"c": ( "spice/capacitor.osdi", "sp_capacitor" ),
|
|
104
|
+
"l": ( "spice/inductor.osdi", "sp_inductor" ),
|
|
105
|
+
},
|
|
106
|
+
# Identify (graft_flag=False) or add (graft_flag=True)
|
|
107
|
+
# multiplier in definition of a subcircuit
|
|
108
|
+
"subckt_multiplier": {
|
|
109
|
+
# "subckt_name": [ "multiplier_name", graft_flag ]
|
|
110
|
+
},
|
|
111
|
+
"default_model_prefix": "defmod_",
|
|
112
|
+
"as_toplevel": "auto",
|
|
113
|
+
"read_depth": None, # Fully recursive
|
|
114
|
+
"process_depth": None, # Fully recursive
|
|
115
|
+
"output_depth": None, # Fully recursive
|
|
116
|
+
"patch": {},
|
|
117
|
+
"columns": 80,
|
|
118
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .generators import format_history
|
|
2
|
+
|
|
3
|
+
# Define out own exception
|
|
4
|
+
class ConverterError(Exception):
|
|
5
|
+
def __init__(self, message, history=None, lineno=None):
|
|
6
|
+
if history is not None:
|
|
7
|
+
txt = format_history(history, lineno)+"\n "+message
|
|
8
|
+
else:
|
|
9
|
+
txt = message
|
|
10
|
+
super().__init__(txt)
|