Skip to content

Commit

Permalink
Import alloc_scratch
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmr1993 committed Dec 4, 2023
1 parent bb4076b commit 228b1b6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions optimism/src/mips/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ pub enum ITypeInstruction {
}

pub trait InterpreterEnv {
type Position;

fn alloc_scratch(&mut self) -> Self::Position;

type Variable: Clone
+ std::ops::Add<Self::Variable, Output = Self::Variable>
+ std::ops::Mul<Self::Variable, Output = Self::Variable>
Expand Down
8 changes: 8 additions & 0 deletions optimism/src/mips/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ fn memory_size(total: usize) -> String {
}

impl<Fp: Field> InterpreterEnv for Env<Fp> {
type Position = Column;

fn alloc_scratch(&mut self) -> Self::Position {
let scratch_idx = self.scratch_state_idx;
self.scratch_state_idx += 1;
Column::ScratchState(scratch_idx)
}

type Variable = u32;

fn overwrite_register_checked(
Expand Down

0 comments on commit 228b1b6

Please sign in to comment.