#!/bin/bash
if [ $# -eq 0 ]
then
echo '# Script which copies the cell in argument 1 from ../sclib100_0'
echo '# and adds 45 to its input pin capacitances.'
exit 1
fi
source_dir=../sclib100_0
cell=$1.vbe
inccap=45
if test -f "$source_dir"/"$cell"
then
cp "$source_dir"/"$cell" .
else
echo "# Cell "$cell" does not exist. Please check."
echo "# Nothing done."
exit 1
fi
pins=$(awk '$2 ~ /cin_/ {print $2}' $cell)
for input_pins in $pins
do
pincap=$(awk '$2 ~ /'$input_pins'/ {print $6}' $cell | sed 's/;//')
let pincap=$pincap+$inccap
awk '$2 ~ /'$input_pins'/ {printf "%-11s%-14s%-2s%-8s%-3s%-8s\n", " "$1,$2,$3,$4,$5,'$pincap'";"}
$2 !~ /'$input_pins'/ {print}' $cell > $$_temp
mv -f $$_temp $cell
done