mirror of https://github.com/efabless/caravel.git
Merge pull request #290 from efabless/caravel_redesign-mag-guards
misc: scripts to prevent & fix bad mag paths
This commit is contained in:
commit
7fa79aad37
|
@ -0,0 +1,21 @@
|
|||
#!/bin/env bash
|
||||
staged=($(git diff --name-only --cached))
|
||||
|
||||
for file in ${staged[@]}
|
||||
do
|
||||
filename=$(basename -- "$file")
|
||||
extension="${filename##*.}"
|
||||
if [[ "$extension" = "mag" ]]; then
|
||||
matches=($(sed -n 's/^use\b \+\S\+\ \+\S\+ \+\(\S\+\)/\1/p' $file))
|
||||
for match in ${matches[@]}
|
||||
do
|
||||
if [[ "$(echo "$match" | sed -n '/PDKPATH\b\|PDK\b\|PDK_ROOT\b/p')" = "" ]]; then
|
||||
echo "error: mag file $file has a <use> statment with a pdk path that's not PDKPATH|PDK|PDK_ROOT"
|
||||
echo "the path used is: $match"
|
||||
echo "you can use: 'git commit -n ..' to ignore this check but that's not recommended"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/env bash
|
||||
staged=($(git diff --name-only --cached))
|
||||
|
||||
for file in ${staged[@]}
|
||||
do
|
||||
filename=$(basename -- "$file")
|
||||
extension="${filename##*.}"
|
||||
filename_no_ext="${filename%%.*}"
|
||||
if [[ "$extension" = "mag" ]]; then
|
||||
matches=($(sed -E -n 's/string GDS_FILE +(\S+)/\1/p' $file))
|
||||
for match in ${matches[@]}
|
||||
do
|
||||
if [[ "$(echo "$match" | sed -n "/..\/gds\/${filename_no_ext}/p")" = "" ]]; then
|
||||
echo "error: maglef file($file) has string GDS_FILE reference that is not valid"
|
||||
echo "the reference used is: $match"
|
||||
echo "you can use: 'git commit -n ..' to ignore this check but that's not recommended"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/env bash
|
||||
|
||||
./.githooks/mag-pdkpath.bash
|
||||
./.githooks/maglef-gdspath.bash
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/env bash
|
||||
|
||||
mag_path=$1
|
||||
mags=$(find $mag_path -maxdepth 1 -type f -name '*.mag' )
|
||||
|
||||
for mag in $mags; do
|
||||
filename=$(basename $mag)
|
||||
sed -i -E 's#(use +sky130_\S+_sc_(\S+)__\S+ +\S+ +)\S+#\1$PDKPATH/libs.ref/sky130_fd_sc_\2/mag#' $mag_path/$filename
|
||||
done
|
|
@ -0,0 +1,10 @@
|
|||
#!/bin/env bash
|
||||
|
||||
maglef_path=$1
|
||||
maglefs=$(find $maglef_path -maxdepth 1 -type f -name '*.mag' )
|
||||
|
||||
for maglef in $maglefs; do
|
||||
filename=$(basename $maglef)
|
||||
filename_no_ext="${filename%%.*}"
|
||||
sed -i -E "s#string GDS_FILE.*#string GDS_FILE ../gds/$filename_no_ext.gds#" $maglef_path/$filename
|
||||
done
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/env bash
|
||||
|
||||
git config core.hooksPath ./.githooks
|
Loading…
Reference in New Issue