@@ -38,8 +38,6 @@ pub struct WomirIConfig {
38
38
pub system : SystemConfig ,
39
39
#[ extension]
40
40
pub base : WomirI ,
41
- #[ extension]
42
- pub io : WomirIo ,
43
41
}
44
42
45
43
// Default implementation uses no init file
@@ -63,7 +61,6 @@ impl Default for WomirIConfig {
63
61
Self {
64
62
system,
65
63
base : Default :: default ( ) ,
66
- io : Default :: default ( ) ,
67
64
}
68
65
}
69
66
}
@@ -76,7 +73,6 @@ impl WomirIConfig {
76
73
Self {
77
74
system,
78
75
base : Default :: default ( ) ,
79
- io : Default :: default ( ) ,
80
76
}
81
77
}
82
78
@@ -88,7 +84,6 @@ impl WomirIConfig {
88
84
Self {
89
85
system,
90
86
base : Default :: default ( ) ,
91
- io : Default :: default ( ) ,
92
87
}
93
88
}
94
89
}
@@ -115,10 +110,6 @@ impl WomirImConfig {
115
110
#[ derive( Clone , Copy , Debug , Default , Serialize , Deserialize ) ]
116
111
pub struct WomirI ;
117
112
118
- /// Extension similar to RISC-V for handling IO (not to be confused with I base extension)
119
- #[ derive( Clone , Copy , Debug , Default , Serialize , Deserialize ) ]
120
- pub struct WomirIo ;
121
-
122
113
/// Extension similar to RISC-V 32-bit Multiplication Extension (RV32M)
123
114
#[ derive( Clone , Copy , Debug , Serialize , Deserialize ) ]
124
115
pub struct WomirM {
@@ -149,6 +140,7 @@ pub enum WomirIExecutor<F: PrimeField32> {
149
140
CopyIntoFrame ( CopyIntoFrameChipWom < F > ) ,
150
141
Const32 ( ConstsChipWom < F > ) ,
151
142
LessThan ( LessThanChipWom < F > ) ,
143
+ HintStore ( HintStoreChip < F > ) ,
152
144
// Shift(Rv32ShiftChip<F>),
153
145
// LoadStore(Rv32LoadStoreChip<F>),
154
146
// LoadSignExtend(Rv32LoadSignExtendChip<F>),
@@ -166,12 +158,6 @@ pub enum WomirMExecutor<F: PrimeField32> {
166
158
DivRem ( Rv32DivRemChip < F > ) ,
167
159
}
168
160
169
- /// RISC-V 32-bit Io Instruction Executors
170
- #[ derive( ChipUsageGetter , Chip , InstructionExecutor , From , AnyEnum ) ]
171
- pub enum WomirIoExecutor < F : PrimeField32 > {
172
- HintStore ( Rv32HintStoreChip < F > ) ,
173
- }
174
-
175
161
#[ derive( From , ChipUsageGetter , Chip , AnyEnum ) ]
176
162
pub enum WomirIPeriphery < F : PrimeField32 > {
177
163
BitwiseOperationLookup ( SharedBitwiseOperationLookupChip < 8 > ) ,
@@ -188,13 +174,6 @@ pub enum WomirMPeriphery<F: PrimeField32> {
188
174
Phantom ( PhantomChip < F > ) ,
189
175
}
190
176
191
- #[ derive( From , ChipUsageGetter , Chip , AnyEnum ) ]
192
- pub enum WomirIoPeriphery < F : PrimeField32 > {
193
- BitwiseOperationLookup ( SharedBitwiseOperationLookupChip < 8 > ) ,
194
- // We put this only to get the <F> generic to work
195
- Phantom ( PhantomChip < F > ) ,
196
- }
197
-
198
177
// ============ VmExtension Implementations ============
199
178
200
179
impl < F : PrimeField32 > VmExtension < F > for WomirI {
@@ -308,7 +287,25 @@ impl<F: PrimeField32> VmExtension<F> for WomirI {
308
287
shared_fp. clone ( ) ,
309
288
) ;
310
289
inventory. add_executor ( lt_chip, LessThanOpcode :: iter ( ) . map ( |x| x. global_opcode ( ) ) ) ?;
311
- //
290
+
291
+ let mut hintstore_chip = HintStoreChip :: new (
292
+ execution_bus,
293
+ frame_bus,
294
+ program_bus,
295
+ bitwise_lu_chip. clone ( ) ,
296
+ memory_bridge,
297
+ offline_memory. clone ( ) ,
298
+ shared_fp. clone ( ) ,
299
+ builder. system_config ( ) . memory_config . pointer_max_bits ,
300
+ HintStoreOpcode :: CLASS_OFFSET ,
301
+ ) ;
302
+ hintstore_chip. set_streams ( builder. streams ( ) . clone ( ) ) ;
303
+
304
+ inventory. add_executor (
305
+ hintstore_chip,
306
+ HintStoreOpcode :: iter ( ) . map ( |x| x. global_opcode ( ) ) ,
307
+ ) ?;
308
+
312
309
// let shift_chip = Rv32ShiftChip::new(
313
310
// Rv32WomBaseAluAdapterChip::new(
314
311
// execution_bus,
@@ -507,54 +504,6 @@ impl<F: PrimeField32> VmExtension<F> for WomirM {
507
504
}
508
505
}
509
506
510
- impl < F : PrimeField32 > VmExtension < F > for WomirIo {
511
- type Executor = WomirIoExecutor < F > ;
512
- type Periphery = WomirIoPeriphery < F > ;
513
-
514
- fn build (
515
- & self ,
516
- builder : & mut VmInventoryBuilder < F > ,
517
- ) -> Result < VmInventory < Self :: Executor , Self :: Periphery > , VmInventoryError > {
518
- let mut inventory = VmInventory :: new ( ) ;
519
- let SystemPort {
520
- execution_bus,
521
- program_bus,
522
- memory_bridge,
523
- } = builder. system_port ( ) ;
524
- let offline_memory = builder. system_base ( ) . offline_memory ( ) ;
525
-
526
- let bitwise_lu_chip = if let Some ( & chip) = builder
527
- . find_chip :: < SharedBitwiseOperationLookupChip < 8 > > ( )
528
- . first ( )
529
- {
530
- chip. clone ( )
531
- } else {
532
- let bitwise_lu_bus = BitwiseOperationLookupBus :: new ( builder. new_bus_idx ( ) ) ;
533
- let chip = SharedBitwiseOperationLookupChip :: new ( bitwise_lu_bus) ;
534
- inventory. add_periphery_chip ( chip. clone ( ) ) ;
535
- chip
536
- } ;
537
-
538
- let mut hintstore_chip = Rv32HintStoreChip :: new (
539
- execution_bus,
540
- program_bus,
541
- bitwise_lu_chip. clone ( ) ,
542
- memory_bridge,
543
- offline_memory. clone ( ) ,
544
- builder. system_config ( ) . memory_config . pointer_max_bits ,
545
- HintStoreOpcode :: CLASS_OFFSET ,
546
- ) ;
547
- hintstore_chip. set_streams ( builder. streams ( ) . clone ( ) ) ;
548
-
549
- inventory. add_executor (
550
- hintstore_chip,
551
- HintStoreOpcode :: iter ( ) . map ( |x| x. global_opcode ( ) ) ,
552
- ) ?;
553
-
554
- Ok ( inventory)
555
- }
556
- }
557
-
558
507
/// Phantom sub-executors
559
508
mod phantom {
560
509
use eyre:: bail;
@@ -590,22 +539,23 @@ mod phantom {
590
539
_: F ,
591
540
_: u16 ,
592
541
) -> eyre:: Result < ( ) > {
593
- let mut hint = match streams. input_stream . pop_front ( ) {
542
+ let hint = match streams. input_stream . pop_front ( ) {
594
543
Some ( hint) => hint,
595
544
None => {
596
545
bail ! ( "EndOfInputStream" ) ;
597
546
}
598
547
} ;
599
548
streams. hint_stream . clear ( ) ;
600
- streams. hint_stream . extend (
601
- ( hint. len ( ) as u32 )
602
- . to_le_bytes ( )
603
- . iter ( )
604
- . map ( |b| F :: from_canonical_u8 ( * b) ) ,
605
- ) ;
606
- // Extend by 0 for 4 byte alignment
607
- let capacity = hint. len ( ) . div_ceil ( 4 ) * 4 ;
608
- hint. resize ( capacity, F :: ZERO ) ;
549
+ // TODO add this back when we support generic read over serialized data.
550
+ // streams.hint_stream.extend(
551
+ // (hint.len() as u32)
552
+ // .to_le_bytes()
553
+ // .iter()
554
+ // .map(|b| F::from_canonical_u8(*b)),
555
+ // );
556
+ // // Extend by 0 for 4 byte alignment
557
+ // let capacity = hint.len().div_ceil(4) * 4;
558
+ // hint.resize(capacity, F::ZERO);
609
559
streams. hint_stream . extend ( hint) ;
610
560
Ok ( ( ) )
611
561
}
0 commit comments