Skip to content

Commit bfeff28

Browse files
Merge pull request #962 from pascalgouedo/dev_dd_pgo_lec
Added possibility to make lec between v2 versions.
2 parents bee163c + 3654122 commit bfeff28

File tree

5 files changed

+169
-40
lines changed

5 files changed

+169
-40
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ revised.src
2424
cadence_conformal
2525
synopsys_formality
2626
questa_autocheck
27+
slec/reports

scripts/slec/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,21 @@ From a bash shell using LEC, please execute:
5959
setenv GOLDEN_RTL YOUR_GOLDEN_CORE_RTL_PATH
6060
```
6161

62+
### Additional improvements for v2
63+
64+
To be able to make LEC checks between v2 versions, the scripts have been augmented with additional optional switches:
65+
* for RTL version : -v v1 or v2
66+
* for PULP instructions selection : -x 0 or 1
67+
* for FPU instructions selection : -f 0 or 1
68+
* for ZFINX selection : -z 0 or 1
69+
70+
When those options are not used, present behavior is happenning, meaning verifying local RTL files with `cv32e40p_v1.0.0` tag.
71+
When v2 option is selected, `cv32e40p_top` is used as a top module, including both `cv32e40p_core` and `CVFPU`.
72+
CAUTION : Right now dev branch is cloned as a golden reference when v2 version is used. It will have to be changed to `cv32e40p_v2.0.0` tag after CV32E40Pv2 RTL freeze.
73+
74+
From a bash shell using LEC, please execute:
75+
76+
```
77+
./run.sh -t synopsys -p lec -v v2 -x 1 -f 1
78+
```
79+

scripts/slec/cadence/lec.tcl

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
1-
// Copyright 2021 OpenHW Group
1+
// Copyright 2024 OpenHW Group and Dolphin Design
2+
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
23
//
3-
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
4-
// you may not use this file except in compliance with the License.
4+
// Licensed under the Solderpad Hardware License v 2.1 (the “License”);
5+
// you may not use this file except in compliance with the License, or,
6+
// at your option, the Apache License version 2.0.
57
// You may obtain a copy of the License at
68
//
7-
// https://solderpad.org/licenses/
9+
// https://solderpad.org/licenses/SHL-2.1/
810
//
9-
// Unless required by applicable law or agreed to in writing, software
10-
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// Unless required by applicable law or agreed to in writing, any work
12+
// distributed under the License is distributed on an AS IS BASIS,
1113
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1214
// See the License for the specific language governing permissions and
1315
// limitations under the License.
16+
1417
set summary_log $::env(summary_log)
1518
set top_module $::env(top_module)
19+
set version $::env(version)
20+
set pulp_cfg $::env(pulp_cfg)
21+
set fpu_cfg $::env(fpu_cfg)
22+
set zfinx_cfg $::env(zfinx_cfg)
23+
24+
if {"$version" == "v1"} {
25+
set golden_parameter_list "-parameter PULP_XPULP 0 -parameter FPU 0 -parameter PULP_ZFINX 0"
26+
} else {
27+
set golden_parameter_list "-parameter COREV_PULP $pulp_cfg -parameter FPU $fpu_cfg -parameter ZFINX $zfinx_cfg"
28+
}
1629

17-
read_design -SV -replace -noelaborate -golden -File ./golden.src
30+
read_design -SV09 -replace -noelaborate -golden -File ./golden.src
1831

19-
elaborate_design -golden
32+
elaborate_design -golden -root $top_module $golden_parameter_list
2033

21-
read_design -SV -replace -noelaborate -revised -File ./revised.src
34+
read_design -SV09 -replace -noelaborate -revised -File ./revised.src
2235

23-
elaborate_design -revised
36+
elaborate_design -revised -root $top_module -parameter COREV_PULP $pulp_cfg -parameter FPU $fpu_cfg -parameter ZFINX $zfinx_cfg
2437

2538
report_design_data
2639

27-
add_ignored_outputs apu_req_o -Both
28-
add_ignored_outputs apu_operands_o* -Both
29-
add_ignored_outputs apu_op_o* -Both
30-
add_ignored_outputs apu_flags_o* -Both
40+
if {"$top_module" == "cv32e40p_core"} {
41+
add_ignored_outputs apu_req_o -Both
42+
add_ignored_outputs apu_operands_o* -Both
43+
add_ignored_outputs apu_op_o* -Both
44+
add_ignored_outputs apu_flags_o* -Both
45+
}
3146

3247
write_hier_compare_dofile hier_compare_r2r.do -constraint -replace
3348

scripts/slec/run.sh

Lines changed: 81 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#!/bin/bash
22

3-
# Copyright 2023 OpenHW Group
3+
# Copyright 2024 OpenHW Group and Dolphin Design
4+
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
45
#
5-
# Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
6-
# you may not use this file except in compliance with the License.
6+
# Licensed under the Solderpad Hardware License v 2.1 (the “License”);
7+
# you may not use this file except in compliance with the License, or,
8+
# at your option, the Apache License version 2.0.
79
# You may obtain a copy of the License at
810
#
9-
# https://solderpad.org/licenses/
11+
# https://solderpad.org/licenses/SHL-2.1/
1012
#
11-
# Unless required by applicable law or agreed to in writing, software
12-
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# Unless required by applicable law or agreed to in writing, any work
14+
# distributed under the License is distributed on an AS IS BASIS,
1315
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1416
# See the License for the specific language governing permissions and
1517
# limitations under the License.
1618

1719
usage() { # Function: Print a help message.
18-
echo "Usage: $0 [ -t {cadence,synopsys,siemens} -p {sec,lec} ]" 1>&2
20+
echo "Usage: $0 -t {cadence,synopsys,siemens} -p {sec,lec} [-v {v1,v2}] [-x {0,1}] [-f {0,1}] [-z {0,1}]]" 1>&2
21+
echo "For v2 : if f or z is 1 then p must be 1" 1>&2
22+
echo " if z is 1 then f must be 1" 1>&2
1923
}
2024

2125
exit_abnormal() { # Function: Exit with error.
@@ -32,7 +36,12 @@ print_log() {
3236
echo "[LOG] $1"
3337
}
3438

35-
while getopts "t:p:" flag
39+
VERSION=v1
40+
PULP_CFG=0
41+
FPU_CFG=0
42+
ZFINX_CFG=0
43+
44+
while getopts "t:p:v:x:f:z:" flag
3645
do
3746
case "${flag}" in
3847
t)
@@ -41,6 +50,18 @@ do
4150
p)
4251
target_process=${OPTARG}
4352
;;
53+
v)
54+
VERSION=${OPTARG}
55+
;;
56+
x)
57+
PULP_CFG=${OPTARG}
58+
;;
59+
f)
60+
FPU_CFG=${OPTARG}
61+
;;
62+
z)
63+
ZFINX_CFG=${OPTARG}
64+
;;
4465
:)
4566
exit_abnormal
4667
;;
@@ -61,25 +82,63 @@ if [[ "${target_process}" != "sec" && "${target_process}" != "lec" ]]; then
6182
exit_abnormal
6283
fi
6384

85+
if [[ "${VERSION}" != "v1" && "${VERSION}" != "v2" ]]; then
86+
exit_abnormal
87+
elif [[ "${VERSION}" == "v1" && ("${PULP_CFG}" != "0" || "${FPU_CFG}" != "0" || "${ZFINX_CFG}" != "0") ]]; then
88+
exit_abnormal
89+
fi
90+
91+
if [[ "${PULP_CFG}" != 0 && "${PULP_CFG}" != 1 ]]; then
92+
exit_abnormal
93+
fi
94+
95+
if [[ "${FPU_CFG}" != 0 && "${FPU_CFG}" != 1 ]]; then
96+
exit_abnormal
97+
fi
98+
99+
if [[ "${ZFINX_CFG}" != 0 && "${ZFINX_CFG}" != 1 ]]; then
100+
exit_abnormal
101+
fi
102+
103+
if [[ (("${PULP_CFG}" == 0 && ("${FPU_CFG}" == 1 || "${ZFINX_CFG}" == 1)) || ("${PULP_CFG}" == 1 && "${FPU_CFG}" == 0 && "${ZFINX_CFG}" == 1)) ]]; then
104+
exit_abnormal
105+
fi
106+
107+
if [[ "${VERSION}" == "v1" ]]; then
108+
REF_BRANCH=cv32e40p_v1.0.0
109+
TOP_MODULE=cv32e40p_core
110+
else
111+
REF_BRANCH=dev
112+
TOP_MODULE=cv32e40p_top
113+
fi
114+
115+
export top_module=${TOP_MODULE}
116+
export version=${VERSION}
117+
export pulp_cfg=${PULP_CFG}
118+
export fpu_cfg=${FPU_CFG}
119+
export zfinx_cfg=${ZFINX_CFG}
120+
64121
if [ -z "${REF_REPO}" ]; then
65122
print_log "Empty REF_REPO env variable"
66123
REF_REPO=https://github.com/openhwgroup/cv32e40p.git
67124
REF_FOLDER=ref_design
68-
REF_BRANCH=cv32e40p_v1.0.0
69125
print_log " * Setting REF_REPO ${REF_REPO}"
70126
print_log " * Setting REF_FOLDER ${REF_FOLDER}"
71127
print_log " * Setting REF_BRANCH ${REF_BRANCH}"
128+
print_log " * Setting TOP_MODULE ${TOP_MODULE}"
72129
fi
73130

74131
RTL_FOLDER=$(readlink -f ../..)
75132

76-
FLIST=cv32e40p_manifest.flist
133+
if [[ "${PULP_CFG}" == 0 && "${ZFINX_CFG}" == 0 ]]; then
134+
FLIST=cv32e40p_manifest.flist
135+
else
136+
FLIST=cv32e40p_fpu_manifest.flist
137+
fi
77138

78139
if [[ -z "${TOP_MODULE}" ]]; then
79140
print_log "Empty TOP_MODULE env variable"
80-
TOP_MODULE=cv32e40p_core
81141
print_log " * Setting TOP_MODULE ${TOP_MODULE}"
82-
export top_module=${TOP_MODULE}
83142
fi
84143

85144
if [ ! -d ./reports/ ]; then
@@ -88,11 +147,10 @@ fi
88147

89148
if [[ -z "${GOLDEN_RTL}" ]]; then
90149
print_log "The env variable GOLDEN_RTL is empty."
91-
if [ ! -d "./${REF_FOLDER}" ]; then
92-
print_log " * Cloning Golden Design...."
93-
git clone $REF_REPO --single-branch -b $REF_BRANCH $REF_FOLDER;
94-
git -C ${REF_FOLDER} checkout $REF_COMMIT
95-
fi
150+
\rm -rf "./${REF_FOLDER}"
151+
print_log " * Cloning Golden Design...."
152+
git clone $REF_REPO --single-branch -b $REF_BRANCH $REF_FOLDER;
153+
git -C ${REF_FOLDER} checkout $REF_COMMIT
96154
export GOLDEN_RTL=$(pwd)/${REF_FOLDER}/rtl
97155
else
98156
print_log "${target_process^^}: Using ${GOLDEN_RTL} as reference design"
@@ -104,9 +162,13 @@ REVISED_FLIST=$(pwd)/revised.src
104162
GOLDEN_DIR=$(readlink -f ./${REF_FOLDER}/)
105163
GOLDEN_FLIST=$(pwd)/golden.src
106164

107-
var_golden_rtl=$(awk '{ if ($0 ~ "{DESIGN_RTL_DIR}" && $0 !~ "#" && $0 !~ "tracer" && $0 !~ "wrapper") print $0 }' ${GOLDEN_DIR}/$FLIST | sed 's|${DESIGN_RTL_DIR}|'"${GOLDEN_DIR}"'/rtl/|')
165+
var_golden_rtl=$(awk '{ if ($0 ~ "{DESIGN_RTL_DIR}" && $0 !~ "#" && $0 !~ "tracer" && $0 !~ "tb_wrapper" && $0 !~ "cv32e40p_wrapper") print $0 }' ${GOLDEN_DIR}/$FLIST | sed 's|${DESIGN_RTL_DIR}|'"${GOLDEN_DIR}"'/rtl/|')
108166

109-
var_revised_rtl=$(awk '{ if ($0 ~ "{DESIGN_RTL_DIR}" && $0 !~ "#" && $0 !~ "tracer" && $0 !~ "wrapper" && $0 !~ "_top") print $0 }' ${REVISED_DIR}/$FLIST | sed 's|${DESIGN_RTL_DIR}|'"${REVISED_DIR}"'/rtl/|')
167+
if [[ "${VERSION}" == "v1" ]]; then
168+
var_revised_rtl=$(awk '{ if ($0 ~ "{DESIGN_RTL_DIR}" && $0 !~ "#" && $0 !~ "tracer" && $0 !~ "tb_wrapper" && $0 !~ "cv32e40p_wrapper" && $0 !~ "top") print $0 }' ${REVISED_DIR}/$FLIST | sed 's|${DESIGN_RTL_DIR}|'"${REVISED_DIR}"'/rtl/|')
169+
else
170+
var_revised_rtl=$(awk '{ if ($0 ~ "{DESIGN_RTL_DIR}" && $0 !~ "#" && $0 !~ "tracer" && $0 !~ "tb_wrapper") print $0 }' ${REVISED_DIR}/$FLIST | sed 's|${DESIGN_RTL_DIR}|'"${REVISED_DIR}"'/rtl/|')
171+
fi
110172

111173
print_log "Generating GOLDEN flist in path: ${GOLDEN_FLIST}"
112174
echo $var_golden_rtl > ${GOLDEN_FLIST}

scripts/slec/synopsys/lec.tcl

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,59 @@
1+
# Copyright 2024 OpenHW Group and Dolphin Design
2+
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
3+
#
4+
# Licensed under the Solderpad Hardware License v 2.1 (the “License”);
5+
# you may not use this file except in compliance with the License, or,
6+
# at your option, the Apache License version 2.0.
7+
# You may obtain a copy of the License at
8+
#
9+
# https://solderpad.org/licenses/SHL-2.1/
10+
#
11+
# Unless required by applicable law or agreed to in writing, any work
12+
# distributed under the License is distributed on an “AS IS” BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
117
set synopsys_auto_setup true
218
set summary_log $::env(summary_log)
319
set top_module $::env(top_module)
20+
set version $::env(version)
21+
set pulp_cfg $::env(pulp_cfg)
22+
set fpu_cfg $::env(fpu_cfg)
23+
set zfinx_cfg $::env(zfinx_cfg)
24+
25+
set core_impl_name cv32e40p_core_COREV_PULP${pulp_cfg}_FPU${fpu_cfg}_ZFINX${zfinx_cfg}
26+
27+
if {"$version" == "v1"} {
28+
set golden_parameter_list "PULP_XPULP = 0, FPU = 0, PULP_ZFINX = 0"
29+
set core_ref_name cv32e40p_core_PULP_XPULP0_FPU0_PULP_ZFINX0
30+
} else {
31+
set golden_parameter_list "COREV_PULP = $pulp_cfg, FPU = $fpu_cfg, ZFINX = $zfinx_cfg"
32+
set core_ref_name $core_impl_name
33+
}
434

535
read_sverilog -container r -libname WORK -12 -f golden.src
6-
set_top r:/WORK/$top_module
36+
set_top r:/WORK/$top_module -parameter $golden_parameter_list
737

838
read_sverilog -container i -libname WORK -12 -f revised.src
9-
set_top i:/WORK/$top_module
39+
set_top i:/WORK/$top_module -parameter "COREV_PULP = $pulp_cfg, FPU = $fpu_cfg, ZFINX = $zfinx_cfg"
1040

1141
match > $summary_log.match.rpt
1242

1343
if {"$top_module" == "cv32e40p_core"} {
14-
set_dont_verify_point -type port i:WORK/cv32e40p_core/apu_req_o
15-
set_dont_verify_point -type port i:WORK/cv32e40p_core/apu_operands_o*
16-
set_dont_verify_point -type port i:WORK/cv32e40p_core/apu_op_o*
17-
set_dont_verify_point -type port i:WORK/cv32e40p_core/apu_flags_o*
44+
set_dont_verify_point -type port r:/WORK/$core_ref_name/apu_req_o
45+
set_dont_verify_point -type port r:/WORK/$core_ref_name/apu_operands_o*
46+
set_dont_verify_point -type port r:/WORK/$core_ref_name/apu_op_o*
47+
set_dont_verify_point -type port r:/WORK/$core_ref_name/apu_flags_o*
48+
set_dont_verify_point -type port i:/WORK/$core_impl_name/apu_req_o
49+
set_dont_verify_point -type port i:/WORK/$core_impl_name/apu_operands_o*
50+
set_dont_verify_point -type port i:/WORK/$core_impl_name/apu_op_o*
51+
set_dont_verify_point -type port i:/WORK/$core_impl_name/apu_flags_o*
1852
}
1953

2054
verify > $summary_log
2155

2256
report_aborted_points > $summary_log.aborted_points.rpt
2357
report_failing_points > $summary_log.failing_points.rpt
24-
analyze_points -failing >> $summary_log
2558

2659
exit

0 commit comments

Comments
 (0)