diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/kicadtoNgspice/Convert.py | 28 | ||||
-rwxr-xr-x | src/kicadtoNgspice/DeviceModel.py | 12 |
2 files changed, 33 insertions, 7 deletions
diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 7d68e44e..c1209cd3 100755 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -550,11 +550,37 @@ class Convert: shutil.copy2(src, dst) elif eachline[0:6] == 'scmode': + (filepath, filemname) = os.path.split(self.clarg1) + self.Fileopen = os.path.join(filepath, ".spiceinit") + print("======================================================") + print("Writing to the .spiceinit file to make ngspice SKY130 compatible") + self.writefile = open(self.Fileopen, "w") + self.writefile.write(''' +set ngbehavior=hsa ; set compatibility for reading PDK libs +set ng_nomodcheck ; don't check the model parameters +set num_threads=8 ; CPU hardware threads available +option noinit ; don't print operating point data +optran 0 0 0 100p 2n 0 ; don't use dc operating point, but transient op) +''') + print("======================================================") + tempStr = completeLibPath.split(':') print(tempStr) + libs = ''' +sky130_fd_pr__model__diode_pd2nw_11v0.model.spice +sky130_fd_pr__model__diode_pw2nd_11v0.model.spice +sky130_fd_pr__model__inductors.model.spice +sky130_fd_pr__model__linear.model.spice +sky130_fd_pr__model__pnp.model.spice +sky130_fd_pr__model__r+c.model.spice +''' includeLine.append( ".lib \"" + tempStr[0] + "\" " + tempStr[1]) - deviceLine[index] = '*scmode' + for i in libs.split(): + includeLine.append( + ".include \"" + tempStr[0].replace( + "sky130.lib.spice", i) + "\"") + deviceLine[index] = "*scmode" # words.append(completeLibPath) # deviceLine[index] = words diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index c1eb5f90..604f814b 100755 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -113,7 +113,7 @@ For more info please see the documentation''') beg = self.count self.deviceDetail[self.count] = "scmode1" sky130box.setTitle( - "Add parameters of sky130 library ") + "Add parameters of SKY130 library ") # + # " : " + # words[6]) @@ -201,14 +201,14 @@ sky130_fd_pr/models/sky130.lib.spice") and eachline[0] != 'a': print("Only components with designators 'sc', 'u', \ 'x', 'v', 'i', 'a'\ - can be used with sky130 mode") + can be used with SKY130 mode") print("Please remove other components") self.msg = QtWidgets.QErrorMessage() self.msg.setModal(True) self.msg.setWindowTitle("Invalid components") self.content = "Only components with designators " + \ "'sc', 'u' and 'x' can be used \ - with sky130 mode. " + \ + with SKY130 mode. " + \ "Please edit the schematic and \ generate netlist again" self.msg.showMessage(self.content) @@ -227,9 +227,9 @@ sky130_fd_pr/models/sky130.lib.spice") words[0] + " : " + words[-1]) path_name = '' - # Adding to get sky130 dimension + # Adding to get SKY130 dimension self.parameterLabel[self.count] = QtWidgets.QLabel( - "Enter the parameters of sky130 component " + words[0]) + "Enter the parameters of SKY130 component " + words[0]) sky130grid.addWidget( self.parameterLabel[self.count], self.row, 0) self.entry_var[self.count] = QtWidgets.QLineEdit() @@ -260,7 +260,7 @@ sky130_fd_pr/models/sky130.lib.spice") path_name = "" except BaseException as e: print("Error when set text of Device " + - "Sky130 Component :", str(e)) + "SKY130 Component :", str(e)) except BaseException: pass self.trackLibraryWithoutButton(self.count, path_name) |