Skip to content

Commit 50fa458

Browse files
committed
Merge branch 'main' into 'poseidon2_half_output'
2 parents 0ee1f1f + 21452ea commit 50fa458

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

riscv/src/large_field/runtime.rs

+12-24
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,9 @@ impl Runtime {
172172
link ~> tmp2_col = regs.mload(Y, STEP + 1)
173173
link ~> keccakf.keccakf32_memory(tmp1_col, tmp2_col, STEP)
174174
{
175-
// make sure tmp1_col and tmp2_col are aligned memory addresses
176-
tmp3_col * 4 = tmp1_col,
177-
tmp4_col * 4 = tmp2_col,
178-
// make sure the factors fit in 32 bits
179-
tmp3_col = X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000,
180-
tmp4_col = Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000
175+
// make sure tmp1_col and tmp2_col are 4-byte aligned memory addresses
176+
tmp1_col = 4 * (X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000),
177+
tmp2_col = 4 * (Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000)
181178
}
182179
"#
183180
.to_string()],
@@ -257,12 +254,9 @@ impl Runtime {
257254
link ~> tmp2_col = regs.mload(Y, STEP + 1)
258255
link ~> poseidon_gl.poseidon_permutation(tmp1_col, tmp2_col, STEP)
259256
{
260-
// make sure tmp1_col and tmp2_col are aligned memory addresses
261-
tmp3_col * 4 = tmp1_col,
262-
tmp4_col * 4 = tmp2_col,
263-
// make sure the factors fit in 32 bits
264-
tmp3_col = X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000,
265-
tmp4_col = Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000
257+
// make sure tmp1_col and tmp2_col are 4-byte aligned memory addresses
258+
tmp1_col = 4 * (X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000),
259+
tmp2_col = 4 * (Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000)
266260
}
267261
"#],
268262
);
@@ -289,12 +283,9 @@ impl Runtime {
289283
link ~> tmp?_col = regs.mload(Z, STEP + 2)
290284
link ~> poseidon2_gl.permute(tmp1_col, STEP, tmp2_col, STEP + 1, tmp?_col)
291285
{
292-
// make sure tmp1_col and tmp2_col are aligned memory addresses
293-
tmp3_col * 4 = tmp1_col,
294-
tmp4_col * 4 = tmp2_col,
295-
// make sure the addresses are 32 bits
296-
tmp3_col = X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000,
297-
tmp4_col = Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000
286+
// make sure tmp1_col and tmp2_col are 4-byte aligned memory addresses
287+
tmp1_col = 4 * (X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000),
288+
tmp2_col = 4 * (Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000)
298289
}
299290
"#],
300291
);
@@ -310,12 +301,9 @@ impl Runtime {
310301
link ~> tmp2_col = regs.mload(Y, STEP + 1)
311302
link ~> split_gl_vec.split(tmp1_col, tmp2_col, STEP)
312303
{
313-
// make sure tmp1_col and tmp2_col are aligned memory addresses
314-
tmp3_col * 4 = tmp1_col,
315-
tmp4_col * 4 = tmp2_col,
316-
// make sure the addresses are 32 bits
317-
tmp3_col = X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000,
318-
tmp4_col = Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000
304+
// make sure tmp1_col and tmp2_col are 4-byte aligned memory addresses
305+
tmp1_col = 4 * (X_b1 + X_b2 * 0x100 + X_b3 * 0x10000 + X_b4 * 0x1000000),
306+
tmp2_col = 4 * (Y_b5 + Y_b6 * 0x100 + Y_b7 * 0x10000 + Y_b8 * 0x1000000)
319307
}
320308
"#,
321309
r#"

0 commit comments

Comments
 (0)