Skip to content

Commit 80d5633

Browse files
davidharrishmcclaudejordancarlin
authored
Use a fixed 6-bit immediate for CBP-type c.andi (riscv#2316)
Issue riscv#2147 item 23. CBP is only `c.andi`, whose immediate is a fixed 6-bit signed field, `[-32,31]` on both RV32 and RV64. The config declared `imm_bits="xlen_log2"`, which resolves to 5 on RV32, confining RV32 random immediates to `[-16,15]`. It also set `imm_nonzero=True`, but `c.andi` reserves nothing — `imm=0` is a legal encoding that clears the register (UDB: `X[xd] = X[xd] & $signed(imm)`, no constraint). Both settings are correct for CBS, the shift type `c.srli`/`c.srai`, where the immediate really is an `xlen_log2` shift amount and `shamt=0` is a HINT. They were copied to CBP, which shares neither property. Of the five types setting `imm_nonzero`, CBP was the only one whose instruction has no architectural nonzero requirement — `c.addi4spn`, `c.lui` and `c.addi16sp` reserve a zero immediate, and the shift types make it a HINT. Two files regenerate, RV32 only; RV64 already resolved `xlen_log2` to 6 and is byte-identical. Random immediates move from `[-16,13]` to `[-32,27]`; the 156 testcases under `cp_imm_edges` and `cr_rs1_imm_edges_6bit` pin their immediates and already spanned the full range. Zca passes 32/32 on spike-rv64-max and 26/26 on spike-rv32-max. Thanks @copilot-pull-request-reviewer for catching `imm_nonzero` — it is the same copy-paste as the width. Worth noting for the record that it changes no generated output today: no random draw in the current stream lands on 0, so the re-roll never fired, and `imm=0` is already exercised 16 times per file by the edge cross. The value is preventing a future seed or edit from silently suppressing a legal encoding in the random path. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PTjX9BBLNAQkWwTTq6vfxq --------- Signed-off-by: David Harris <David_Harris@hmc.edu> Signed-off-by: Jordan Carlin <jcarlin@qti.qualcomm.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Jordan Carlin <jcarlin@qti.qualcomm.com>
1 parent 854019c commit 80d5633

3 files changed

Lines changed: 41 additions & 42 deletions

File tree

generators/testgen/src/testgen/formatters/types/cbp_type.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
cbp_config = InstructionTypeConfig(
1414
required_params={"rs1", "rs1val", "immval"},
1515
reg_range=range(8, 16),
16-
imm_bits="xlen_log2",
16+
imm_bits=6,
1717
imm_signed=True,
18-
imm_nonzero=True,
1918
)
2019

2120

tests/rv32e/Zca/Zca-c.andi-00.S

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,56 @@ RVTEST_BEGIN
3636
# Testcase cp_rs1_p (Test source rs1 = x8)
3737
RVTEST_TESTDATA_LOAD_INT(x3, x8) # load rd/rs1: x8 = 0x24182122
3838
Zca_c_andi_cg_cp_rs1_p_b8:
39-
c.andi x8, 5 # perform operation
39+
c.andi x8, 10 # perform operation
4040
# Check if x8 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
4141
RVTEST_SIGUPD(x2, x5, x4, x8, Zca_c_andi_cg_cp_rs1_p_b8, Zca_c_andi_cg_cp_rs1_p_b8_str)
4242

4343
# Testcase cp_rs1_p (Test source rs1 = x9)
4444
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x4c20a304
4545
Zca_c_andi_cg_cp_rs1_p_b9:
46-
c.andi x9, -9 # perform operation
46+
c.andi x9, -17 # perform operation
4747
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
4848
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_p_b9, Zca_c_andi_cg_cp_rs1_p_b9_str)
4949

5050
# Testcase cp_rs1_p (Test source rs1 = x10)
5151
RVTEST_TESTDATA_LOAD_INT(x3, x10) # load rd/rs1: x10 = 0x411f807e
5252
Zca_c_andi_cg_cp_rs1_p_b10:
53-
c.andi x10, -11 # perform operation
53+
c.andi x10, -21 # perform operation
5454
# Check if x10 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
5555
RVTEST_SIGUPD(x2, x5, x4, x10, Zca_c_andi_cg_cp_rs1_p_b10, Zca_c_andi_cg_cp_rs1_p_b10_str)
5656

5757
# Testcase cp_rs1_p (Test source rs1 = x11)
5858
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x3295e76e
5959
Zca_c_andi_cg_cp_rs1_p_b11:
60-
c.andi x11, 13 # perform operation
60+
c.andi x11, 27 # perform operation
6161
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
6262
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_p_b11, Zca_c_andi_cg_cp_rs1_p_b11_str)
6363

6464
# Testcase cp_rs1_p (Test source rs1 = x12)
6565
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0xee752d1f
6666
Zca_c_andi_cg_cp_rs1_p_b12:
67-
c.andi x12, 2 # perform operation
67+
c.andi x12, 4 # perform operation
6868
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
6969
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_p_b12, Zca_c_andi_cg_cp_rs1_p_b12_str)
7070

7171
# Testcase cp_rs1_p (Test source rs1 = x13)
7272
RVTEST_TESTDATA_LOAD_INT(x3, x13) # load rd/rs1: x13 = 0x5d52c5ff
7373
Zca_c_andi_cg_cp_rs1_p_b13:
74-
c.andi x13, 12 # perform operation
74+
c.andi x13, 25 # perform operation
7575
# Check if x13 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
7676
RVTEST_SIGUPD(x2, x5, x4, x13, Zca_c_andi_cg_cp_rs1_p_b13, Zca_c_andi_cg_cp_rs1_p_b13_str)
7777

7878
# Testcase cp_rs1_p (Test source rs1 = x14)
7979
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0xc8033be3
8080
Zca_c_andi_cg_cp_rs1_p_b14:
81-
c.andi x14, -16 # perform operation
81+
c.andi x14, -32 # perform operation
8282
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
8383
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_p_b14, Zca_c_andi_cg_cp_rs1_p_b14_str)
8484

8585
# Testcase cp_rs1_p (Test source rs1 = x15)
8686
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x869cd984
8787
Zca_c_andi_cg_cp_rs1_p_b15:
88-
c.andi x15, -9 # perform operation
88+
c.andi x15, -17 # perform operation
8989
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
9090
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_p_b15, Zca_c_andi_cg_cp_rs1_p_b15_str)
9191

@@ -96,84 +96,84 @@ Zca_c_andi_cg_cp_rs1_p_b15:
9696
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000000)
9797
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x00000000
9898
Zca_c_andi_cg_cp_rs1_edges_0x0:
99-
c.andi x15, 5 # perform operation
99+
c.andi x15, 11 # perform operation
100100
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
101101
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_edges_0x0, Zca_c_andi_cg_cp_rs1_edges_0x0_str)
102102

103103
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000001)
104104
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x00000001
105105
Zca_c_andi_cg_cp_rs1_edges_0x1:
106-
c.andi x9, 1 # perform operation
106+
c.andi x9, 2 # perform operation
107107
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
108108
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0x1, Zca_c_andi_cg_cp_rs1_edges_0x1_str)
109109

110110
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000002)
111111
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x00000002
112112
Zca_c_andi_cg_cp_rs1_edges_0x2:
113-
c.andi x15, 8 # perform operation
113+
c.andi x15, 16 # perform operation
114114
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
115115
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_edges_0x2, Zca_c_andi_cg_cp_rs1_edges_0x2_str)
116116

117117
# Testcase cp_rs1_edges (Test source rs1 value = 0x80000000)
118118
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0x80000000
119119
Zca_c_andi_cg_cp_rs1_edges_0x80000000:
120-
c.andi x12, -15 # perform operation
120+
c.andi x12, -29 # perform operation
121121
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
122122
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_edges_0x80000000, Zca_c_andi_cg_cp_rs1_edges_0x80000000_str)
123123

124124
# Testcase cp_rs1_edges (Test source rs1 value = 0x80000001)
125125
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x80000001
126126
Zca_c_andi_cg_cp_rs1_edges_0x80000001:
127-
c.andi x11, -6 # perform operation
127+
c.andi x11, -11 # perform operation
128128
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
129129
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_edges_0x80000001, Zca_c_andi_cg_cp_rs1_edges_0x80000001_str)
130130

131131
# Testcase cp_rs1_edges (Test source rs1 value = 0x7fffffff)
132132
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x7fffffff
133133
Zca_c_andi_cg_cp_rs1_edges_0x7fffffff:
134-
c.andi x9, -6 # perform operation
134+
c.andi x9, -12 # perform operation
135135
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
136136
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0x7fffffff, Zca_c_andi_cg_cp_rs1_edges_0x7fffffff_str)
137137

138138
# Testcase cp_rs1_edges (Test source rs1 value = 0x7ffffffe)
139139
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x7ffffffe
140140
Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe:
141-
c.andi x11, -2 # perform operation
141+
c.andi x11, -4 # perform operation
142142
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
143143
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe, Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe_str)
144144

145145
# Testcase cp_rs1_edges (Test source rs1 value = 0xffffffff)
146146
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0xffffffff
147147
Zca_c_andi_cg_cp_rs1_edges_0xffffffff:
148-
c.andi x14, 1 # perform operation
148+
c.andi x14, 2 # perform operation
149149
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
150150
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0xffffffff, Zca_c_andi_cg_cp_rs1_edges_0xffffffff_str)
151151

152152
# Testcase cp_rs1_edges (Test source rs1 value = 0xfffffffe)
153153
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0xfffffffe
154154
Zca_c_andi_cg_cp_rs1_edges_0xfffffffe:
155-
c.andi x12, 7 # perform operation
155+
c.andi x12, 14 # perform operation
156156
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
157157
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_edges_0xfffffffe, Zca_c_andi_cg_cp_rs1_edges_0xfffffffe_str)
158158

159159
# Testcase cp_rs1_edges (Test source rs1 value = 0x5bbc8872)
160160
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0x5bbc8872
161161
Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872:
162-
c.andi x14, 8 # perform operation
162+
c.andi x14, 17 # perform operation
163163
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
164164
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872, Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872_str)
165165

166166
# Testcase cp_rs1_edges (Test source rs1 value = 0xaaaaaaaa)
167167
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0xaaaaaaaa
168168
Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa:
169-
c.andi x9, 2 # perform operation
169+
c.andi x9, 4 # perform operation
170170
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
171171
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa, Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa_str)
172172

173173
# Testcase cp_rs1_edges (Test source rs1 value = 0x55555555)
174174
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0x55555555
175175
Zca_c_andi_cg_cp_rs1_edges_0x55555555:
176-
c.andi x14, 7 # perform operation
176+
c.andi x14, 15 # perform operation
177177
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
178178
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0x55555555, Zca_c_andi_cg_cp_rs1_edges_0x55555555_str)
179179

tests/rv32i/Zca/Zca-c.andi-00.S

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -36,56 +36,56 @@ RVTEST_BEGIN
3636
# Testcase cp_rs1_p (Test source rs1 = x8)
3737
RVTEST_TESTDATA_LOAD_INT(x3, x8) # load rd/rs1: x8 = 0x24182122
3838
Zca_c_andi_cg_cp_rs1_p_b8:
39-
c.andi x8, 5 # perform operation
39+
c.andi x8, 10 # perform operation
4040
# Check if x8 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
4141
RVTEST_SIGUPD(x2, x5, x4, x8, Zca_c_andi_cg_cp_rs1_p_b8, Zca_c_andi_cg_cp_rs1_p_b8_str)
4242

4343
# Testcase cp_rs1_p (Test source rs1 = x9)
4444
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x4c20a304
4545
Zca_c_andi_cg_cp_rs1_p_b9:
46-
c.andi x9, -9 # perform operation
46+
c.andi x9, -17 # perform operation
4747
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
4848
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_p_b9, Zca_c_andi_cg_cp_rs1_p_b9_str)
4949

5050
# Testcase cp_rs1_p (Test source rs1 = x10)
5151
RVTEST_TESTDATA_LOAD_INT(x3, x10) # load rd/rs1: x10 = 0x411f807e
5252
Zca_c_andi_cg_cp_rs1_p_b10:
53-
c.andi x10, -11 # perform operation
53+
c.andi x10, -21 # perform operation
5454
# Check if x10 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
5555
RVTEST_SIGUPD(x2, x5, x4, x10, Zca_c_andi_cg_cp_rs1_p_b10, Zca_c_andi_cg_cp_rs1_p_b10_str)
5656

5757
# Testcase cp_rs1_p (Test source rs1 = x11)
5858
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x3295e76e
5959
Zca_c_andi_cg_cp_rs1_p_b11:
60-
c.andi x11, 13 # perform operation
60+
c.andi x11, 27 # perform operation
6161
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
6262
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_p_b11, Zca_c_andi_cg_cp_rs1_p_b11_str)
6363

6464
# Testcase cp_rs1_p (Test source rs1 = x12)
6565
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0xee752d1f
6666
Zca_c_andi_cg_cp_rs1_p_b12:
67-
c.andi x12, 2 # perform operation
67+
c.andi x12, 4 # perform operation
6868
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
6969
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_p_b12, Zca_c_andi_cg_cp_rs1_p_b12_str)
7070

7171
# Testcase cp_rs1_p (Test source rs1 = x13)
7272
RVTEST_TESTDATA_LOAD_INT(x3, x13) # load rd/rs1: x13 = 0x5d52c5ff
7373
Zca_c_andi_cg_cp_rs1_p_b13:
74-
c.andi x13, 12 # perform operation
74+
c.andi x13, 25 # perform operation
7575
# Check if x13 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
7676
RVTEST_SIGUPD(x2, x5, x4, x13, Zca_c_andi_cg_cp_rs1_p_b13, Zca_c_andi_cg_cp_rs1_p_b13_str)
7777

7878
# Testcase cp_rs1_p (Test source rs1 = x14)
7979
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0xc8033be3
8080
Zca_c_andi_cg_cp_rs1_p_b14:
81-
c.andi x14, -16 # perform operation
81+
c.andi x14, -32 # perform operation
8282
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
8383
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_p_b14, Zca_c_andi_cg_cp_rs1_p_b14_str)
8484

8585
# Testcase cp_rs1_p (Test source rs1 = x15)
8686
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x869cd984
8787
Zca_c_andi_cg_cp_rs1_p_b15:
88-
c.andi x15, -9 # perform operation
88+
c.andi x15, -17 # perform operation
8989
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
9090
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_p_b15, Zca_c_andi_cg_cp_rs1_p_b15_str)
9191

@@ -96,84 +96,84 @@ Zca_c_andi_cg_cp_rs1_p_b15:
9696
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000000)
9797
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x00000000
9898
Zca_c_andi_cg_cp_rs1_edges_0x0:
99-
c.andi x15, 5 # perform operation
99+
c.andi x15, 11 # perform operation
100100
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
101101
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_edges_0x0, Zca_c_andi_cg_cp_rs1_edges_0x0_str)
102102

103103
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000001)
104104
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x00000001
105105
Zca_c_andi_cg_cp_rs1_edges_0x1:
106-
c.andi x9, 1 # perform operation
106+
c.andi x9, 2 # perform operation
107107
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
108108
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0x1, Zca_c_andi_cg_cp_rs1_edges_0x1_str)
109109

110110
# Testcase cp_rs1_edges (Test source rs1 value = 0x00000002)
111111
RVTEST_TESTDATA_LOAD_INT(x3, x15) # load rd/rs1: x15 = 0x00000002
112112
Zca_c_andi_cg_cp_rs1_edges_0x2:
113-
c.andi x15, 8 # perform operation
113+
c.andi x15, 16 # perform operation
114114
# Check if x15 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
115115
RVTEST_SIGUPD(x2, x5, x4, x15, Zca_c_andi_cg_cp_rs1_edges_0x2, Zca_c_andi_cg_cp_rs1_edges_0x2_str)
116116

117117
# Testcase cp_rs1_edges (Test source rs1 value = 0x80000000)
118118
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0x80000000
119119
Zca_c_andi_cg_cp_rs1_edges_0x80000000:
120-
c.andi x12, -15 # perform operation
120+
c.andi x12, -29 # perform operation
121121
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
122122
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_edges_0x80000000, Zca_c_andi_cg_cp_rs1_edges_0x80000000_str)
123123

124124
# Testcase cp_rs1_edges (Test source rs1 value = 0x80000001)
125125
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x80000001
126126
Zca_c_andi_cg_cp_rs1_edges_0x80000001:
127-
c.andi x11, -6 # perform operation
127+
c.andi x11, -11 # perform operation
128128
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
129129
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_edges_0x80000001, Zca_c_andi_cg_cp_rs1_edges_0x80000001_str)
130130

131131
# Testcase cp_rs1_edges (Test source rs1 value = 0x7fffffff)
132132
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0x7fffffff
133133
Zca_c_andi_cg_cp_rs1_edges_0x7fffffff:
134-
c.andi x9, -6 # perform operation
134+
c.andi x9, -12 # perform operation
135135
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
136136
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0x7fffffff, Zca_c_andi_cg_cp_rs1_edges_0x7fffffff_str)
137137

138138
# Testcase cp_rs1_edges (Test source rs1 value = 0x7ffffffe)
139139
RVTEST_TESTDATA_LOAD_INT(x3, x11) # load rd/rs1: x11 = 0x7ffffffe
140140
Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe:
141-
c.andi x11, -2 # perform operation
141+
c.andi x11, -4 # perform operation
142142
# Check if x11 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
143143
RVTEST_SIGUPD(x2, x5, x4, x11, Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe, Zca_c_andi_cg_cp_rs1_edges_0x7ffffffe_str)
144144

145145
# Testcase cp_rs1_edges (Test source rs1 value = 0xffffffff)
146146
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0xffffffff
147147
Zca_c_andi_cg_cp_rs1_edges_0xffffffff:
148-
c.andi x14, 1 # perform operation
148+
c.andi x14, 2 # perform operation
149149
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
150150
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0xffffffff, Zca_c_andi_cg_cp_rs1_edges_0xffffffff_str)
151151

152152
# Testcase cp_rs1_edges (Test source rs1 value = 0xfffffffe)
153153
RVTEST_TESTDATA_LOAD_INT(x3, x12) # load rd/rs1: x12 = 0xfffffffe
154154
Zca_c_andi_cg_cp_rs1_edges_0xfffffffe:
155-
c.andi x12, 7 # perform operation
155+
c.andi x12, 14 # perform operation
156156
# Check if x12 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
157157
RVTEST_SIGUPD(x2, x5, x4, x12, Zca_c_andi_cg_cp_rs1_edges_0xfffffffe, Zca_c_andi_cg_cp_rs1_edges_0xfffffffe_str)
158158

159159
# Testcase cp_rs1_edges (Test source rs1 value = 0x5bbc8872)
160160
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0x5bbc8872
161161
Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872:
162-
c.andi x14, 8 # perform operation
162+
c.andi x14, 17 # perform operation
163163
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
164164
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872, Zca_c_andi_cg_cp_rs1_edges_0x5bbc8872_str)
165165

166166
# Testcase cp_rs1_edges (Test source rs1 value = 0xaaaaaaaa)
167167
RVTEST_TESTDATA_LOAD_INT(x3, x9) # load rd/rs1: x9 = 0xaaaaaaaa
168168
Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa:
169-
c.andi x9, 2 # perform operation
169+
c.andi x9, 4 # perform operation
170170
# Check if x9 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
171171
RVTEST_SIGUPD(x2, x5, x4, x9, Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa, Zca_c_andi_cg_cp_rs1_edges_0xaaaaaaaa_str)
172172

173173
# Testcase cp_rs1_edges (Test source rs1 value = 0x55555555)
174174
RVTEST_TESTDATA_LOAD_INT(x3, x14) # load rd/rs1: x14 = 0x55555555
175175
Zca_c_andi_cg_cp_rs1_edges_0x55555555:
176-
c.andi x14, 7 # perform operation
176+
c.andi x14, 15 # perform operation
177177
# Check if x14 contains the expected result. x2 is the signature ptr, x5 is the link ptr, x4 is a temp reg.
178178
RVTEST_SIGUPD(x2, x5, x4, x14, Zca_c_andi_cg_cp_rs1_edges_0x55555555, Zca_c_andi_cg_cp_rs1_edges_0x55555555_str)
179179

0 commit comments

Comments
 (0)