@@ -2,9 +2,8 @@ use openvm_instructions::{instruction::Instruction, riscv, LocalOpcode, SystemOp
2
2
use openvm_stark_backend:: p3_field:: PrimeField32 ;
3
3
use openvm_womir_transpiler:: {
4
4
AllocateFrameOpcode , BaseAlu64Opcode , BaseAluOpcode , ConstOpcodes , CopyIntoFrameOpcode ,
5
- DivRem64Opcode , DivRemOpcode , Eq64Opcode , EqOpcode , HintStoreOpcode , JaafOpcode , JumpOpcode ,
6
- LessThan64Opcode , LessThanOpcode , LoadStoreOpcode , Mul64Opcode , MulOpcode , Phantom ,
7
- Shift64Opcode , ShiftOpcode ,
5
+ Eq64Opcode , EqOpcode , HintStoreOpcode , JaafOpcode , JumpOpcode , LessThan64Opcode ,
6
+ LessThanOpcode , LoadStoreOpcode , MulOpcode , Phantom , Shift64Opcode , ShiftOpcode ,
8
7
} ;
9
8
10
9
use crate :: womir_translation:: { ERROR_ABORT_CODE , ERROR_CODE_OFFSET } ;
@@ -54,6 +53,7 @@ pub fn sub<F: PrimeField32>(rd: usize, rs1: usize, rs2: usize) -> Instruction<F>
54
53
instr_r ( BaseAluOpcode :: SUB . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
55
54
}
56
55
56
+ #[ cfg( test) ]
57
57
pub fn mul < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
58
58
instr_r ( MulOpcode :: MUL . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
59
59
}
@@ -62,52 +62,13 @@ pub fn muli<F: PrimeField32>(rd: usize, rs1: usize, imm: F) -> Instruction<F> {
62
62
instr_i ( MulOpcode :: MUL . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
63
63
}
64
64
65
- pub fn mul_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
66
- instr_r ( Mul64Opcode :: MUL . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
67
- }
68
-
65
+ #[ cfg( test) ]
69
66
pub fn div < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
67
+ use openvm_womir_transpiler:: DivRemOpcode ;
70
68
instr_r ( DivRemOpcode :: DIV . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
71
69
}
72
70
73
- pub fn divu < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
74
- instr_r ( DivRemOpcode :: DIVU . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
75
- }
76
-
77
- pub fn rem < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
78
- instr_r ( DivRemOpcode :: REM . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
79
- }
80
-
81
- pub fn remu < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
82
- instr_r ( DivRemOpcode :: REMU . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
83
- }
84
-
85
- pub fn div_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
86
- instr_r ( DivRem64Opcode :: DIV . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
87
- }
88
-
89
- pub fn divu_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
90
- instr_r (
91
- DivRem64Opcode :: DIVU . global_opcode ( ) . as_usize ( ) ,
92
- rd,
93
- rs1,
94
- rs2,
95
- )
96
- }
97
-
98
- pub fn rem_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
99
- instr_r ( DivRem64Opcode :: REM . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
100
- }
101
-
102
- pub fn remu_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
103
- instr_r (
104
- DivRem64Opcode :: REMU . global_opcode ( ) . as_usize ( ) ,
105
- rd,
106
- rs1,
107
- rs2,
108
- )
109
- }
110
-
71
+ #[ cfg( test) ]
111
72
pub fn xor < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
112
73
instr_r ( BaseAluOpcode :: XOR . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
113
74
}
@@ -116,6 +77,7 @@ pub fn or<F: PrimeField32>(rd: usize, rs1: usize, rs2: usize) -> Instruction<F>
116
77
instr_r ( BaseAluOpcode :: OR . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
117
78
}
118
79
80
+ #[ cfg( test) ]
119
81
pub fn and < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
120
82
instr_r ( BaseAluOpcode :: AND . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
121
83
}
@@ -140,10 +102,6 @@ pub fn shr_u_imm<F: PrimeField32>(rd: usize, rs1: usize, imm: F) -> Instruction<
140
102
instr_i ( ShiftOpcode :: SRL . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
141
103
}
142
104
143
- pub fn shr_s < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
144
- instr_r ( ShiftOpcode :: SRA . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
145
- }
146
-
147
105
pub fn shr_s_imm < F : PrimeField32 > ( rd : usize , rs1 : usize , imm : F ) -> Instruction < F > {
148
106
instr_i ( ShiftOpcode :: SRA . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
149
107
}
@@ -161,10 +119,6 @@ pub fn shr_u_64<F: PrimeField32>(rd: usize, rs1: usize, rs2: usize) -> Instructi
161
119
instr_r ( Shift64Opcode :: SRL . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
162
120
}
163
121
164
- pub fn shr_s_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
165
- instr_r ( Shift64Opcode :: SRA . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
166
- }
167
-
168
122
pub fn shr_s_imm_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , imm : F ) -> Instruction < F > {
169
123
instr_i ( Shift64Opcode :: SRA . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
170
124
}
@@ -251,22 +205,10 @@ pub fn eqi<F: PrimeField32>(rd: usize, rs1: usize, imm: F) -> Instruction<F> {
251
205
instr_i ( EqOpcode :: EQ . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
252
206
}
253
207
254
- pub fn neq < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
255
- instr_r ( EqOpcode :: NEQ . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
256
- }
257
-
258
- pub fn eq_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
259
- instr_r ( Eq64Opcode :: EQ . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
260
- }
261
-
262
208
pub fn eqi_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , imm : F ) -> Instruction < F > {
263
209
instr_i ( Eq64Opcode :: EQ . global_opcode ( ) . as_usize ( ) , rd, rs1, imm)
264
210
}
265
211
266
- pub fn neq_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
267
- instr_r ( Eq64Opcode :: NEQ . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
268
- }
269
-
270
212
pub fn const_32_imm < F : PrimeField32 > (
271
213
target_reg : usize ,
272
214
imm_lo : u16 ,
@@ -286,15 +228,6 @@ pub fn const_32_imm<F: PrimeField32>(
286
228
)
287
229
}
288
230
289
- pub fn add_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
290
- instr_r (
291
- BaseAlu64Opcode :: ADD . global_opcode ( ) . as_usize ( ) ,
292
- rd,
293
- rs1,
294
- rs2,
295
- )
296
- }
297
-
298
231
#[ allow( dead_code) ]
299
232
pub fn addi_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , imm : F ) -> Instruction < F > {
300
233
instr_i (
@@ -314,28 +247,10 @@ pub fn sub_64<F: PrimeField32>(rd: usize, rs1: usize, rs2: usize) -> Instruction
314
247
)
315
248
}
316
249
317
- pub fn xor_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
318
- instr_r (
319
- BaseAlu64Opcode :: XOR . global_opcode ( ) . as_usize ( ) ,
320
- rd,
321
- rs1,
322
- rs2,
323
- )
324
- }
325
-
326
250
pub fn or_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
327
251
instr_r ( BaseAlu64Opcode :: OR . global_opcode ( ) . as_usize ( ) , rd, rs1, rs2)
328
252
}
329
253
330
- pub fn and_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , rs2 : usize ) -> Instruction < F > {
331
- instr_r (
332
- BaseAlu64Opcode :: AND . global_opcode ( ) . as_usize ( ) ,
333
- rd,
334
- rs1,
335
- rs2,
336
- )
337
- }
338
-
339
254
pub fn andi_64 < F : PrimeField32 > ( rd : usize , rs1 : usize , imm : F ) -> Instruction < F > {
340
255
instr_i (
341
256
BaseAlu64Opcode :: AND . global_opcode ( ) . as_usize ( ) ,
0 commit comments