blob: 8deec8802b747d43f0f22b5d60063b13f1e68a41 [file] [log] [blame]
manarabdelaty71c0e0a2021-04-08 17:03:47 +02001#!/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
18IDS=$1
19# simulation mode : RTL/GL
20SIM_MODE=$2
21
22DV_TEST_IDS=(${IDS//,/ })
23
24export TARGET_PATH=$(pwd)
25if [ ! -d $TARGET_PATH ]
26then
27 echo "Directory /path/to/dir DOES NOT exists."
28 exit 9999
29fi
30
31cd ..
32
33export PDK_PATH=$(pwd)/pdks/sky130A
34if [ ! -d $PDK_PATH ]
35then
36 echo "Directory /path/to/dir DOES NOT exists."
37 exit 9999
38fi
39
40DV_PATH=$TARGET_PATH/verilog/dv
41if [ ! -d $DV_PATH ]
42then
43 echo "Directory /path/to/dir DOES NOT exists."
44 exit 9999
45fi
46
47for id in "${DV_TEST_IDS[@]}"
48do
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
71done
72
73exit 0;