Skip to content

Commit 88f90f5

Browse files
liweiweitrdthg
liweiwei
authored andcommitted
add support for cbo.zero
1 parent cd94912 commit 88f90f5

File tree

6 files changed

+60
-10
lines changed

6 files changed

+60
-10
lines changed

coverage/rv32i_cbo.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+
mnemonics:
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(20, 100, ["rs1_val"], [12])': 0

coverage/rv64i_cbo.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+
mnemonics:
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-ctg/CHANGELOG.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5-
65
Please note the header `WIP-DEV` is to always remain indicating the changes done on the dev branch.
76
Only when a release to the main branch is done, the contents of the WIP-DEV are put under a
87
versioned header while the `WIP-DEV` is left empty
98

9+
## [WIP-DEV]
10+
- Added support for zicboz extexnsion
11+
1012
## [0.12.2] - 2024-03-06
1113
- Add Zfa support. (PR#60)
1214
- Initial covergroups for Zvk* instructions (PR#61)
@@ -19,7 +21,7 @@ versioned header while the `WIP-DEV` is left empty
1921
- Add hardcoded register testcases to dataset.cgf and rv32im.cgf
2022
- Define rs1_val_data for c.ldsp in imc.yaml
2123
- Update "opcode" to "mnemonics" in the cgf files
22-
- Delete main.yml
24+
- Delete main.yml
2325
- Update test.yml for CI
2426
- Define rs1_val_data for instructions from zicfiss.cgf in template.yaml
2527
- Add "warning" in the verbose definition
@@ -30,7 +32,7 @@ versioned header while the `WIP-DEV` is left empty
3032
- Add unratified Zaamo subcomponent of A extension
3133
- Add unratified B extension
3234
- Fix issues with csr_comb
33-
- Minor fix in kslraw.u in rv32ip
35+
- Minor fix in kslraw.u in rv32ip
3436
- Fix incorrect 'sig:' entry in aes32dsi in template.yaml
3537
- Add sig and sz for instructions in template.yaml
3638
- Minor change of rd definition in c.lui in rv32ec
@@ -69,7 +71,7 @@ versioned header while the `WIP-DEV` is left empty
6971

7072
## [0.10.2] - 2022-10-20
7173
- Fixed use of lowercase LI.
72-
- Fixed correctval to ?? in comments.
74+
- Fixed correctval to ?? in comments.
7375
- Fixed sw to SREG for K tests.
7476
- Added canaries and signature boundary labels.
7577

riscv-ctg/riscv_ctg/data/template.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10414,7 +10414,24 @@ czero.nez:
1041410414
1041510415
// $comment
1041610416
// opcode: $inst ; op1:$rs1; op2:$rs2; dest:$rd; op1val:$rs1_val; op2val:$rs2_val
10417-
TEST_RR_OP($inst, $rd, $rs1, $rs2, $correctval, $rs1_val, $rs2_val, $swreg, $offset, $testreg)
10417+
TEST_RR_OP($inst, $rd, $rs1, $rs2, $correctval, $rs1_val, $rs2_val, $swreg, $offset, $testreg)
10418+
10419+
cbo.zero:
10420+
std_op:
10421+
sig:
10422+
stride: 1
10423+
sz: 'RVMODEL_CBZ_BLOCKSIZE'
10424+
xlen: [32,64]
10425+
isa:
10426+
- IZicbozZicsr
10427+
formattype: 'zformat'
10428+
rs1_op_data: *all_regs_mx0
10429+
rs1_val_data: 'gen_usign_dataset(12)'
10430+
template: |-
10431+
10432+
// $comment
10433+
// opcode: $inst ; op1:$rs1; op1val:$rs1_val
10434+
TEST_CBO_ZERO($swreg,$rs1,$inst,$rs1_val)
1041810435
1041910436
amoadd.w:
1042010437
sig:

riscv-ctg/riscv_ctg/generator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def get_rm(opcode):
113113
'ppbrrformat': ['rs1', 'rs2', 'rd'],
114114
'prrformat': ['rs1', 'rs2', 'rd'],
115115
'prrrformat': ['rs1', 'rs2', 'rs3', 'rd'],
116-
'dcasrformat': ['rs1', 'rs2', 'rd']
116+
'dcasrformat': ['rs1', 'rs2', 'rd'],
117+
'zformat': ['rs1']
117118
}
118119
''' Dictionary mapping instruction formats to operands used by those formats '''
119120

@@ -170,7 +171,8 @@ def get_rm(opcode):
170171
'ppbrrformat': '["rs1_val"] + simd_val_vars("rs2", xlen, 8)',
171172
'prrformat': '["rs1_val", "rs2_val"]',
172173
'prrrformat': "['rs1_val', 'rs2_val' , 'rs3_val']",
173-
'dcasrformat': '["rs1_val", "rs2_val"]'
174+
'dcasrformat': '["rs1_val", "rs2_val"]',
175+
'zformat': ['rs1']
174176
}
175177
''' Dictionary mapping instruction formats to operand value variables used by those formats '''
176178

@@ -1010,6 +1012,7 @@ def valreg(self,instr_dict):
10101012
else:
10111013
FLEN = 0
10121014
XLEN = max(self.opnode['xlen'])
1015+
RVMODEL_CBZ_BLOCKSIZE = XLEN
10131016
SIGALIGN = max(XLEN,FLEN)/8
10141017
stride_sz = eval(suffix)
10151018
template = Template(eval(self.opnode['val']['val_template']))
@@ -1322,7 +1325,7 @@ def reformat_instr(self, instr_dict):
13221325
value = '0x' + value[2:].zfill(int(self.xlen/4))
13231326
value = struct.unpack(size, bytes.fromhex(value[2:]))[0]
13241327
else:
1325-
value = int(value)
1328+
value = toint(value)
13261329
# value = '0x' + struct.pack(size,value).hex()
13271330
#print("test",hex(value))
13281331
instr_dict[i][field] = hex(value)
@@ -1429,7 +1432,7 @@ def __write_test__(self, file_name,node,label,instr_dict, op_node, usage_str):
14291432
# dval = (instr['rs{0}_val'.format(i)],self.iflen)
14301433
data.extend(instr['val_section'])
14311434
if instr['swreg'] != sreg or eval(instr['offset'],{},
1432-
{'FLEN':width,'XLEN':self.xlen,'SIGALIGN':max(self.xlen,self.flen)/8}) == 0:
1435+
{'FLEN':width,'XLEN':self.xlen,'RVMODEL_CBZ_BLOCKSIZE':self.xlen, 'SIGALIGN':max(self.xlen,self.flen)/8}) == 0:
14331436
sign.append(signode_template.substitute(
14341437
{'n':n,'label':"signature_"+sreg+"_"+str(regs[sreg]),'sz':sig_sz}))
14351438
n = stride

riscv-test-suite/env/arch_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
#define INT_CAUSE_MSK ((1<<4)-1)
160160
#endif
161161

162-
// set defaults
162+
// set defaults
163163
#ifndef NUM_SPECD_EXCPTCAUSES
164164
#define NUM_SPECD_EXCPTCAUSES 16
165165
#define EXCPT_CAUSE_MSK ((1<<4)-1)

0 commit comments

Comments
 (0)