@@ -59,7 +59,7 @@ static POSEIDON_GL_COPROCESSOR: CoProcessor = CoProcessor {
59
59
import : "use std::hash::poseidon_gl::PoseidonGL;" ,
60
60
instructions : r#"
61
61
// ================== hashing instructions ==============
62
- instr poseidon_gl A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11 -> X, Y, Z, W = poseidon_gl.poseidon_permutation ;
62
+ instr poseidon_gl = poseidon_gl.poseidon_permutation P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11 -> P0, P1, P2, P3 ;
63
63
64
64
"# ,
65
65
runtime_function_impl : Some ( ( "poseidon_gl_coprocessor" , poseidon_gl_call) ) ,
@@ -199,18 +199,16 @@ impl CoProcessors {
199
199
pub fn registers ( & self ) -> String {
200
200
// Poseidon has 12 inputs and 4 outputs.
201
201
// The base RISCV machine has 4 assignment registers.
202
- // Therefore we need to add 12 assignment registers when using Poseidon.
203
- // Moreover, we also need 12 extra general purpose registers to store the
204
- // input values.
202
+ // We need 12 extra general purpose registers to store the
203
+ // input and values directly.
205
204
206
205
if !self . coprocessors . contains_key ( POSEIDON_GL_COPROCESSOR . name ) {
207
206
return String :: new ( ) ;
208
207
}
209
208
210
- let a_regs: Vec < String > = ( 0 ..12 ) . map ( |i| format ! ( "reg A{}[<=];" , i) ) . collect ( ) ;
211
209
let p_regs: Vec < String > = ( 0 ..12 ) . map ( |i| format ! ( "reg P{};" , i) ) . collect ( ) ;
212
210
213
- [ a_regs , p_regs] . concat ( ) . join ( "\n " )
211
+ p_regs. join ( "\n " )
214
212
}
215
213
}
216
214
@@ -244,7 +242,7 @@ fn poseidon_gl_call() -> String {
244
242
)
245
243
} ;
246
244
247
- let call = "P0, P1, P2, P3 <== poseidon_gl(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11) ;" ;
245
+ let call = "poseidon_gl;" ;
248
246
249
247
( 0 ..12 )
250
248
. map ( decoding)
@@ -273,18 +271,14 @@ pub fn call_every_submachine(coprocessors: &CoProcessors) -> Vec<String> {
273
271
}
274
272
if coprocessors. has ( POSEIDON_GL_COPROCESSOR . name ) {
275
273
calls. extend ( vec ! [
276
- "P0, P1, P2, x10 <== poseidon_gl(P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11);"
277
- . to_string( ) ,
274
+ "poseidon_gl;" . to_string( ) ,
278
275
"P0 <=X= 0;" . to_string( ) ,
279
276
"P1 <=X= 0;" . to_string( ) ,
280
277
"P2 <=X= 0;" . to_string( ) ,
278
+ "P3 <=X= 0;" . to_string( ) ,
281
279
] ) ;
282
280
}
283
281
if coprocessors. has ( SPLIT_GL_COPROCESSOR . name ) {
284
- // SplitGL only makes sense when used with PoseidonGL, because there is
285
- // no other way to get a value in the full range of Goldilocks into a
286
- // register of the RISC-V zkVM.
287
- assert ! ( coprocessors. has( POSEIDON_GL_COPROCESSOR . name) ) ;
288
282
calls. push ( "x10, x11 <== split_gl(x10);" . to_string ( ) ) ;
289
283
}
290
284
0 commit comments