More corrections to spectre_to_spice.py and split_spice.py.
diff --git a/common/spectre_to_spice.py b/common/spectre_to_spice.py index c522367..d611d92 100755 --- a/common/spectre_to_spice.py +++ b/common/spectre_to_spice.py
@@ -148,7 +148,7 @@ binrex = re.compile('[ \t]*([0-9]+):[ \t]+type[ \t]*=[ \t]*(.*)') shincrex = re.compile('\.inc[ \t]+') - stdsubrex = re.compile('\.subckt[ \t]+([^ \t]+)[ \t]+([^ \t]*)') + stdsubrex = re.compile('\.subckt[ \t]+([^ \t]+)[ \t]+(.*)') stdmodelrex = re.compile('\.model[ \t]+([^ \t]+)[ \t]+([^ \t]+)[ \t]+(.*)') stdendsubrex = re.compile('\.ends[ \t]+(.+)') stdendonlysubrex = re.compile('\.ends[ \t]*') @@ -196,6 +196,8 @@ # Item 1b. In-line C++-style // comments get replaced with $ comment character elif ' //' in line: line = line.replace(' //', ' $ ', 1) + elif '//' in line: + line = line.replace('//', ' $ ', 1) elif '\t//' in line: line = line.replace('\t//', '\t$ ', 1) @@ -293,7 +295,8 @@ mmatch = modelrex.match(line) if not mmatch: mmatch = cdlmodelrex.match(line) - iscdl = True + if mmatch: + iscdl = True else: mmatch = stdmodelrex.match(line) @@ -513,6 +516,10 @@ else: convtype = type + # If there is a binned model then it replaces any original + # model line that was saved. + if modellines[-1].startswith('.model'): + modellines = modellines[0:-1] modellines.append('') modellines.append('.model ' + modname + '.' + bin + ' ' + convtype) continue
diff --git a/common/split_spice.py b/common/split_spice.py index d8c5539..e6b8509 100755 --- a/common/split_spice.py +++ b/common/split_spice.py
@@ -48,9 +48,6 @@ for line in inplines: - if subname == 'xrdn': - print('handling line in xrdn, file ' + in_file + ': "' + line + '"') - # Item 1. Handle comment lines if line.startswith('*'): if subcktlines != []: @@ -71,8 +68,6 @@ # Item 3. Handle blank lines like comment lines if line.strip() == '': - if subname == 'xrdn': - print('blank line in xrdn subcircuit') if subcktlines != []: subcktlines.append(line) else: @@ -151,6 +146,9 @@ print(line, file=ofile) subcktlines = [] + # Add an include statement to this file in the source + spicelines.append('.include ' + subckt_file) + insubckt = False inmodel = False subname = ''