osic-stacks/stacks/analog-tools/scripts/install-open-pdks.sh

91 lines
3.3 KiB
Bash
Raw Normal View History

2023-09-22 07:02:53 +00:00
#!/bin/bash
set -e
2023-09-22 08:05:39 +00:00
export OPEN_PDKS_VERSION="dd7771c384ed36b91a25e9f8b314355fc26561be"
export SCRIPT_DIR=$PWD
2023-09-22 07:02:53 +00:00
if [ -d xschemrc ]; then
echo File xschemrc not found
return -1
fi
2023-09-22 08:05:39 +00:00
if [ -d $SCRIPT_DIR/iic-spice-model-red.py ]; then
echo File iic-spice-model.red.py not found
return -1
fi
######################
# INSTALL GF180MCU PDK
######################
export PDK=gf180mcu
volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}"
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuA
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuB
rm -rf $PDK_ROOT/volare/gf180mcu/versions/*/gf180mcuD
rm -rf $PDK_ROOT/gf180mcuA
rm -rf $PDK_ROOT/gf180mcuB
rm -rf $PDK_ROOT/gf180mcuD
export KLAYOUT_HOME="$PDK_ROOT/gf180mcuC/libs.tech/klayout"
mv $KLAYOUT_HOME/pymacros temp
mkdir $KLAYOUT_HOME/pymacros
mv temp $KLAYOUT_HOME/pymacros/cells
mv $KLAYOUT_HOME/tech/gf180mcu.lym $KLAYOUT_HOME/pymacros
mv "$SCRIPT_DIR/xschemrc" $PDK_ROOT/gf180mcuC/libs.tech/xschem/xschemrc
rm -rf .scripts/klayout
2023-09-22 07:02:53 +00:00
####################
# INSTALL SKY130 PDK
####################
2023-09-22 17:10:10 +00:00
# I don't know about pcell support, maybe with pip install sky130?
# pip install sky130 --upgrade --break-system-packages
# Still having troubles with this:
# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6
# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6
# ERROR: Reading /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym: XML parser error: invalid name for processing instruction in line 17, column 6
# Fixing the above, the cells indicates the following:
# ERROR: /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23: ModuleNotFoundError: No module named 'gdsfactory.types'
# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/via_generator.py:23
# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/vias.py:20
# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/cells/__init__.py:21
# /home/designer/.volare/sky130A/libs.tech/klayout/pymacros/sky130.lym:9 (class ModuleNotFoundError)
2023-09-22 08:05:39 +00:00
export PDK=sky130
volare enable "${OPEN_PDKS_VERSION}" --pdk "${PDK}"
2023-09-22 07:02:53 +00:00
# remove version sky130B to save space (efabless TO use mostly sky130A)
rm -rf "$PDK_ROOT"/volare/sky130/versions/*/sky130B
rm -rf "$PDK_ROOT"/sky130B
2023-09-22 08:05:39 +00:00
# apply SPICE mode file reduction (for the variants that exist)
# add custom IIC bind keys to magicrc
2023-09-22 07:02:53 +00:00
2023-09-22 08:05:39 +00:00
cd "$PDK_ROOT/sky130A/libs.tech/ngspice" || exit 1
"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice tt
"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ss
"$SCRIPT_DIR/iic-spice-model-red.py" sky130.lib.spice ff
2023-09-22 07:02:53 +00:00
2023-09-22 08:05:39 +00:00
# FIXME: Repair klayout tech file
sed -i 's/>sky130</>sky130A</g' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt"
sed -i 's/sky130.lyp/sky130A.lyp/g' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt"
sed -i '/<base-path>/c\ <base-path/>' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt"
# shellcheck disable=SC2016
sed -i '/<original-base-path>/c\ <original-base-path>$PDK_ROOT/$PDK/libs.tech/klayout</original-base-path>' "$PDK_ROOT/sky130A/libs.tech/klayout/tech/sky130A.lyt"
2023-09-22 07:02:53 +00:00
2023-09-22 08:05:39 +00:00
cd "$SCRIPT_DIR"
2023-09-22 07:02:53 +00:00
2023-09-22 08:05:39 +00:00
rm -rf "$SCRIPT_DIR/iic-spice-model-red.py"