Skip to content

Commit 30b7c59

Browse files
committed
feat(ut): compatible with released rtl
1 parent 5b05b7b commit 30b7c59

File tree

2 files changed

+34
-28
lines changed

2 files changed

+34
-28
lines changed

gen.sh

+29-25
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,51 @@
11
#!/bin/bash
22

3-
set -e
3+
# set -e
44

55
RELEASE_RTL=1 make test-top-ut-release
66
# RELEASE_RTL=1 MMIOBRIDGE_TOP=1 make test-top-ut
77

88
rtl_dir=$(pwd)/build/release/TestTop
99
gen_dir=$(pwd)/gen
10+
top_file=$gen_dir/TestTop.sv
1011
mkdir -p $gen_dir
1112

13+
cp $rtl_dir/*.sv $gen_dir
1214
cp $rtl_dir/*.v $gen_dir
1315
rm $gen_dir/ClockGate.v
1416

17+
set -e
18+
1519
cp $(pwd)/xs-issue-e-b-difftest-verilog/rtl $gen_dir -r
1620

1721
# Replace
18-
sed -i 's/TL2CHICoupledL2/bosc_TL2CHICoupledL2/g' $gen_dir/TestTop.v
22+
sed -i 's/TL2CHICoupledL2/bosc_TL2CHICoupledL2/g' $top_file
1923

2024
# Delete
21-
sed -i '/\.io_hartId(l2_nodes_io_hartId),/d' $gen_dir/TestTop.v
22-
sed -i '/\.io_pfCtrlFromCore_.*/d' $gen_dir/TestTop.v
23-
sed -i '/\.io_debugTopDown_.*/d' $gen_dir/TestTop.v
24-
sed -i '/\.io_l2_hint_bits_isGrantData.*/d' $gen_dir/TestTop.v
25-
sed -i '/\.io_l2_tlb_req_req_ready.*/d' $gen_dir/TestTop.v
26-
sed -i '/\.io_l2_tlb_req_req_kill.*/d' $gen_dir/TestTop.v
27-
sed -i '/\.io_l2_tlb_req_req_bits_isPrefetch.*/d' $gen_dir/TestTop.v
28-
sed -i '/\.io_l2_tlb_req_req_bits_size.*/d' $gen_dir/TestTop.v
29-
sed -i '/\.io_l2_tlb_req_resp_ready.*/d' $gen_dir/TestTop.v
30-
sed -i '/\.io_l2_tlb_req_resp_bits_paddr_0.*/d' $gen_dir/TestTop.v
31-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_gpf_st.*/d' $gen_dir/TestTop.v
32-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_gpf_instr.*/d' $gen_dir/TestTop.v
33-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_pf_st.*/d' $gen_dir/TestTop.v
34-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_pf_instr.*/d' $gen_dir/TestTop.v
35-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_af_st.*/d' $gen_dir/TestTop.v
36-
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_af_instr.*/d' $gen_dir/TestTop.v
37-
sed -i '/\.io_l2_tlb_req_pmp_resp_st.*/d' $gen_dir/TestTop.v
38-
sed -i '/\.io_l2_tlb_req_pmp_resp_instr.*/d' $gen_dir/TestTop.v
39-
sed -i '/\.io_l2_tlb_req_pmp_resp_atomic.*/d' $gen_dir/TestTop.v
25+
sed -i '/\.io_hartId.*\(.*\),/d' $top_file
26+
sed -i '/\.io_pfCtrlFromCore_.*/d' $top_file
27+
sed -i '/\.io_debugTopDown_.*/d' $top_file
28+
# sed -i '/\.io_l2_hint_bits_isGrantData.*/d' $top_file
29+
sed -i '/\.io_l2_tlb_req_req_ready.*/d' $top_file
30+
sed -i '/\.io_l2_tlb_req_req_kill.*/d' $top_file
31+
sed -i '/\.io_l2_tlb_req_req_bits_isPrefetch.*/d' $top_file
32+
sed -i '/\.io_l2_tlb_req_req_bits_size.*/d' $top_file
33+
sed -i '/\.io_l2_tlb_req_resp_ready.*/d' $top_file
34+
sed -i '/\.io_l2_tlb_req_resp_bits_paddr_0.*/d' $top_file
35+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_gpf_st.*/d' $top_file
36+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_gpf_instr.*/d' $top_file
37+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_pf_st.*/d' $top_file
38+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_pf_instr.*/d' $top_file
39+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_af_st.*/d' $top_file
40+
sed -i '/\.io_l2_tlb_req_resp_bits_excp_0_af_instr.*/d' $top_file
41+
sed -i '/\.io_l2_tlb_req_pmp_resp_st.*/d' $top_file
42+
sed -i '/\.io_l2_tlb_req_pmp_resp_instr.*/d' $top_file
43+
sed -i '/\.io_l2_tlb_req_pmp_resp_atomic.*/d' $top_file
4044

4145
# Append
42-
sed -i '/\.auto_in_0_a_bits_echo_isKeyword(l2_nodes_auto_in_0_a_bits_echo_isKeyword),/a .auto_in_0_a_bits_user_reqSource(0),' $gen_dir/TestTop.v
43-
sed -i '/\.auto_in_1_a_bits_echo_isKeyword(l2_nodes_auto_in_1_a_bits_echo_isKeyword),/a .auto_in_1_a_bits_user_reqSource(0),' $gen_dir/TestTop.v
44-
sed -i '/\.auto_in_2_a_bits_echo_isKeyword(l2_nodes_auto_in_2_a_bits_echo_isKeyword),/a .auto_in_2_a_bits_user_reqSource(0),' $gen_dir/TestTop.v
45-
sed -i '/\.auto_in_3_a_bits_echo_isKeyword(l2_nodes_auto_in_3_a_bits_echo_isKeyword),/a .auto_in_3_a_bits_user_reqSource(0),' $gen_dir/TestTop.v
46+
sed -i '/\.auto_in_0_a_bits_echo_isKeyword(l2_nodes_auto_in_0_a_bits_echo_isKeyword),/a .auto_in_0_a_bits_user_reqSource(0),' $top_file
47+
sed -i '/\.auto_in_1_a_bits_echo_isKeyword(l2_nodes_auto_in_1_a_bits_echo_isKeyword),/a .auto_in_1_a_bits_user_reqSource(0),' $top_file
48+
sed -i '/\.auto_in_2_a_bits_echo_isKeyword(l2_nodes_auto_in_2_a_bits_echo_isKeyword),/a .auto_in_2_a_bits_user_reqSource(0),' $top_file
49+
sed -i '/\.auto_in_3_a_bits_echo_isKeyword(l2_nodes_auto_in_3_a_bits_echo_isKeyword),/a .auto_in_3_a_bits_user_reqSource(0),' $top_file
4650

4751
echo "gen.sh Finish"

src/test/scala/chi/TestTopForUT.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ class CHIEmptyShell(splitFlit: Boolean)(implicit p: Parameters) extends TL2CHIL
165165
class TestTopForUT(numCores: Int = 1, numULAgents: Int = 1, banks: Int = 1, mmioBridgeTop: Boolean = false)(implicit p: Parameters) extends LazyModule
166166
with HasCHIMsgParameters {
167167

168+
val isReleaseRTL = sys.env.getOrElse("RELEASE_RTL", "0") == "1"
169+
168170
assert(numCores == 1)
169171

170172
override lazy val desiredName: String = "TestTop"
@@ -192,14 +194,14 @@ class TestTopForUT(numCores: Int = 1, numULAgents: Int = 1, banks: Int = 1, mmio
192194
masterNode
193195
}
194196

195-
val l1d_nodes = (0 until numCores).map(i => createClientNode(s"l1d$i", 64))
197+
val l1d_nodes = (0 until numCores).map(i => createClientNode(s"l1d$i", if(isReleaseRTL) 16 else 64))
196198
val l1i_nodes = (0 until numCores).map {i =>
197199
(0 until numULAgents).map { j =>
198200
TLClientNode(Seq(
199201
TLMasterPortParameters.v1(
200202
clients = Seq(TLMasterParameters.v1(
201203
name = s"l1i${i}_${j}",
202-
sourceId = IdRange(0, 63)
204+
sourceId = IdRange(0, (if(isReleaseRTL) 16 else 64) - 1)
203205
))
204206
)
205207
))
@@ -233,7 +235,7 @@ class TestTopForUT(numCores: Int = 1, numULAgents: Int = 1, banks: Int = 1, mmio
233235
TLMasterPortParameters.v1(
234236
clients = Seq(TLMasterParameters.v1(
235237
name = "cmo",
236-
sourceId = IdRange(0, 7),
238+
sourceId = IdRange(0, 8 - 1),
237239
)),
238240
requestFields = Nil
239241
)

0 commit comments

Comments
 (0)