From 95742da1ef84198275a8aaaf56cac2086d564eb7 Mon Sep 17 00:00:00 2001 From: Marwan Abbas Date: Apr 08 2022 17:15:44 +0000 Subject: Merge branch 'main' into sdf_simulation --- diff --git a/.github/scripts/build/run-set-id.sh b/.github/scripts/build/run-set-id.sh deleted file mode 100644 index 1042716..0000000 --- a/.github/scripts/build/run-set-id.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/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 UPRJ_ROOT=$(pwd) -cd .. -export CARAVEL_ROOT=$(pwd)/caravel -export IMAGE_NAME=efabless/openlane:$OPENLANE_TAG -export PDK_ROOT=$(pwd)/pdks -export USER_ID=00000001 - -cd $UPRJ_ROOT || exit - -# Install full version of caravel -git clone --depth=1 https://github.com/efabless/caravel $CARAVEL_ROOT - -LOG_FILE=out.log -docker run -v $UPRJ_ROOT:$UPRJ_ROOT -v $PDK_ROOT:$PDK_ROOT -v $CARAVEL_ROOT:$CARAVEL_ROOT -e UPRJ_ROOT=$UPRJ_ROOT -e PDK_ROOT=$PDK_ROOT -e CARAVEL_ROOT=$CARAVEL_ROOT -u $(id -u $USER):$(id -g $USER) $IMAGE_NAME bash -c "cd $CARAVEL_ROOT; make uncompress; cd $UPRJ_ROOT; export USER_ID=$USER_ID; make set_user_id | tee $LOG_FILE;" - -cnt=$(grep "Done" $LOG_FILE -s | wc -l) - -if [[ $cnt -ne 3 ]]; then - exit 2 -fi - -exit 0 diff --git a/.github/scripts/build/run-ship.sh b/.github/scripts/build/run-ship.sh deleted file mode 100644 index 01ddec1..0000000 --- a/.github/scripts/build/run-ship.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/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 UPRJ_ROOT=$(pwd) -cd .. -export CARAVEL_ROOT=$(pwd)/caravel -export IMAGE_NAME=efabless/openlane:$OPENLANE_TAG -export PDK_ROOT=$(pwd)/pdks - -cd $UPRJ_ROOT || exit - -# Install full version of caravel -git clone --depth=1 https://github.com/efabless/caravel $CARAVEL_ROOT - -make install_mcw - -docker run -v $UPRJ_ROOT:$UPRJ_ROOT -v $PDK_ROOT:$PDK_ROOT -v $CARAVEL_ROOT:$CARAVEL_ROOT -e UPRJ_ROOT=$UPRJ_ROOT -e PDK_ROOT=$PDK_ROOT -e CARAVEL_ROOT=$CARAVEL_ROOT -u $(id -u $USER):$(id -g $USER) $IMAGE_NAME bash -c "cd $CARAVEL_ROOT; make uncompress; cd $UPRJ_ROOT; make -f $CARAVEL_ROOT/Makefile ship;" - -SHIP_FILE=$UPRJ_ROOT/gds/caravel.gds - -if test -f "$SHIP_FILE"; then - exit 0 -else - exit 2 -fi diff --git a/.github/scripts/build_pdk.sh b/.github/scripts/build_pdk.sh deleted file mode 100644 index 8317b6a..0000000 --- a/.github/scripts/build_pdk.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 -git clone --depth=1 https://github.com/efabless/caravel-lite.git - -export HOME=$(pwd) -cd .. -export PDK_ROOT=$(pwd)/pdks && mkdir "$PDK_ROOT" -cd "$HOME"/caravel-lite/ || exit - -make skywater-pdk skywater-library open_pdks build-pdk gen-sources - -exit 0 diff --git a/.github/scripts/dv/run-dv-wrapper.sh b/.github/scripts/dv/run-dv-wrapper.sh deleted file mode 100755 index c602fea..0000000 --- a/.github/scripts/dv/run-dv-wrapper.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/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) -export CARAVEL_ROOT=$(pwd)/caravel - -if [ ! -d $TARGET_PATH ]; then - echo "Directory target /path/to/dir DOES NOT exists." - exit 9999 -fi - -cd .. - -export PDK_ROOT=$(pwd)/pdks -if [ ! -d $PDK_ROOT ]; then - echo "Directory pdk /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_ROOT:$PDK_ROOT \ - -v $CARAVEL_ROOT:$CARAVEL_ROOT \ - -e TARGET_PATH=$TARGET_PATH -e PDK_ROOT=$PDK_ROOT \ - -e CARAVEL_ROOT=$CARAVEL_ROOT \ - -u $(id -u $USER):$(id -g $USER) efabless/dv_setup:latest \ - bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_ROOT $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 diff --git a/.github/scripts/dv/run-dv.sh b/.github/scripts/dv/run-dv.sh deleted file mode 100755 index 99fcd74..0000000 --- a/.github/scripts/dv/run-dv.sh +++ /dev/null @@ -1,39 +0,0 @@ -PDK_ROOT=$1 -DV_PATH=$2 -DV_TEST_ID=$3 -SIM_MODE=$4 - -cd $DV_PATH || exit - -## 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 || exit -echo $(pwd) -make 2>&1 | tee $logFile -grep "Monitor" $logFile >>$OUT_FILE -make clean - -echo "Execution Done on $PATTERN !" - -cat $OUT_FILE - -exit 0 diff --git a/.github/scripts/install_magic.sh b/.github/scripts/install_magic.sh deleted file mode 100644 index ca91137..0000000 --- a/.github/scripts/install_magic.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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 -sudo apt-get install -y csh freeglut3-dev libncurses5-dev libncursesw5-dev libglu1-mesa-dev libx11-dev mesa-common-dev tcl tcl-dev tk tk-dev - -git clone --depth=1 --branch 8.3.265 https://github.com/RTimothyEdwards/magic.git -cd magic || exit -sudo ./configure --disable-locking --prefix=/usr CFLAGS='-g -O0 -m64 -fPIC' -sudo make -j4 -sudo make install - -exit 0 diff --git a/.github/scripts/run_precheck.sh b/.github/scripts/run_precheck.sh deleted file mode 100644 index 16091a6..0000000 --- a/.github/scripts/run_precheck.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/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 INPUT_DIRECTORY=$(pwd) -export PRECHECK_ROOT=$INPUT_DIRECTORY/mpw_precheck -export OUTPUT_DIRECTORY=$INPUT_DIRECTORY/mpw_precheck_result -export OUTPUT=$OUTPUT_DIRECTORY/logs/precheck.log -cd .. -export PDK_ROOT=$(pwd)/pdks -cd "$PRECHECK_ROOT" || exit - -docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" -v "$PDK_ROOT":"$PDK_ROOT" -e INPUT_DIRECTORY="$INPUT_DIRECTORY" -e PDK_ROOT="$PDK_ROOT" -u $(id -u "$USER"):$(id -g "$USER") efabless/mpw_precheck:latest bash -c "cd $PRECHECK_ROOT; python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_root $PDK_ROOT --output_directory $OUTPUT_DIRECTORY license makefile consistency xor magic_drc klayout_beol klayout_feol klayout_met_min_ca_density klayout_offgrid klayout_pin_label_purposes_overlapping_drawing klayout_zeroarea" - - -cnt=$(grep -c "All Checks Passed" "$OUTPUT") -if ! [[ $cnt ]]; then cnt=0; fi -if [[ $cnt -eq 1 ]]; then exit 0; fi - -exit 2 diff --git a/.github/workflows/caravel_build.yml b/.github/workflows/caravel_build.yml deleted file mode 100644 index d9cadb3..0000000 --- a/.github/workflows/caravel_build.yml +++ /dev/null @@ -1,53 +0,0 @@ -# name: Caravel Build - -# on: -# # Runs on Every Push -# push: -# # Runs on Pull Requests -# pull_request: -# workflow_dispatch: - -# jobs: -# make_ship: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 - -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v1 - -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v1 - -# - name: Install Magic -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/install_magic.sh - -# - name: Build PDK -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/build_pdk.sh - -# - name: Run make ship -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/build/run-ship.sh -# env: -# OPENLANE_TAG: 2021.12.17_05.07.41 - -# set_user_id: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 - -# - name: Set up QEMU -# uses: docker/setup-qemu-action@v1 - -# - name: Set up Docker Buildx -# uses: docker/setup-buildx-action@v1 - -# - name: Install Magic -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/install_magic.sh - -# - name: Build PDK -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/build_pdk.sh - -# - name: Run Set User ID -# run: bash ${GITHUB_WORKSPACE}/.github/scripts/build/run-set-id.sh -# env: -# OPENLANE_TAG: 2021.09.16_03.28.21 diff --git a/.github/workflows/user_project_ci.yml b/.github/workflows/user_project_ci.yml index d966d14..cbd9563 100644 --- a/.github/workflows/user_project_ci.yml +++ b/.github/workflows/user_project_ci.yml @@ -8,8 +8,7 @@ on: workflow_dispatch: jobs: - precheck: - timeout-minutes: 720 + pdk: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -20,62 +19,127 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Install Magic - run: bash ${GITHUB_WORKSPACE}/.github/scripts/install_magic.sh + - name: Export PDK ROOT + run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV - - name: Build PDK - run: bash ${GITHUB_WORKSPACE}/.github/scripts/build_pdk.sh + - name: Install dependencies + run: | + sudo mkdir -p ${{ env.PDK_ROOT }} + sudo chown -R $USER:$USER ${{ env.PDK_ROOT }} + make install + make pdk - - name: Install The Precheck - run: git clone --depth=1 https://github.com/efabless/mpw_precheck.git ${GITHUB_WORKSPACE}/mpw_precheck + - name: Tarball PDK + run: | + tar -cf /tmp/sky130A.tar -C $PDK_ROOT/sky130A . - - name: Run The Precheck - run: bash ${GITHUB_WORKSPACE}/.github/scripts/run_precheck.sh + - name: Upload PDK Tarball + uses: actions/upload-artifact@v2 + with: + name: pdk-tarball + path: /tmp/sky130A.tar - # dv_rtl: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v1 + mpw_precheck: + timeout-minutes: 720 + runs-on: ubuntu-latest + needs: [pdk] + steps: + - uses: actions/checkout@v2 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v1 + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - # - name: Install Magic - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/install_magic.sh + - name: Export PDK ROOT + run: | + echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV - # - name: Build PDK - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/build_pdk.sh + - name: Download PDK Tarball + uses: actions/download-artifact@v2 + with: + name: pdk-tarball + path: /tmp - # - name: Install The Dockerized DV Setup - # run: docker pull efabless/dv_setup:latest + - name: Unpack PDK Tarball + run: | + sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A + sudo chown -R $USER:$USER ${{ env.PDK_ROOT }} + tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A . - # - name: Run DV tests - # # Run test number 0,1,2,3,4 in one job - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/dv/run-dv-wrapper.sh 0,1,2,3,4 RTL + - name: Run MPW-Precheck + run: | + export INPUT_DIRECTORY=$(pwd) + export PRECHECK_ROOT=$INPUT_DIRECTORY/mpw_precheck + export OUTPUT_DIRECTORY=$INPUT_DIRECTORY/mpw_precheck_result + export OUTPUT=$OUTPUT_DIRECTORY/logs/precheck.log - # dv_gl: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 + git clone --depth=1 -b mpw-5b https://github.com/efabless/mpw_precheck.git - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v1 + docker run -v "$PRECHECK_ROOT":"$PRECHECK_ROOT" -v "$INPUT_DIRECTORY":"$INPUT_DIRECTORY" -v "${{ env.PDK_ROOT }}":"${{ env.PDK_ROOT }}" -e INPUT_DIRECTORY="$INPUT_DIRECTORY" -e PDK_ROOT="${{ env.PDK_ROOT }}" -u $(id -u "$USER"):$(id -g "$USER") efabless/mpw_precheck:latest bash -c "cd $PRECHECK_ROOT; python3 mpw_precheck.py --input_directory $INPUT_DIRECTORY --pdk_root ${{ env.PDK_ROOT }} --output_directory $OUTPUT_DIRECTORY license makefile consistency xor magic_drc klayout_beol klayout_feol klayout_met_min_ca_density klayout_offgrid klayout_pin_label_purposes_overlapping_drawing klayout_zeroarea" - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v1 + cnt=$(grep -c "All Checks Passed" "$OUTPUT") + if ! [[ $cnt ]]; then cnt=0; fi + if [[ $cnt -eq 1 ]]; then exit 0; fi + exit 2 - # - name: Install Magic - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/install_magic.sh + user_project_flow: + timeout-minutes: 720 + runs-on: ubuntu-latest + needs: [pdk] + steps: + - uses: actions/checkout@v2 - # - name: Build PDK - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/build_pdk.sh + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - # - name: Install The Dockerized DV Setup - # run: docker pull efabless/dv_setup:latest + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - # - name: Run DV tests - # # Run test number 0,1,2,3,4 in one job - # run: bash ${GITHUB_WORKSPACE}/.github/scripts/dv/run-dv-wrapper.sh 0,1,2,3,4 GL + - name: Export PDK ROOT + run: echo "PDK_ROOT=/usr/local/pdk" >> $GITHUB_ENV + + - name: Export OPENLANE ROOT + run: echo "OPENLANE_ROOT=/home/runner/work/caravel_user_project/openlane" >> $GITHUB_ENV + + - name: Download PDK Tarball + uses: actions/download-artifact@v2 + with: + name: pdk-tarball + path: /tmp + + - name: Unpack PDK Tarball + run: | + sudo mkdir -p ${{ env.PDK_ROOT }}/sky130A + sudo chown -R $USER:$USER ${{ env.PDK_ROOT }} + tar -xf /tmp/sky130A.tar -C $PDK_ROOT/sky130A . + + - name: Install dependencies + run: | + make install + make install_mcw + make openlane + make simenv + + - name: Harden using Openlane + run: | + make user_proj_example + make user_project_wrapper + + - name: Run DV RTL tests + run: | + make verify-io_ports-rtl + make verify-la_test1-rtl + make verify-la_test2-rtl + make verify-mprj_stimulus-rtl + make verify-wb_port-rtl + + - name: Run DV GL tests + run: | + make verify-io_ports-gl + make verify-la_test1-gl + make verify-la_test2-gl + make verify-mprj_stimulus-gl + make verify-wb_port-gl diff --git a/Makefile b/Makefile index 6719339..e768a08 100644 --- a/Makefile +++ b/Makefile @@ -65,7 +65,7 @@ setup: install check-env install_mcw pdk openlane # Openlane blocks=$(shell cd openlane && find * -maxdepth 0 -type d) .PHONY: $(blocks) -$(blocks): +$(blocks): % : export CARAVEL_ROOT=$(CARAVEL_ROOT) && cd openlane && $(MAKE) $* dv_patterns=$(shell cd verilog/dv && find * -maxdepth 0 -type d) @@ -92,7 +92,16 @@ docker_run_verify=\ harden: $(blocks) .PHONY: verify -verify: $(dv-targets) +verify: $(dv-targets-rtl) + +.PHONY: verify-all-rtl +verify-all-rtl: $(dv-targets-rtl) + +.PHONY: verify-all-gl +verify-all-gl: $(dv-targets-gl) + +.PHONY: verify-all-gl-sdf +verify-all-gl-sdf: $(dv-targets-gl-sdf) $(dv-targets-rtl): SIM=RTL $(dv-targets-rtl): verify-%-rtl: $(dv_base_dependencies) @@ -158,7 +167,7 @@ uninstall: # Default installs to the user home directory, override by "export PRECHECK_ROOT=" .PHONY: precheck precheck: - @git clone --depth=1 --branch mpw-5a https://github.com/efabless/mpw_precheck.git $(PRECHECK_ROOT) + @git clone --depth=1 --branch $(MPW_TAG) https://github.com/efabless/mpw_precheck.git $(PRECHECK_ROOT) @docker pull efabless/mpw_precheck:latest .PHONY: run-precheck diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 051bcbf..a62dd7e 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -93,7 +93,7 @@ Starting your project make .. - For an example of hardening a project please refer to `user_project_example `_ + For an example of hardening a project please refer to `user_project_example `_ #. Integrate modules into the user_project_wrapper