This repository has been archived by the owner on Apr 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0ce48c
commit 8dd220a
Showing
7 changed files
with
44 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use crate::native_types::{Expression, Witness}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Hash, Copy, Default)] | ||
pub struct BlockId(pub u32); | ||
|
||
/// Operation on a block of memory | ||
/// We can either write or read at an index in memory | ||
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] | ||
pub struct MemOp { | ||
/// Can be 0 (read) or 1 (write) | ||
pub operation: Expression, | ||
pub index: Expression, | ||
pub value: Expression, | ||
} | ||
|
||
impl MemOp { | ||
/// Creates a `MemOp` which reads from memory at `index` and inserts the read value | ||
/// into the [`WitnessMap`][crate::native_types::WitnessMap] at `witness` | ||
pub fn read_at_mem_index(index: Expression, witness: Witness) -> Self { | ||
MemOp { operation: Expression::zero(), index, value: witness.into() } | ||
} | ||
|
||
/// Creates a `MemOp` which writes the [`Expression`] `value` into memory at `index`. | ||
pub fn write_to_mem_index(index: Expression, value: Expression) -> Self { | ||
MemOp { operation: Expression::one(), index, value } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters