Skip to content

Commit 034f1cc

Browse files
Merge pull request #370 from ved-rivos/zacas
Add ratified Zacas extension
2 parents 67c5e71 + c9d9a3f commit 034f1cc

File tree

10 files changed

+7960
-0
lines changed

10 files changed

+7960
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# CHANGELOG
2+
## [3.8.18] - 2023-07-28
3+
- Add Zacas ISA extension support.
24

35
## [3.8.17] - 2024-05-03
46
- Add Zfa support.
@@ -117,6 +119,7 @@ Add missing check ISA fields in recently modified div and amo tests
117119
- Added test case for division if most negative number by -1
118120
- Solved the [issue #300](https://github.com/riscv-non-isa/riscv-arch-test/issues/300)
119121

122+
120123
## [3.7.0] - 2023-05-16
121124
- Updated the LI macro
122125
- Make Trap handler compatible for RV32E

coverage/dataset.cgf

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,23 @@ datasets:
144144
x30: 0
145145
x31: 0
146146

147+
pair_regs: &pair_regs
148+
x2: 0
149+
x4: 0
150+
x6: 0
151+
x8: 0
152+
x10: 0
153+
x12: 0
154+
x14: 0
155+
x16: 0
156+
x18: 0
157+
x20: 0
158+
x22: 0
159+
x24: 0
160+
x26: 0
161+
x28: 0
162+
x30: 0
163+
147164
cbfmt_immval_sgn: &cbfmt_immval_sgn
148165
'imm_val == (-2**(6-1))': 0
149166
'imm_val == 0': 0
@@ -321,3 +338,93 @@ datasets:
321338
'walking_zeros("imm_val", 12,False)': 0
322339
'alternate("imm_val",12,False)': 0
323340

341+
rvp64_rs1val_sgn: &rvp64_rs1val_sgn
342+
'rs1_val == (-2**63)': 0
343+
'rs1_val == 0': 0
344+
'rs1_val == (2**63-1)': 0
345+
'rs1_val == 1': 0
346+
347+
rvp64_rs2val_sgn: &rvp64_rs2val_sgn
348+
'rs2_val == (-2**63)': 0
349+
'rs2_val == 0': 0
350+
'rs2_val == (2**63-1)': 0
351+
'rs2_val == 1': 0
352+
353+
rvp64_rs1val_unsgn: &rvp64_rs1val_unsgn
354+
'rs1_val == 0': 0
355+
'rs1_val == (2**64-1)': 0
356+
'rs1_val == 1': 0
357+
358+
rvp64_rs2val_unsgn: &rvp64_rs2val_unsgn
359+
'rs2_val == 0': 0
360+
'rs2_val == (2**64-1)': 0
361+
'rs2_val == 1': 0
362+
363+
rvp64_rs1val_walking_sgn: &rvp64_rs1val_walking_sgn
364+
'walking_ones("rs1_val", 64)': 0
365+
'walking_zeros("rs1_val", 64)': 0
366+
'alternate("rs1_val",64)': 0
367+
368+
rvp64_rs2val_walking_sgn: &rvp64_rs2val_walking_sgn
369+
'walking_ones("rs2_val", 64)': 0
370+
'walking_zeros("rs2_val", 64)': 0
371+
'alternate("rs2_val",64)': 0
372+
373+
rvp64_rs1val_walking_unsgn: &rvp64_rs1val_walking_unsgn
374+
'walking_ones("rs1_val", 64, signed=False)': 0
375+
'walking_zeros("rs1_val", 64, signed=False)': 0
376+
'alternate("rs1_val",64, signed=False)': 0
377+
378+
rvp64_rs2val_walking_unsgn: &rvp64_rs2val_walking_unsgn
379+
'walking_ones("rs2_val", 64, signed=False)': 0
380+
'walking_zeros("rs2_val", 64, signed=False)': 0
381+
'alternate("rs2_val",64, signed=False)': 0
382+
383+
rvp128_rs1val_sgn: &rvp128_rs1val_sgn
384+
'rs1_val == 0': 0
385+
'rs1_val == 1': 0
386+
387+
rvp128_rs2val_sgn: &rvp128_rs2val_sgn
388+
'rs2_val == 0': 0
389+
'rs2_val == 1': 0
390+
391+
rvp128_rs1val_walking_sgn: &rvp128_rs1val_walking_sgn
392+
'walking_ones("rs1_val", 128)': 0
393+
'walking_zeros("rs1_val", 128)': 0
394+
'alternate("rs1_val",128)': 0
395+
396+
rvp128_rs2val_walking_sgn: &rvp128_rs2val_walking_sgn
397+
'walking_ones("rs2_val", 128)': 0
398+
'walking_zeros("rs2_val", 128)': 0
399+
'alternate("rs2_val",128)': 0
400+
401+
zacas_op_comb: &zacas_op_comb
402+
'rs1 != rs2 and rs1 != rd and rs2 != rd': 0
403+
404+
zacas_dcas_rs1val_sgn: &zacas_dcas_rs1val_sgn
405+
'rs1_val == 0': 0
406+
'rs1_val == 1': 0
407+
408+
zacas_dcas_rs2val_sgn: &zacas_dcas_rs2val_sgn
409+
'rs2_val == 0': 0
410+
'rs2_val == 1': 0
411+
412+
zacas128_rs1val_walking_sgn: &zacas128_rs1val_walking_sgn
413+
'walking_ones("rs1_val", 128)': 0
414+
'walking_zeros("rs1_val", 128)': 0
415+
'alternate("rs1_val",128)': 0
416+
417+
zacas128_rs2val_walking_sgn: &zacas128_rs2val_walking_sgn
418+
'walking_ones("rs2_val", 128)': 0
419+
'walking_zeros("rs2_val", 128)': 0
420+
'alternate("rs2_val",128)': 0
421+
422+
zacas64_rs1val_walking_sgn: &zacas64_rs1val_walking_sgn
423+
'walking_ones("rs1_val", 64)': 0
424+
'walking_zeros("rs1_val", 64)': 0
425+
'alternate("rs1_val",64)': 0
426+
427+
zacas64_rs2val_walking_sgn: &zacas64_rs2val_walking_sgn
428+
'walking_ones("rs2_val", 64)': 0
429+
'walking_zeros("rs2_val", 64)': 0
430+
'alternate("rs2_val",64)': 0

coverage/rv32zacas.cgf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# cover group format file for Zacas extension
2+
amocas.w:
3+
config:
4+
- check ISA:=regex(.*Zacas.*)
5+
opcode:
6+
amocas.w: 0
7+
rs1:
8+
<<: *all_regs_mx0
9+
rs2:
10+
<<: *all_regs
11+
rd:
12+
<<: *all_regs
13+
op_comb:
14+
<<: *zacas_op_comb
15+
val_comb:
16+
<<: [*base_rs1val_sgn, *base_rs2val_sgn]
17+
abstract_comb:
18+
<<: [*rs1val_walking, *rs2val_walking]
19+
20+
amocas.d_32:
21+
config:
22+
- check ISA:=regex(.*Zacas.*)
23+
opcode:
24+
amocas.d_32: 0
25+
rs1:
26+
<<: *all_regs_mx0
27+
rs2:
28+
<<: *pair_regs
29+
rd:
30+
<<: *pair_regs
31+
op_comb:
32+
<<: *zacas_op_comb
33+
val_comb:
34+
<<: [*zacas_dcas_rs1val_sgn, *zacas_dcas_rs2val_sgn, *rfmt_val_comb_sgn]
35+
abstract_comb:
36+
<<: [*zacas64_rs1val_walking_sgn, *zacas64_rs2val_walking_sgn]

coverage/rv64zacas.cgf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# cover group format file for Zacas extension
2+
amocas.w:
3+
config:
4+
- check ISA:=regex(.*Zacas.*)
5+
opcode:
6+
amocas.w: 0
7+
rs1:
8+
<<: *all_regs_mx0
9+
rs2:
10+
<<: *all_regs
11+
rd:
12+
<<: *all_regs
13+
op_comb:
14+
<<: *zacas_op_comb
15+
val_comb:
16+
<<: [*base_rs1val_sgn, *base_rs2val_sgn]
17+
abstract_comb:
18+
<<: [*rs1val_walking, *rs2val_walking]
19+
20+
amocas.d_64:
21+
config:
22+
- check ISA:=regex(.*Zacas.*)
23+
opcode:
24+
amocas.d_64: 0
25+
rs1:
26+
<<: *all_regs_mx0
27+
rs2:
28+
<<: *all_regs
29+
rd:
30+
<<: *all_regs
31+
op_comb:
32+
<<: *zacas_op_comb
33+
val_comb:
34+
<<: [*base_rs1val_sgn, *base_rs2val_sgn, *rfmt_val_comb_sgn]
35+
abstract_comb:
36+
<<: [*rs1val_walking, *rs2val_walking]
37+
38+
amocas.q:
39+
config:
40+
- check ISA:=regex(.*Zacas.*)
41+
opcode:
42+
amocas.q: 0
43+
rs1:
44+
<<: *all_regs_mx0
45+
rs2:
46+
<<: *pair_regs
47+
rd:
48+
<<: *pair_regs
49+
op_comb:
50+
<<: *zacas_op_comb
51+
val_comb:
52+
<<: [*zacas_dcas_rs1val_sgn, *zacas_dcas_rs2val_sgn, *rfmt_val_comb_sgn]
53+
abstract_comb:
54+
<<: [*zacas128_rs1val_walking_sgn, *zacas128_rs2val_walking_sgn]

riscv-test-suite/env/test_macros.h

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,56 @@ ADDI(swreg, swreg, RVMODEL_CBZ_BLOCKSIZE)
10991099
sub x1,x1,tempreg ;\
11001100
RVTEST_SIGUPD(swreg,x1,offset)
11011101

1102+
// for updating signatures of Zacas paired destination register (RV32/RV64).
1103+
#define RVTEST_SIGUPD_PZACAS(_BR,_R1,_R2,...) ;\
1104+
.if NARG(__VA_ARGS__) == 1 ;\
1105+
.set offset,_ARG1(__VA_OPT__(__VA_ARGS__,0)) ;\
1106+
.endif ;\
1107+
.if (offset & (REGWIDTH-1)) != 0 ;\
1108+
.warning "Signature Incorrect Offset Alignment." ;\
1109+
.set offset, offset&(SIGALIGN-1)+SIGALIGN ;\
1110+
.endif ;\
1111+
CHK_OFFSET(_BR,REGWIDTH,0) ;\
1112+
SREG _R1,offset(_BR) ;\
1113+
CHK_OFFSET(_BR,REGWIDTH,1) ;\
1114+
SREG _R2,offset(_BR) ;\
1115+
.set offset,offset+(REGWIDTH)
1116+
1117+
// Tests for a AMOCAS where operation width is <= xlen
1118+
// First store a value that will cause a mismatch on cas
1119+
// Test a failing amocas followed by a successful amocas
1120+
#define TEST_CAS_OP(inst, rd, rs1, rs2, swap_val, sigptr, offset) \
1121+
LI(rd, swap_val);\
1122+
neg rd, rd;\
1123+
LA(rs1, rvtest_data);\
1124+
SREG rd, (rs1);\
1125+
LI(rd, swap_val);\
1126+
LI(rs2, swap_val);\
1127+
LA(rs1, rvtest_data);\
1128+
inst rd, rs2, (rs1);\
1129+
inst rd, rs2, (rs1);\
1130+
RVTEST_SIGUPD(sigptr,rd,offset);
1131+
1132+
// Tests for a AMOCAS where operation width is <= xlen
1133+
// First store a value that will cause a mismatch on cas
1134+
// Test a failing amocas followed by a successful amocas
1135+
#define TEST_DCAS_OP(inst, rd, rd_hi, rs1, rs2, rs2_hi, swap_val, swap_val_hi, sigptr, offset) \
1136+
LA(rs1, rvtest_data);\
1137+
LI(rd, swap_val);\
1138+
neg rd, rd;\
1139+
SREG rd, (rs1);\
1140+
LI(rd, swap_val_hi);\
1141+
neg rd, rd;\
1142+
SREG rd, (__riscv_xlen/8)(rs1);\
1143+
LI(rd, swap_val);\
1144+
LI(rd_hi, swap_val_hi);\
1145+
LI(rs2, swap_val);\
1146+
LI(rs2_hi, swap_val_hi);\
1147+
LA(rs1, rvtest_data);\
1148+
inst rd, rs2, (rs1);\
1149+
LA(rs1, rvtest_data);\
1150+
inst rd, rs2, (rs1);\
1151+
RVTEST_SIGUPD_PZACAS(sigptr,rd,rd_hi,offset);
11021152

11031153
//--------------------------------- Migration aliases ------------------------------------------
11041154
#ifdef RV_COMPLIANCE_RV32M

0 commit comments

Comments
 (0)