blob: a4684066575e9e84f2f11df65a2c3d7cc324fcc3 [file] [log] [blame]
#!/bin/bash
export RUNSET_DIR=$(cd ./V1.3.0/PEX/xRC; pwd)
export PDK_HOME=$(cd ./V1.3.0; pwd)
export LOG
export JOB_NAME
export JOB_HOME
export PEX_HANDLE=".pex.spice"
export PXI_HANDLE=".pxi.spice"
export FILE_OUT=./output/${VARIANT}
#Sets the LOG variable and creates the log directory if it doesn't exist.
if [ ! -d "$FILE_OUT/log" ]; then
mkdir -p $FILE_OUT/log
LOG=$FILE_OUT/log
else
LOG=$FILE_OUT/log
fi
#Removes the outputs if the script is run again. Otherwise it creates the output directory and all of its subdirectories
if [ ! -d "$FILE_OUT" ]; then
echo "Making output directory...."
mkdir -p $FILE_OUT/{report,ext,spice}
else
echo "Building Directories...."
mkdir -p $FILE_OUT/{report,ext,spice}
fi
#If the gds files weren't generated, this if statement extracts all of the gds files from the cells within the lib folder.
if [ ! -d "../lib/gds" ]; then
cd ../lib
make magic
cd -
fi
cd ../lib/gds
JOB_HOME=$PWD
cd -
if [ ! -z "$1" ]; then
export i=$(echo $1 | cut -f 1 -d '.') #i is used as the input variable
else
export i="$(basename -s .gds $(ls $JOB_HOME/*.gds))" #i is used as the input variable
fi
#Loops through the input gds files. If no user input is supplied, all gds files are put through the DRC process.
for JOB_NAME in $i ; do
#Checks to make sure the file supplied exists. If not, then it exits the bash script.
if [ ! -e $JOB_HOME/$JOB_NAME.gds ]; then echo "Did not find '$JOB_HOME/$JOB_NAME.gds'"
exit 1
fi
echo -e "\nexport JOB_HOME='$JOB_HOME'"
echo -e "export JOB_NAME='$JOB_NAME'"
echo -e "====================================="
set -x #Turns on debugging
echo $PDK_HOME
calibre -gui -pex -runset $RUNSET_DIR/s8_xRC_runset -batch > $LOG/s8_pex_runset.log 2>&1
set +x #Turns off debugging
done #End of the loop
#The two loops immediately below will go through the produced PEX and PXI files and correct their naming convention before moving them to the specified path
for file in ./*.pxi; do
NAME_1="$(basename "$file")"
NAME_2=${NAME_1%.*}
NAME_3=${NAME_2%.*} #USED FOR PXI FILES ONLY
BASE=${NAME_3%.*}
mv $NAME_1 $BASE$PXI_HANDLE
done
for file in ./*.pex; do
NAME_1="$(basename "$file")"
NAME_2=${NAME_1%.*}
BASE=${NAME_2%.*}
mv $NAME_1 $BASE$PEX_HANDLE
done
sed -i 's/.spice.pex/.pex.spice/g' *.spice
sed -i 's/.spice..*.pxi/.pxi.spice/g' *.spice
mkdir $FILE_OUT/spice
mkdir $FILE_OUT/report
mv *.spice $FILE_OUT/spice
mv *.report $FILE_OUT/report
echo "Moving output files to ./output"
mv -v *.ext $FILE_OUT/ext/
mv -v *erc* $FILE_OUT
mv -v _xrcControlFile_s8_ $FILE_OUT
mv -v svdb/ $FILE_OUT
mv -v *bat* $FILE_OUT
#mv -v *.report ./output/report/
#mv -v *.pex ./output/pex/
#mv -v *.spice ./output/spice/
#mv -v *.pxi ./output/pxi/
#mv -v *.ext ./output/ext/
#mv -v *erc* ./output/
#mv -v _xrcControlFile_s8_ ./output/
#mv -v svdb/ ./output/
#mv -v *bat* ./output/
exit 0