Skip to content

Commit 44393eb

Browse files
authoredMar 17, 2025
Logical Equivalence Checking with Yosys EQY (#287)
* [rtl] Changed the default number of performance counters from 0 to 10 (#214) * Implementation of sequential equivalence checking option using Yosys EQY. * [sec] Automatic removal of new IO when performing SEC against (current) golden design with Yosys EQY
1 parent 7472bc1 commit 44393eb

File tree

3 files changed

+66
-4
lines changed

3 files changed

+66
-4
lines changed
 

‎.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ modelsim.ini
3535

3636
# This is generated by Xcelium when running DV simulations, even with WAVE=0
3737
/dv/uvm/core_cve2/waves.shm
38+
39+
# This is generated by the sequential equivalent checking
40+
/scripts/sec/golden.src
41+
/scripts/sec/revised.src
42+
/scripts/sec/reports
43+
/scripts/sec/ref_design

‎scripts/sec/sec.sh

+18-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
usage() { # Function: Print a help message.
18-
echo "Usage: $0 [ -t {cadence,synopsys,mentor} ]" 1>&2
18+
echo "Usage: $0 [ -t {cadence,mentor,synopsys,yosys} ]" 1>&2
1919
}
2020
exit_abnormal() { # Function: Exit with error.
2121
usage
@@ -44,7 +44,8 @@ if [ ! -d ./reports/ ]; then
4444
mkdir -p ./reports/
4545
fi
4646

47-
if [[ "${target_tool}" != "cadence" && "${target_tool}" != "synopsys" && "${target_tool}" != "mentor" ]]; then
47+
if [[ "${target_tool}" != "cadence" && "${target_tool}" != "synopsys"
48+
&& "${target_tool}" != "mentor" && "${target_tool}" != "yosys" ]]; then
4849
exit_abnormal
4950
fi
5051

@@ -80,7 +81,7 @@ mkdir -p ${report_dir}
8081

8182
if [[ "${target_tool}" == "cadence" ]]; then
8283
tcl_script=$(readlink -f $(dirname "${BASH_SOURCE[0]}"))/cadence/sec.tcl
83-
jg -sec -proj ${report_dir} -batch -tcl ${tcl_script} -define report_dir ${report_dir} &> ${report_dir}/output.candence.log
84+
jg -sec -proj ${report_dir} -batch -tcl ${tcl_script} -define report_dir ${report_dir} &> ${report_dir}/output.cadence.log
8485

8586
if [ ! -f ${report_dir}/summary.cadence.log ]; then
8687
echo "Something went wrong during the process"
@@ -96,6 +97,20 @@ elif [[ "${target_tool}" == "synopsys" ]]; then
9697
elif [[ "${target_tool}" == "mentor" ]]; then
9798
echo "Mentor tool is not implemented yet"
9899
exit 1
100+
101+
elif [[ "${target_tool}" == "yosys" ]]; then
102+
echo "Using Yosys EQY"
103+
eqy -f yosys/sec.eqy -j $(($(nproc)/2)) -d ${report_dir} &> ${report_dir}/output.yosys.log
104+
rm yosys/golden_io.txt
105+
106+
if [ -f "${report_dir}/PASS" ]; then
107+
RESULT=0
108+
elif [ -f "${report_dir}/FAIL" ]; then
109+
RESULT=1
110+
else
111+
echo "Failed to run Yosys EQY"
112+
exit 1
113+
fi
99114
fi
100115

101116
if [[ $RESULT == 0 ]]; then
@@ -105,4 +120,3 @@ else
105120
echo "SEC: The DESIGN IS NOT SEQUENTIAL EQUIVALENT"
106121
exit 1
107122
fi
108-

‎scripts/sec/yosys/sec.eqy

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2025 OpenHW Group
2+
#
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.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://solderpad.org/licenses/
8+
#
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+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# To be ran as part of `./sec.sh -t yosys` from `scripts/sec`
16+
17+
[gold]
18+
plugin -i slang
19+
read_slang --ignore-assertions -DGOLD --top cve2_top -f ./golden.src
20+
21+
# Save the list of IO signals, in case the new revised version is different
22+
select -write yosys/golden_io.txt o:* i:*
23+
24+
[gate]
25+
plugin -i slang
26+
read_slang --ignore-assertions -DGATE --top cve2_top -f ./revised.src
27+
28+
29+
# Delete eventual new IO signals from the revised design from analysis
30+
select -set golden_io -read yosys/golden_io.txt
31+
select -set revised_io o:* i:*
32+
select -set excl_sigs @revised_io @golden_io %d
33+
delete @excl_sigs
34+
35+
[script]
36+
prep -top cve2_top
37+
memory_map
38+
39+
[strategy sat]
40+
use sat
41+
depth 5
42+

0 commit comments

Comments
 (0)