[CI] Added job for running dv and splitted precheck to two jobs
- precheck xor and drc checks are seperated because xor check runs for a very long amount of time on large designs
- the dv checks run the rtl simulation for now
diff --git a/.github/scripts/dv/pdkBuild.sh b/.github/scripts/dv/pdkBuild.sh
new file mode 100644
index 0000000..9f9ac93
--- /dev/null
+++ b/.github/scripts/dv/pdkBuild.sh
@@ -0,0 +1,59 @@
+#!/bin/bash
+# SPDX-FileCopyrightText: 2020 Efabless Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# SPDX-License-Identifier: Apache-2.0
+export RUN_ROOT=$(pwd)
+
+
+# By default skip timing since we don't need the libs in any of the CI tests
+export SKIP_TIMING=${1:-1}
+export IMAGE_NAME=efabless/openlane:$OPENLANE_TAG
+docker pull $IMAGE_NAME
+
+cd $RUN_ROOT/..
+export PDK_ROOT=$(pwd)/pdks
+mkdir $PDK_ROOT
+echo $PDK_ROOT
+echo $RUN_ROOT
+cd $RUN_ROOT
+make skywater-pdk
+make skywater-library
+# The following section is for running on the CI.
+# If you're running locally you should replace them with: `make skywater-library`
+# This is because sometimes while setting up the conda env (skywater's make timing) it fails to fetch something
+# Then it exits without retrying. So, here we're retrying, and if something goes wrong it will exit after 5 retries.
+# Section Begin
+if [ $SKIP_TIMING -eq 0 ]; then
+ cnt=0
+ until make skywater-timing; do
+ cnt=$((cnt+1))
+ if [ $cnt -eq 5 ]; then
+ exit 2
+ fi
+ rm -rf $PDK_ROOT/skywater-pdk
+ make skywater-pdk
+ make skywater-library
+ done
+fi
+# Section End
+
+make open_pdks
+docker run -v $RUN_ROOT:/openLANE_flow -v $PDK_ROOT:$PDK_ROOT -e PDK_ROOT=$PDK_ROOT -u $(id -u $USER):$(id -g $USER) $IMAGE_NAME bash -c "make build-pdk"
+
+rm -rf $PDK_ROOT/open_pdks
+rm -rf $PDK_ROOT/skywater-pdk
+
+echo "done installing"
+cd $RUN_ROOT
+exit 0
\ No newline at end of file
diff --git a/.github/scripts/dv/run-dv-wrapper.sh b/.github/scripts/dv/run-dv-wrapper.sh
new file mode 100644
index 0000000..8deec88
--- /dev/null
+++ b/.github/scripts/dv/run-dv-wrapper.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+# SPDX-FileCopyrightText: 2020 Efabless Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# SPDX-License-Identifier: Apache-2.0
+
+# comma seperated test ids
+IDS=$1
+# simulation mode : RTL/GL
+SIM_MODE=$2
+
+DV_TEST_IDS=(${IDS//,/ })
+
+export TARGET_PATH=$(pwd)
+if [ ! -d $TARGET_PATH ]
+then
+ echo "Directory /path/to/dir DOES NOT exists."
+ exit 9999
+fi
+
+cd ..
+
+export PDK_PATH=$(pwd)/pdks/sky130A
+if [ ! -d $PDK_PATH ]
+then
+ echo "Directory /path/to/dir DOES NOT exists."
+ exit 9999
+fi
+
+DV_PATH=$TARGET_PATH/verilog/dv
+if [ ! -d $DV_PATH ]
+then
+ echo "Directory /path/to/dir DOES NOT exists."
+ exit 9999
+fi
+
+for id in "${DV_TEST_IDS[@]}"
+do
+ docker run -v $TARGET_PATH:$TARGET_PATH -v $PDK_PATH:$PDK_PATH \
+ -e TARGET_PATH=$TARGET_PATH -e PDK_PATH=$PDK_PATH \
+ -u $(id -u $USER):$(id -g $USER) efabless/dv_setup:latest \
+ bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_PATH $DV_PATH $id $SIM_MODE"
+
+ echo "DONE!"
+
+ VERDICT_FILE=$TARGET_PATH/verilog/dv/$id.out
+
+ if [ -f $VERDICT_FILE ]; then
+ cnt=$(grep "Pass" $VERDICT_FILE -s | wc -l)
+ if ! [[ $cnt ]]; then cnt = 0; fi
+ else
+ echo "DV check failed due to subscript failure. Please review the logs";
+ exit 2;
+ fi
+
+ echo "Verdict: $cnt"
+
+ if [[ $cnt -ne 1 ]]; then
+ exit 2;
+ fi
+done
+
+exit 0;
\ No newline at end of file
diff --git a/.github/scripts/dv/run-dv.sh b/.github/scripts/dv/run-dv.sh
new file mode 100644
index 0000000..125cf3c
--- /dev/null
+++ b/.github/scripts/dv/run-dv.sh
@@ -0,0 +1,40 @@
+PDK_PATH=$1
+DV_PATH=$2
+DV_TEST_ID=$3
+SIM_MODE=$4
+
+cd $DV_PATH
+
+## get the name of all subdfolders under verilog/dv
+ALL_DV_TESTS="$(find * -maxdepth 0 -type d)"
+## convert all ALL_DV_TESTS to an array
+TESTS_ARR=($ALL_DV_TESTS)
+## get length of the TESTS array
+len=${#TESTS_ARR[@]}
+
+## make sure that the test ID is less than the array length
+if [ $DV_TEST_ID -ge $len ]
+then
+ echo "Error: Invalid Test ID"
+ exit 1
+fi
+
+## get the name corresponding to the test ID
+PATTERN=${TESTS_ARR[$DV_TEST_ID]}
+
+OUT_FILE=$DV_PATH/$DV_TEST_ID.out
+
+export SIM=$SIM_MODE
+echo "Running $PATTERN $SIM.."
+logFile=$DV_PATH/$PATTERN.$SIM.dv.out
+cd $PATTERN
+echo $(pwd)
+make 2>&1 | tee $logFile
+grep "Monitor" $logFile >> $OUT_FILE
+make clean
+
+echo "Execution Done on $PATTERN !"
+
+cat $OUT_FILE
+
+exit 0
\ No newline at end of file
diff --git a/.github/scripts/precheck/run-precheck-drc.sh b/.github/scripts/precheck/run-precheck-drc.sh
new file mode 100644
index 0000000..51dc751
--- /dev/null
+++ b/.github/scripts/precheck/run-precheck-drc.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# SPDX-FileCopyrightText: 2020 Efabless Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# SPDX-License-Identifier: Apache-2.0
+export TARGET_PATH=$(pwd)
+cd ..
+export PDK_ROOT=$(pwd)/precheck_pdks
+cd $TARGET_PATH/open_mpw_precheck/
+
+docker run -v $(pwd):/usr/local/bin -v $TARGET_PATH:$TARGET_PATH -v $PDK_ROOT:$PDK_ROOT -u $(id -u $USER):$(id -g $USER) efabless/open_mpw_precheck:latest bash -c "python3 open_mpw_prechecker.py --drc_only -p $PDK_ROOT -t $TARGET_PATH"
+output=$TARGET_PATH/checks/full_log.log
+
+gzipped_file=$TARGET_PATH/checks/full_log.log.gz
+
+if [[ -f $gzipped_file ]]; then
+ gzip -d $gzipped_file
+fi
+
+grep "Violation Message" $output
+
+cnt=$(grep -c "All Checks PASSED!" $output)
+if ! [[ $cnt ]]; then cnt=0; fi
+if [[ $cnt -eq 1 ]]; then exit 0; fi
+exit 2
\ No newline at end of file
diff --git a/.github/scripts/precheck/run-precheck.sh b/.github/scripts/precheck/run-precheck.sh
index 569ecc7..6b7a1fb 100644
--- a/.github/scripts/precheck/run-precheck.sh
+++ b/.github/scripts/precheck/run-precheck.sh
@@ -18,7 +18,7 @@
export PDK_ROOT=$(pwd)/precheck_pdks
cd $TARGET_PATH/open_mpw_precheck/
-docker run -v $(pwd):/usr/local/bin -v $TARGET_PATH:$TARGET_PATH -v $PDK_ROOT:$PDK_ROOT -u $(id -u $USER):$(id -g $USER) efabless/open_mpw_precheck:latest bash -c "python3 open_mpw_prechecker.py -p $PDK_ROOT -t $TARGET_PATH"
+docker run -v $(pwd):/usr/local/bin -v $TARGET_PATH:$TARGET_PATH -v $PDK_ROOT:$PDK_ROOT -u $(id -u $USER):$(id -g $USER) efabless/open_mpw_precheck:latest bash -c "python3 open_mpw_prechecker.py --skip_drc -p $PDK_ROOT -t $TARGET_PATH"
output=$TARGET_PATH/checks/full_log.log
gzipped_file=$TARGET_PATH/checks/full_log.log.gz
@@ -32,4 +32,4 @@
cnt=$(grep -c "All Checks PASSED!" $output)
if ! [[ $cnt ]]; then cnt=0; fi
if [[ $cnt -eq 1 ]]; then exit 0; fi
-exit 2
+exit 2
\ No newline at end of file
diff --git a/.github/workflows/caravel_example_ci.yml b/.github/workflows/caravel_example_ci.yml
index cfb184d..e833d29 100644
--- a/.github/workflows/caravel_example_ci.yml
+++ b/.github/workflows/caravel_example_ci.yml
@@ -10,6 +10,7 @@
jobs:
precheck:
runs-on: ubuntu-latest
+ timeout-minutes: 720
steps:
- uses: actions/checkout@v2
with:
@@ -26,3 +27,49 @@
- name: Run The Precheck
run: bash ${GITHUB_WORKSPACE}/.github/scripts/precheck/run-precheck.sh
+
+ precheck-drc:
+ timeout-minutes: 720
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: 'true'
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: Install The Precheck
+ run: sh ${GITHUB_WORKSPACE}/.github/scripts/precheck/precheckBuild.sh
+
+ - name: Run The Precheck
+ run: bash ${GITHUB_WORKSPACE}/.github/scripts/precheck/run-precheck-drc.sh
+
+ dv_rtl:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: 'true'
+
+ - name: Set up QEMU
+ uses: docker/setup-qemu-action@v1
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v1
+
+ - name: Install The PDK
+ run: bash ${GITHUB_WORKSPACE}/.github/scripts/dv/pdkBuild.sh
+ env:
+ OPENLANE_TAG: v0.12
+
+ - name: Install The Dockerized DV Setup
+ run: docker pull efabless/dv_setup:latest
+
+ - name: Run DV tests
+ # Run test number 0,1,2,3 in one job <test-ids> <sim-mode>
+ run: bash ${GITHUB_WORKSPACE}/.github/scripts/dv/run-dv-wrapper.sh 0,1,2,3 RTL
+
\ No newline at end of file