Corrected the "short" model which is actually being called as a subcircuit, not a resistor, from the extraction in magic. Also added a new custom file "diode.spice" which does the same thing for the diodes, which are defined as low-level diode types but are extracted from magic as a subcircuit.
diff --git a/sky130/Makefile.in b/sky130/Makefile.in index 78c7080..c78bdcb 100644 --- a/sky130/Makefile.in +++ b/sky130/Makefile.in
@@ -370,9 +370,13 @@ -lef %l/latest/cells/*/*.magic.lef compile-only \ -spice %l/latest/cells/*/*.spice filter=custom/scripts/rename_cells.py \ -library primitive sky130_fd_pr |& tee -a ${SKY130A}_install.log - # Custom: Add "short" resistor model to the r+c models file + # Custom: Add "short" resistor model and subcircuit to the r+c models file cat ./custom/models/short.spice >> \ ${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice + # Custom: Add diodes as subcircuits to the r+c models file + cat ./custom/models/diode.spice >> \ + ${STAGING_PATH}/${SKY130A}/libs.tech/ngspice/sky130_fd_pr__model__r+c.model.spice + # Install custom additions to I/O pad library ${STAGE} -source ./custom -target ${STAGING_PATH}/${SKY130A} \ -verilog %l/verilog/*.v \
diff --git a/sky130/custom/models/diode.spice b/sky130/custom/models/diode.spice new file mode 100644 index 0000000..81bee35 --- /dev/null +++ b/sky130/custom/models/diode.spice
@@ -0,0 +1,9 @@ +* For diodes called as a subcircuit +* (backwards compatible with earlier PDK version) +.subckt sky130_fd_pr__diode_pw2nd N P a=0 p=0 +D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=a +.ends +* (corresponds to current PDK) +.subckt sky130_fd_pr__diode_pw2nd_05v5 N P area=0 +D0 N P sky130_fd_pr__diode_pw2nd_05v5 area=area +.ends
diff --git a/sky130/custom/models/short.spice b/sky130/custom/models/short.spice index bc5faf0..30df356 100644 --- a/sky130/custom/models/short.spice +++ b/sky130/custom/models/short.spice
@@ -1,2 +1,6 @@ * Resistor model "short" defined with a fixed resistance of 0.01 ohms. .model short r r=0.01 +* If "short" is called as a subcircuit, then this needs to be supported, too. +.subckt short 1 2 SUB l=0 w=0 +R0 1 2 short +.ends