MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / _compileUSERLibrary

Function _compileUSERLibrary

SLiCAP/SLiCAPyacc.py:146–173  ·  view source on GitHub ↗

Parses a user library file and writes the subcircuit, models, and global parameters to USERCIRCUITS, USERPMODELS, and USERPARAMS, respectively. :param fileName: Path of the library file :type fileName: str :return: None :rtype: NoneType

(fileName)

Source from the content-addressed store, hash-verified

144 ini.SLiCAPPARAMS = _SLiCAPPARAMS
145
146def _compileUSERLibrary(fileName):
147 """
148 Parses a user library file and writes the subcircuit, models,
149 and global parameters to USERCIRCUITS, USERPMODELS, and USERPARAMS,
150 respectively.
151
152 :param fileName: Path of the library file
153
154 :type fileName: str
155
156 :return: None
157 :rtype: NoneType
158 """
159 global _USERCIRCUITS, _USERPARAMS, _USERMODELS
160 print("Compiling library: " + fileName + ".")
161 f = open(fileName, 'r')
162 netlist = f.read()
163 f.close()
164 cirName = netlist.splitlines()[0][0:-1].replace(" ", "_")
165 _parseNetlist(netlist, cirName, 'user')
166 for model in _USERCIRCUITS[cirName].modelDefs.keys():
167 _USERMODELS[model] = _USERCIRCUITS[cirName].modelDefs[model]
168 for param in _USERCIRCUITS[cirName].parDefs.keys():
169 _USERPARAMS[param] = _USERCIRCUITS[cirName].parDefs[param]
170 del _USERCIRCUITS[cirName]
171 # PASS 2 and 3
172 for cir in _USERCIRCUITS.keys():
173 _checkReferences(_USERCIRCUITS[cir])
174
175def _parseNetlist(netlist, name, cirType):
176 """

Callers 1

_parseLibraryFunction · 0.85

Calls 2

_parseNetlistFunction · 0.85
_checkReferencesFunction · 0.85

Tested by

no test coverage detected