Skip to content

Commit

Permalink
Merging feature/binary_checkpoint to develop (#104)
Browse files Browse the repository at this point in the history
* update pil to enable binary tables and pil transpilation feature

* Fixing ids

* Updating binary table

* get binary tables num rows from pil-helpers

* update pil-helpers, small fixes & improve output on binary tables, cargo update

* improve console output and remove no needed proofman-hints (#94)

* Calculate row in binary basic table SM

* Fix last binary basic SM bugs; now manual trace tests pass

* First fixes to binary extension table SM

* Fix binary extended table constants generation

* fix missalignment in opcodes

* improve binary state machines

---------

Co-authored-by: zkronos73 <[email protected]>
Co-authored-by: Héctor Masip <[email protected]>
Co-authored-by: fractasy <[email protected]>
Co-authored-by: zkronos73 <[email protected]>
  • Loading branch information
5 people authored Oct 7, 2024
1 parent 2672593 commit dfa91f3
Show file tree
Hide file tree
Showing 26 changed files with 1,018 additions and 771 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/riscof
/build
/proofs
*.pilout
*.pilout
/tmp
89 changes: 44 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ pil-std-lib = { git = "https://github.com/0xPolygonHermez/pil2-proofman.git", br
p3-field = { git = "https://github.com/Plonky3/Plonky3.git", rev = "c3d754ef77b9fce585b46b972af751fe6e7a9803" }
log = "0.4"
rayon = "1.10"
num-bigint = "0.4"
2 changes: 1 addition & 1 deletion core/src/zisk_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ macro_rules! define_ops {
define_ops! {
(Flag, "flag", Internal, 0, 0x00, opc_flag, op_flag),
(CopyB, "copyb", Internal, 0, 0x01, opc_copyb, op_copyb),
(SignExtendB, "signextend_b", BinaryE, 109, 0x22, opc_signextend_b, op_signextend_b),
(SignExtendB, "signextend_b", BinaryE, 109, 0x23, opc_signextend_b, op_signextend_b),
(SignExtendH, "signextend_h", BinaryE, 109, 0x24, opc_signextend_h, op_signextend_h),
(SignExtendW, "signextend_w", BinaryE, 109, 0x25, opc_signextend_w, op_signextend_w),
(Add, "add", Binary, 77, 0x02, opc_add, op_add),
Expand Down
11 changes: 9 additions & 2 deletions core/src/zisk_required_operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub struct ZiskRequiredBinaryBasicTable {
pub opcode: u8,
pub a: u64,
pub b: u64,
pub cin: u64,
pub last: u64,
pub row: u64,
pub multiplicity: u64,
}

#[derive(Clone, Default)]
Expand All @@ -29,6 +29,13 @@ pub struct ZiskRequiredBinaryExtensionTable {
pub a: u64,
pub b: u64,
pub offset: u64,
pub row: u64,
pub multiplicity: u64,
}

#[derive(Clone, Default)]
pub struct ZiskRequiredRangeCheck {
pub rc: u64,
}

pub struct ZiskRequired {
Expand Down
45 changes: 45 additions & 0 deletions pil/constants.pil
Original file line number Diff line number Diff line change
@@ -1,13 +1,58 @@
const int P2_1 = 2**1;
const int P2_2 = 2**2;
const int P2_3 = 2**3;
const int P2_4 = 2**4;
const int P2_5 = 2**5;
const int P2_6 = 2**6;
const int P2_7 = 2**7;
const int P2_8 = 2**8;
const int P2_9 = 2**9;
const int P2_10 = 2**10;
const int P2_11 = 2**11;
const int P2_12 = 2**12;
const int P2_13 = 2**13;
const int P2_14 = 2**14;
const int P2_15 = 2**15;
const int P2_16 = 2**16;
const int P2_17 = 2**17;
const int P2_18 = 2**18;
const int P2_19 = 2**19;
const int P2_20 = 2**20;
const int P2_21 = 2**21;
const int P2_22 = 2**22;
const int P2_23 = 2**23;
const int P2_24 = 2**24;
const int P2_31 = 2**31;
const int P2_32 = 2**32;
const int P2_63 = 2**63;
const int P2_64 = 2**64;


const int MASK_1 = P2_1 - 1;
const int MASK_2 = P2_2 - 1;
const int MASK_3 = P2_3 - 1;
const int MASK_4 = P2_4 - 1;
const int MASK_5 = P2_5 - 1;
const int MASK_6 = P2_6 - 1;
const int MASK_7 = P2_7 - 1;
const int MASK_8 = P2_8 - 1;
const int MASK_9 = P2_9 - 1;
const int MASK_10 = P2_10 - 1;
const int MASK_11 = P2_11 - 1;
const int MASK_12 = P2_12 - 1;
const int MASK_13 = P2_13 - 1;
const int MASK_14 = P2_14 - 1;
const int MASK_15 = P2_15 - 1;
const int MASK_16 = P2_16 - 1;
const int MASK_17 = P2_17 - 1;
const int MASK_18 = P2_18 - 1;
const int MASK_19 = P2_19 - 1;
const int MASK_20 = P2_20 - 1;
const int MASK_21 = P2_21 - 1;
const int MASK_22 = P2_22 - 1;
const int MASK_23 = P2_23 - 1;
const int MASK_24 = P2_24 - 1;
const int MASK_31 = P2_31 - 1;
const int MASK_32 = P2_32 - 1;
const int MASK_63 = P2_63 - 1;
const int MASK_64 = P2_64 - 1;
1 change: 1 addition & 0 deletions pil/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub const ARITH_AIRGROUP_ID: usize = 101;
pub const ARITH32_AIR_IDS: &[usize] = &[4, 5];
pub const ARITH64_AIR_IDS: &[usize] = &[6];
pub const ARITH3264_AIR_IDS: &[usize] = &[7];
pub const MEM_AIRGROUP_ID: usize = 105;
pub const MEM_ALIGN_AIR_IDS: &[usize] = &[1];
pub const MEM_UNALIGNED_AIR_IDS: &[usize] = &[2, 3];
pub const QUICKOPS_AIRGROUP_ID: usize = 102;
Expand Down
Loading

0 comments on commit dfa91f3

Please sign in to comment.