blob: f431eca954e82f8ec61de766434c0bd0bf603dad [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)
manarabdelatye542bdf2021-04-20 11:15:40 +020025export CARAVEL_ROOT=$(pwd)/caravel
manarabdelatyeb2b9032021-04-19 12:31:47 +020026
manarabdelaty71c0e0a2021-04-08 17:03:47 +020027if [ ! -d $TARGET_PATH ]
28then
29 echo "Directory /path/to/dir DOES NOT exists."
30 exit 9999
31fi
32
33cd ..
34
35export PDK_PATH=$(pwd)/pdks/sky130A
36if [ ! -d $PDK_PATH ]
37then
38 echo "Directory /path/to/dir DOES NOT exists."
39 exit 9999
40fi
41
42DV_PATH=$TARGET_PATH/verilog/dv
43if [ ! -d $DV_PATH ]
44then
45 echo "Directory /path/to/dir DOES NOT exists."
46 exit 9999
47fi
48
49for id in "${DV_TEST_IDS[@]}"
50do
51 docker run -v $TARGET_PATH:$TARGET_PATH -v $PDK_PATH:$PDK_PATH \
manarabdelatyeb2b9032021-04-19 12:31:47 +020052 -v $CARAVEL_ROOT:$CARAVEL_ROOT \
manarabdelaty71c0e0a2021-04-08 17:03:47 +020053 -e TARGET_PATH=$TARGET_PATH -e PDK_PATH=$PDK_PATH \
manarabdelatyeb2b9032021-04-19 12:31:47 +020054 -e CARAVEL_ROOT=$CARAVEL_ROOT \
manarabdelaty71c0e0a2021-04-08 17:03:47 +020055 -u $(id -u $USER):$(id -g $USER) efabless/dv_setup:latest \
56 bash -c "bash $TARGET_PATH/.github/scripts/dv/run-dv.sh $PDK_PATH $DV_PATH $id $SIM_MODE"
57
58 echo "DONE!"
59
60 VERDICT_FILE=$TARGET_PATH/verilog/dv/$id.out
61
62 if [ -f $VERDICT_FILE ]; then
63 cnt=$(grep "Pass" $VERDICT_FILE -s | wc -l)
64 if ! [[ $cnt ]]; then cnt = 0; fi
65 else
66 echo "DV check failed due to subscript failure. Please review the logs";
67 exit 2;
68 fi
69
70 echo "Verdict: $cnt"
71
72 if [[ $cnt -ne 1 ]]; then
73 exit 2;
74 fi
75done
76
Manare4eaf2c2021-04-19 19:21:32 +020077exit 0;