Skip to content

Commit 07eceea

Browse files
author
Weiwei Li
committed
add support for cbo.zero in cmo extension
update CHANGELOG
1 parent 5a434be commit 07eceea

File tree

6 files changed

+609
-0
lines changed

6 files changed

+609
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG
22

3+
## [3.6.9] - 2023-06-25
4+
- Add support for Zicboz extension
5+
36
## [3.6.8] - 2023-06-22
47
- Fix broken hyperlink in README
58

coverage/rvi_cmo.cgf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# For Licence details look at https://github.com/riscv-software-src/riscv-ctg/-/blob/master/LICENSE.incore
2+
3+
cbozero:
4+
config:
5+
- check ISA:=regex(.*I.*Zicboz.*Zicsr.*)
6+
opcode:
7+
cbo.zero: 0
8+
rs1:
9+
<<: *all_regs_mx0
10+
val_comb:
11+
abstract_comb:
12+
'walking_ones("rs1_val", 12, False)': 0
13+
'walking_zeros("rs1_val", 12, False)': 0
14+
'uniform_random(10, 100, ["rs1_val"], [12])': 0

riscv-test-suite/env/arch_test.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,16 @@
144144
#define EXCPT_CAUSE_MSK ((1<<4)-1)
145145
#endif
146146

147+
// set defaults
148+
#ifndef RVMODEL_CBZ_BLOCKSIZE
149+
#define RVMODEL_CBZ_BLOCKSIZE 64
150+
#endif
151+
152+
// set defaults
153+
#ifndef RVMODEL_CMO_BLOCKSIZE
154+
#define RVMODEL_CMO_BLOCKSIZE 64
155+
#endif
156+
147157
//==========================================================================================
148158
// By default, it is defined as nop for the implementation that does not support Zifencei
149159
// Implementations that support Zifencei may use the fence.i instruction.

riscv-test-suite/env/test_macros.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,14 @@ nop ;\
391391
csrr flagreg, fcsr ;\
392392
RVTEST_SIGUPD_F(swreg,destreg,flagreg)
393393

394+
#define TEST_CBO_ZERO(swreg,rs1,inst,imm_val) ;\
395+
LI(rs1,imm_val&(RVMODEL_CBZ_BLOCKSIZE-1)) ;\
396+
add rs1,rs1,swreg ;\
397+
inst (rs1) ;\
398+
nop ;\
399+
nop ;\
400+
ADDI(swreg, swreg, RVMODEL_CBZ_BLOCKSIZE)
401+
394402
#define TEST_CSR_FIELD(ADDRESS,TEMP_REG,MASK_REG,NEG_MASK_REG,VAL,DEST_REG,OFFSET,BASE_REG) ;\
395403
LI(TEMP_REG,VAL) ;\
396404
and TEMP_REG,TEMP_REG,MASK_REG ;\
Lines changed: 312 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,312 @@
1+
2+
// -----------
3+
// This file was generated by riscv_ctg (https://github.com/riscv-software-src/riscv-ctg)
4+
// version : 0.10.4
5+
// timestamp : Wed Feb 22 09:04:22 2023 GMT
6+
// usage : riscv_ctg \
7+
// -- cgf // --cgf /workspace/riscv-ctg/sample_cgfs/dataset.cgf \
8+
// --cgf /workspace/riscv-ctg/sample_cgfs/rv32i_cbo.cgf \
9+
\
10+
// -- xlen 32 \
11+
// --randomize \
12+
// -----------
13+
//
14+
// -----------
15+
// Copyright (c) 2020. RISC-V International. All rights reserved.
16+
// SPDX-License-Identifier: BSD-3-Clause
17+
// -----------
18+
//
19+
// This assembly file tests the cbo.zero instruction of the RISC-V RV32ZicbozZicsr extension for the cbozero covergroup.
20+
//
21+
#include "model_test.h"
22+
#include "arch_test.h"
23+
RVTEST_ISA("RV32IZicbozZicsr")
24+
25+
.section .text.init
26+
.globl rvtest_entry_point
27+
rvtest_entry_point:
28+
RVMODEL_BOOT
29+
RVTEST_CODE_BEGIN
30+
31+
#ifdef TEST_CASE_1
32+
33+
RVTEST_CASE(0,"//check ISA:=regex(.*I.*Zicboz.*Zicsr.*);def TEST_CASE_1=True;",cbozero)
34+
35+
RVTEST_SIGBASE(x2,signature_x2_1)
36+
37+
inst_0:
38+
// rs1==x30, rs1_val == 0x4a9
39+
// opcode: cbo.zero ; op1:x30; op1val:0x4a9
40+
TEST_CBO_ZERO(x2,x30,cbo.zero,0x4a9)
41+
42+
inst_1:
43+
// rs1==x9, rs1_val == 0xeb4
44+
// opcode: cbo.zero ; op1:x9; op1val:0xeb4
45+
TEST_CBO_ZERO(x2,x9,cbo.zero,0xeb4)
46+
47+
inst_2:
48+
// rs1==x22, rs1_val == 0xe8e
49+
// opcode: cbo.zero ; op1:x22; op1val:0xe8e
50+
TEST_CBO_ZERO(x2,x22,cbo.zero,0xe8e)
51+
52+
inst_3:
53+
// rs1==x27, rs1_val == 0x597
54+
// opcode: cbo.zero ; op1:x27; op1val:0x597
55+
TEST_CBO_ZERO(x2,x27,cbo.zero,0x597)
56+
57+
inst_4:
58+
// rs1==x16, rs1_val == 4094,
59+
// opcode: cbo.zero ; op1:x16; op1val:0xffe
60+
TEST_CBO_ZERO(x2,x16,cbo.zero,0xffe)
61+
62+
inst_5:
63+
// rs1==x12, rs1_val == 4093,
64+
// opcode: cbo.zero ; op1:x12; op1val:0xffd
65+
TEST_CBO_ZERO(x2,x12,cbo.zero,0xffd)
66+
67+
inst_6:
68+
// rs1==x21, rs1_val == 4091,
69+
// opcode: cbo.zero ; op1:x21; op1val:0xffb
70+
TEST_CBO_ZERO(x2,x21,cbo.zero,0xffb)
71+
72+
inst_7:
73+
// rs1==x28, rs1_val == 4087,
74+
// opcode: cbo.zero ; op1:x28; op1val:0xff7
75+
TEST_CBO_ZERO(x2,x28,cbo.zero,0xff7)
76+
77+
inst_8:
78+
// rs1==x25, rs1_val == 4079,
79+
// opcode: cbo.zero ; op1:x25; op1val:0xfef
80+
TEST_CBO_ZERO(x2,x25,cbo.zero,0xfef)
81+
82+
inst_9:
83+
// rs1==x6, rs1_val == 4063,
84+
// opcode: cbo.zero ; op1:x6; op1val:0xfdf
85+
TEST_CBO_ZERO(x2,x6,cbo.zero,0xfdf)
86+
87+
inst_10:
88+
// rs1==x1, rs1_val == 4031,
89+
// opcode: cbo.zero ; op1:x1; op1val:0xfbf
90+
TEST_CBO_ZERO(x2,x1,cbo.zero,0xfbf)
91+
92+
inst_11:
93+
// rs1==x4, rs1_val == 3967,
94+
// opcode: cbo.zero ; op1:x4; op1val:0xf7f
95+
TEST_CBO_ZERO(x2,x4,cbo.zero,0xf7f)
96+
97+
inst_12:
98+
// rs1==x7, rs1_val == 3839,
99+
// opcode: cbo.zero ; op1:x7; op1val:0xeff
100+
TEST_CBO_ZERO(x2,x7,cbo.zero,0xeff)
101+
102+
inst_13:
103+
// rs1==x3, rs1_val == 3583,
104+
// opcode: cbo.zero ; op1:x3; op1val:0xdff
105+
TEST_CBO_ZERO(x2,x3,cbo.zero,0xdff)
106+
107+
inst_14:
108+
// rs1==x18, rs1_val == 3071,
109+
// opcode: cbo.zero ; op1:x18; op1val:0xbff
110+
TEST_CBO_ZERO(x2,x18,cbo.zero,0xbff)
111+
112+
inst_15:
113+
// rs1==x10, rs1_val == 2047,
114+
// opcode: cbo.zero ; op1:x10; op1val:0x7ff
115+
TEST_CBO_ZERO(x2,x10,cbo.zero,0x7ff)
116+
117+
inst_16:
118+
// rs1==x8, rs1_val == 1,
119+
// opcode: cbo.zero ; op1:x8; op1val:0x1
120+
TEST_CBO_ZERO(x2,x8,cbo.zero,0x1)
121+
122+
inst_17:
123+
// rs1==x23, rs1_val == 2,
124+
// opcode: cbo.zero ; op1:x23; op1val:0x2
125+
TEST_CBO_ZERO(x2,x23,cbo.zero,0x2)
126+
127+
inst_18:
128+
// rs1==x13, rs1_val == 4,
129+
// opcode: cbo.zero ; op1:x13; op1val:0x4
130+
TEST_CBO_ZERO(x2,x13,cbo.zero,0x4)
131+
132+
inst_19:
133+
// rs1==x17, rs1_val == 8,
134+
// opcode: cbo.zero ; op1:x17; op1val:0x8
135+
TEST_CBO_ZERO(x2,x17,cbo.zero,0x8)
136+
137+
inst_20:
138+
// rs1==x31, rs1_val == 16,
139+
// opcode: cbo.zero ; op1:x31; op1val:0x10
140+
TEST_CBO_ZERO(x2,x31,cbo.zero,0x10)
141+
142+
inst_21:
143+
// rs1==x29, rs1_val == 32,
144+
// opcode: cbo.zero ; op1:x29; op1val:0x20
145+
TEST_CBO_ZERO(x2,x29,cbo.zero,0x20)
146+
147+
inst_22:
148+
// rs1==x11, rs1_val == 64,
149+
// opcode: cbo.zero ; op1:x11; op1val:0x40
150+
TEST_CBO_ZERO(x2,x11,cbo.zero,0x40)
151+
152+
inst_23:
153+
// rs1==x5, rs1_val == 128,
154+
// opcode: cbo.zero ; op1:x5; op1val:0x80
155+
TEST_CBO_ZERO(x2,x5,cbo.zero,0x80)
156+
157+
inst_24:
158+
// rs1==x24, rs1_val == 256,
159+
// opcode: cbo.zero ; op1:x24; op1val:0x100
160+
TEST_CBO_ZERO(x2,x24,cbo.zero,0x100)
161+
162+
inst_25:
163+
// rs1==x15, rs1_val == 512,
164+
// opcode: cbo.zero ; op1:x15; op1val:0x200
165+
TEST_CBO_ZERO(x2,x15,cbo.zero,0x200)
166+
167+
inst_26:
168+
// rs1==x14, rs1_val == 1024,
169+
// opcode: cbo.zero ; op1:x14; op1val:0x400
170+
TEST_CBO_ZERO(x2,x14,cbo.zero,0x400)
171+
172+
inst_27:
173+
// rs1==x19, rs1_val == 2048,
174+
// opcode: cbo.zero ; op1:x19; op1val:0x800
175+
TEST_CBO_ZERO(x2,x19,cbo.zero,0x800)
176+
RVTEST_SIGBASE(x1,signature_x1_0)
177+
178+
inst_28:
179+
// rs1==x20, rs1_val == 0xc93
180+
// opcode: cbo.zero ; op1:x20; op1val:0xc93
181+
TEST_CBO_ZERO(x1,x20,cbo.zero,0xc93)
182+
183+
inst_29:
184+
// rs1==x26, rs1_val == 0xb31
185+
// opcode: cbo.zero ; op1:x26; op1val:0xb31
186+
TEST_CBO_ZERO(x1,x26,cbo.zero,0xb31)
187+
188+
inst_30:
189+
// rs1==x2, rs1_val == 0xddf
190+
// opcode: cbo.zero ; op1:x2; op1val:0xddf
191+
TEST_CBO_ZERO(x1,x2,cbo.zero,0xddf)
192+
193+
inst_31:
194+
// rs1_val == 0x384
195+
// opcode: cbo.zero ; op1:x31; op1val:0x384
196+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x384)
197+
198+
inst_32:
199+
// rs1_val == 0x3e1
200+
// opcode: cbo.zero ; op1:x31; op1val:0x3e1
201+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x3e1)
202+
203+
inst_33:
204+
// rs1_val == 0x290
205+
// opcode: cbo.zero ; op1:x31; op1val:0x290
206+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x290)
207+
208+
inst_34:
209+
// rs1_val == 0xe97
210+
// opcode: cbo.zero ; op1:x31; op1val:0xe97
211+
TEST_CBO_ZERO(x1,x31,cbo.zero,0xe97)
212+
213+
inst_35:
214+
// rs1_val == 0x86d
215+
// opcode: cbo.zero ; op1:x31; op1val:0x86d
216+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x86d)
217+
218+
inst_36:
219+
// rs1_val == 0x188
220+
// opcode: cbo.zero ; op1:x31; op1val:0x188
221+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x188)
222+
223+
inst_37:
224+
// rs1_val == 0x68b
225+
// opcode: cbo.zero ; op1:x31; op1val:0x68b
226+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x68b)
227+
228+
inst_38:
229+
// rs1_val == 0xabb
230+
// opcode: cbo.zero ; op1:x31; op1val:0xabb
231+
TEST_CBO_ZERO(x1,x31,cbo.zero,0xabb)
232+
233+
inst_39:
234+
// rs1_val == 0x759
235+
// opcode: cbo.zero ; op1:x31; op1val:0x759
236+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x759)
237+
238+
inst_40:
239+
// rs1_val == 0x9e6
240+
// opcode: cbo.zero ; op1:x31; op1val:0x9e6
241+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x9e6)
242+
243+
inst_41:
244+
// rs1_val == 0x686
245+
// opcode: cbo.zero ; op1:x31; op1val:0x686
246+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x686)
247+
248+
inst_42:
249+
// rs1_val == 0x5b5
250+
// opcode: cbo.zero ; op1:x31; op1val:0x5b5
251+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x5b5)
252+
253+
inst_43:
254+
// rs1_val == 0x481
255+
// opcode: cbo.zero ; op1:x31; op1val:0x481
256+
TEST_CBO_ZERO(x1,x31,cbo.zero,0x481)
257+
#endif
258+
259+
260+
RVTEST_CODE_END
261+
RVMODEL_HALT
262+
263+
RVTEST_DATA_BEGIN
264+
.align 4
265+
rvtest_data:
266+
.word 0xbabecafe
267+
.word 0xabecafeb
268+
.word 0xbecafeba
269+
.word 0xecafebab
270+
RVTEST_DATA_END
271+
272+
RVMODEL_DATA_BEGIN
273+
rvtest_sig_begin:
274+
sig_begin_canary:
275+
CANARY;
276+
277+
278+
279+
signature_x2_0:
280+
.fill 0*((RVMODEL_CBZ_BLOCKSIZE)/4),4,0xdeadbeef
281+
282+
283+
signature_x2_1:
284+
.fill 28*((RVMODEL_CBZ_BLOCKSIZE)/4),4,0xdeadbeef
285+
286+
287+
signature_x1_0:
288+
.fill 16*((RVMODEL_CBZ_BLOCKSIZE)/4),4,0xdeadbeef
289+
290+
#ifdef rvtest_mtrap_routine
291+
tsig_begin_canary:
292+
CANARY;
293+
294+
mtrap_sigptr:
295+
.fill 64*XLEN/32,4,0xdeadbeef
296+
297+
tsig_end_canary:
298+
CANARY;
299+
#endif
300+
301+
#ifdef rvtest_gpr_save
302+
303+
gpr_save:
304+
.fill 32*XLEN/32,4,0xdeadbeef
305+
306+
#endif
307+
308+
309+
sig_end_canary:
310+
CANARY;
311+
rvtest_sig_end:
312+
RVMODEL_DATA_END

0 commit comments

Comments
 (0)