manarabdelaty | 71c0e0a | 2021-04-08 17:03:47 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # SPDX-FileCopyrightText: 2020 Efabless Corporation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # SPDX-License-Identifier: Apache-2.0 |
| 16 | |
| 17 | # comma seperated test ids |
| 18 | IDS=$1 |
| 19 | # simulation mode : RTL/GL |
| 20 | SIM_MODE=$2 |
| 21 | |
| 22 | DV_TEST_IDS=(${IDS//,/ }) |
| 23 | |
| 24 | export TARGET_PATH=$(pwd) |
| 25 | if [ ! -d $TARGET_PATH ] |
| 26 | then |
| 27 | echo "Directory /path/to/dir DOES NOT exists." |
| 28 | exit 9999 |
| 29 | fi |
| 30 | |
| 31 | cd .. |
| 32 | |
| 33 | export PDK_PATH=$(pwd)/pdks/sky130A |
| 34 | if [ ! -d $PDK_PATH ] |
| 35 | then |
| 36 | echo "Directory /path/to/dir DOES NOT exists." |
| 37 | exit 9999 |
| 38 | fi |
| 39 | |
| 40 | DV_PATH=$TARGET_PATH/verilog/dv |
| 41 | if [ ! -d $DV_PATH ] |
| 42 | then |
| 43 | echo "Directory /path/to/dir DOES NOT exists." |
| 44 | exit 9999 |
| 45 | fi |
| 46 | |
| 47 | for id in "${DV_TEST_IDS[@]}" |
| 48 | do |
| 49 | docker run -v $TARGET_PATH:$TARGET_PATH -v $PDK_PATH:$PDK_PATH \ |
| 50 | -e TARGET_PATH=$TARGET_PATH -e PDK_PATH=$PDK_PATH \ |
| 51 | -u $(id -u $USER):$(id -g $USER) efabless/dv_setup:latest \ |
| 52 | bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_PATH $DV_PATH $id $SIM_MODE" |
| 53 | |
| 54 | echo "DONE!" |
| 55 | |
| 56 | VERDICT_FILE=$TARGET_PATH/verilog/dv/$id.out |
| 57 | |
| 58 | if [ -f $VERDICT_FILE ]; then |
| 59 | cnt=$(grep "Pass" $VERDICT_FILE -s | wc -l) |
| 60 | if ! [[ $cnt ]]; then cnt = 0; fi |
| 61 | else |
| 62 | echo "DV check failed due to subscript failure. Please review the logs"; |
| 63 | exit 2; |
| 64 | fi |
| 65 | |
| 66 | echo "Verdict: $cnt" |
| 67 | |
| 68 | if [[ $cnt -ne 1 ]]; then |
| 69 | exit 2; |
| 70 | fi |
| 71 | done |
| 72 | |
| 73 | exit 0; |