From 9e60ee25676e8e2dd0e9c45ecf7fda6b5cc49f3e Mon Sep 17 00:00:00 2001 From: Dmitry Vagner Date: Mon, 13 Feb 2023 11:25:46 -0800 Subject: [PATCH] segment --- .../cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm | 8 ++++++++ evm/src/memory/segments.rs | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/evm/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm b/evm/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm index 2543878c..e1f043f1 100644 --- a/evm/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm +++ b/evm/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm @@ -1,3 +1,11 @@ +// Load a single value from bn254 pairings memory. +%macro mload_bn254_pairings + // stack: offset + %mload_kernel(@SEGMENT_BN254_PAIRINGS) + // stack: value +%endmacro + + // fp254_2 macros %macro load_fp254_2 diff --git a/evm/src/memory/segments.rs b/evm/src/memory/segments.rs index a632e40f..51c5f64d 100644 --- a/evm/src/memory/segments.rs +++ b/evm/src/memory/segments.rs @@ -40,10 +40,11 @@ pub(crate) enum Segment { ShiftTable = 16, JumpdestBits = 17, EcdsaTable = 18, + BN254Pairings = 19, } impl Segment { - pub(crate) const COUNT: usize = 19; + pub(crate) const COUNT: usize = 20; pub(crate) fn all() -> [Self; Self::COUNT] { [ @@ -66,6 +67,7 @@ impl Segment { Self::ShiftTable, Self::JumpdestBits, Self::EcdsaTable, + Self::BN254Pairings, ] } @@ -91,6 +93,7 @@ impl Segment { Segment::ShiftTable => "SEGMENT_SHIFT_TABLE", Segment::JumpdestBits => "SEGMENT_JUMPDEST_BITS", Segment::EcdsaTable => "SEGMENT_KERNEL_ECDSA_TABLE", + Segment::BN254Pairings => "SEGMENT_BN254_PAIRINGS", } } @@ -116,6 +119,7 @@ impl Segment { Segment::ShiftTable => 256, Segment::JumpdestBits => 1, Segment::EcdsaTable => 256, + Segment::BN254Pairings => 256, } } }