Skip to content

Commit 4e462f6

Browse files
authored
Merge pull request #848 from antmicro/add-cookbook
Add UVM Cookbook test results
2 parents bc4b8e6 + 4363dc1 commit 4e462f6

File tree

39 files changed

+6564
-2
lines changed

39 files changed

+6564
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
/*.robot
44

55
out
6+
!output-master/uvm-cookbook.xml
67

78
robot_tests

gen-tests

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ def skip_branch(branch):
2323

2424

2525
def skip_suite(suite):
26-
return suite in ["unsupported-signal-strengths", "functional-coverage"]
26+
skipped = ["unsupported-signal-strengths", "functional-coverage"]
27+
if not os.getenv('UVM_COOKBOOK'):
28+
skipped.append("uvm-cookbook")
29+
return suite in skipped
2730

2831

2932
def new_section():

output-master/uvm-cookbook.xml

Lines changed: 5859 additions & 0 deletions
Large diffs are not rendered by default.

scripts/test-cookbook

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [[ -z "${UVM_COOKBOOK}" ]]; then
5+
echo "Error: UVM_COOKBOOK environment variable is not set."
6+
echo "Set it to point to the directory containing UVM Cookbook examples."
7+
fi
8+
9+
if [[ -z "$1" ]]; then
10+
echo "Usage: $0 <test-directory>"
11+
exit 1
12+
fi
13+
14+
REPO_DIR=$(dirname $(cd $(dirname $0) && pwd))
15+
TEST_DIR="$REPO_DIR/tests/uvm-cookbook/$1"
16+
TEST_CONFIG="$TEST_DIR/test_config.sh"
17+
UVM_DIR="$REPO_DIR/third-party/uvm-2017/src"
18+
UVM_DIR_1_2="$REPO_DIR/third-party/uvm-1.2/src"
19+
export VERILATOR_ROOT="$REPO_DIR/$2"
20+
export PATH="$VERILATOR_ROOT/bin:$PATH"
21+
22+
if [[ ! -f "$TEST_CONFIG" ]]; then
23+
echo "Error: test_config.sh not found in $TEST_DIR"
24+
exit 1
25+
fi
26+
27+
# Setup configs
28+
GLOBAL_DISABLED_WARNINGS="\
29+
-Wno-ZERODLY \
30+
-Wno-SYMRSVDWORD \
31+
-Wno-style \
32+
-Wno-SIDEEFFECT \
33+
-Wno-NONSTD \
34+
-Wno-MULTITOP \
35+
-Wno-lint \
36+
-Wno-LATCH \
37+
-Wno-CONSTRAINTIGN \
38+
-Wno-REDEFMACRO \
39+
-Wno-INITIALDLY \
40+
-Wno-IGNOREDRETURN \
41+
-Wno-BLKANDNBLK \
42+
-Wno-TIMESCALEMOD \
43+
-Wno-COVERIGN"
44+
45+
GLOBAL_VERILATOR_FLAGS="\
46+
--binary \
47+
--Mdir verilator_obj_dir \
48+
--error-limit 15 \
49+
-j $(nproc) \
50+
+define+UVM_NO_DPI \
51+
+incdir+$UVM_DIR \
52+
$UVM_DIR/uvm_pkg.sv"
53+
54+
source "$TEST_CONFIG"
55+
TEST_DIR="$REPO_DIR/third-party/$UVM_COOKBOOK/uvm_code_examples/$TEST_NAME"
56+
57+
# Compose flags
58+
DISABLED_WARNINGS="$GLOBAL_DISABLED_WARNINGS $TEST_DISABLED_WARNINGS"
59+
VERILATOR_FLAGS="$GLOBAL_VERILATOR_FLAGS $TEST_VERILATOR_FLAGS"
60+
61+
echo "Running test: $TEST_NAME"
62+
63+
pushd "$TEST_DIR" >/dev/null
64+
65+
# Compile
66+
verilator \
67+
$VERILATOR_FLAGS \
68+
$DISABLED_WARNINGS \
69+
$SRC_FILES
70+
71+
# Run simulation
72+
args="${SIM_ARGS:-${SIM_ARGS_1:-}}"
73+
echo " sim run #1 args: '$args'"
74+
TEMPFILE=$(mktemp)
75+
./verilator_obj_dir/Vuvm_pkg $args | tee $TEMPFILE
76+
grep "TEST PASSED" $TEMPFILE -q
77+
78+
popd >/dev/null

templates/suite.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
*** Settings ***
22
Library Process
33
Suite Teardown Terminate All Processes kill=True
4-
Test Timeout 30 minutes
4+
Test Timeout 10 minutes
55

66
*** Test Cases ***
77
{{ test_cases }}

templates/uvm-cookbook.robot

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{ test }}
2+
[Tags] {{ tags }}
3+
${result} = Run Process scripts/test-cookbook {{ test }} {{ verilator_root }} stdout=out/{{ suite }}/{{ test }}/stdout.log stderr=STDOUT
4+
Log ${result.stdout}
5+
Run Keyword If ${result.rc}==-15 Set Tags Timeout
6+
Should Be Equal As Integers ${result.rc} 0
7+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
TEST_NAME="Uvm_ac_config_db/sim"
3+
4+
SRC_FILES="\
5+
+incdir+../sfr_agent \
6+
../sfr_agent/sfr_agent_pkg.sv \
7+
../sfr_agent/sfr_master_bfm.sv \
8+
../sfr_agent/sfr_monitor_bfm.sv \
9+
+incdir+../sfr_test_pkg \
10+
../sfr_test_pkg/sfr_test_pkg.sv \
11+
../tb/*.sv \
12+
../rtl/sfr_dut.sv"
13+
14+
# Test-specific flags
15+
TEST_VERILATOR_FLAGS=""
16+
SIM_ARGS="+UVM_TESTNAME=sfr_test"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
TEST_NAME="Uvm_alu_config_analysis/sim"
3+
4+
SRC_FILES="\
5+
+incdir+../agent \
6+
../agent/alu_agent_pkg.sv \
7+
../agent/alu_monitor_bfm.sv \
8+
../agent/alu_driver_bfm.sv \
9+
../alu/*.sv \
10+
+incdir+../uvm_tb \
11+
../uvm_tb/alu_tb_pkg.sv \
12+
../tb/*.sv"
13+
14+
# Test-specific flags
15+
TEST_VERILATOR_FLAGS="+define+UVM_NO_DPI"
16+
SIM_ARGS="+UVM_TESTNAME=test_all_parallel"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
TEST_NAME="Uvm_ef_vif_config_db/sim"
3+
4+
SRC_FILES="\
5+
+incdir+../sfr_agent \
6+
../sfr_agent/sfr_agent_pkg.sv \
7+
../sfr_agent/sfr_master_bfm.sv \
8+
../sfr_agent/sfr_monitor_bfm.sv \
9+
+incdir+../sfr_test_pkg \
10+
../sfr_test_pkg/sfr_test_pkg.sv \
11+
../tb/*.sv \
12+
../rtl/sfr_dut.sv"
13+
14+
# Test-specific flags
15+
TEST_VERILATOR_FLAGS=""
16+
SIM_ARGS="+UVM_TESTNAME=sfr_test"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
TEST_NAME="Uvm_messaging_example"
3+
4+
SRC_FILES="\
5+
messaging_example.sv"
6+
7+
# Test-specific flags
8+
TEST_VERILATOR_FLAGS="\
9+
--error-limit 5 \
10+
+define+UVM_REPORT_DISABLE_FILE_LINE \
11+
+define+SVA_ON"
12+
13+
SIM_ARGS=""
14+

0 commit comments

Comments
 (0)