-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add utils mod for constants needed accross brainfuck_prover (#50)
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod brainfuck_air; | ||
pub mod components; | ||
pub mod utils; |
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,21 @@ | ||
use stwo_prover::core::fields::m31::BaseField; | ||
|
||
pub const SHIFT_RIGHT_INSTRUCTION: u32 = b'>' as u32; | ||
pub const SHIFT_LEFT_INSTRUCTION: u32 = b'<' as u32; | ||
pub const INCREMENT_INSTRUCTION: u32 = b'+' as u32; | ||
pub const DECREMENT_INSTRUCTION: u32 = b'-' as u32; | ||
pub const INPUT_INSTRUCTION: u32 = b',' as u32; | ||
pub const OUTPUT_INSTRUCTION: u32 = b'.' as u32; | ||
pub const JUMP_IF_ZERO_INSTRUCTION: u32 = b'[' as u32; | ||
pub const JUMP_IF_NON_ZERO_INSTRUCTION: u32 = b']' as u32; | ||
|
||
pub const VALID_INSTRUCTIONS: [BaseField; 8] = [ | ||
BaseField::from_u32_unchecked(SHIFT_RIGHT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(SHIFT_LEFT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(INCREMENT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(DECREMENT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(INPUT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(OUTPUT_INSTRUCTION), | ||
BaseField::from_u32_unchecked(JUMP_IF_ZERO_INSTRUCTION), | ||
BaseField::from_u32_unchecked(JUMP_IF_NON_ZERO_INSTRUCTION), | ||
]; |