openvm_ecc_circuit/
lib.rs

1#![cfg_attr(feature = "tco", allow(incomplete_features))]
2#![cfg_attr(feature = "tco", feature(explicit_tail_calls))]
3#![cfg_attr(feature = "tco", allow(internal_features))]
4#![cfg_attr(feature = "tco", feature(core_intrinsics))]
5use openvm_circuit::arch::DEFAULT_BLOCK_SIZE;
6#[cfg(feature = "cuda")]
7use {
8    openvm_mod_circuit_builder::FieldExpressionCoreRecordMut,
9    openvm_rv32_adapters::Rv32VecHeapAdapterRecord,
10};
11
12mod extension;
13mod weierstrass_chip;
14
15pub use extension::*;
16// Re-export limb constants from algebra for consistency
17pub use openvm_algebra_circuit::{NUM_LIMBS_32, NUM_LIMBS_48};
18pub use weierstrass_chip::*;
19
20// Blocks per ECC operation (2 coordinates per point)
21/// Blocks for ECC with 32-limb coordinates: 2 * (32 / 4) = 16 blocks
22pub const ECC_BLOCKS_32: usize = 2 * (NUM_LIMBS_32 / DEFAULT_BLOCK_SIZE);
23/// Blocks for ECC with 48-limb coordinates: 2 * (48 / 4) = 24 blocks
24pub const ECC_BLOCKS_48: usize = 2 * (NUM_LIMBS_48 / DEFAULT_BLOCK_SIZE);
25
26#[cfg(feature = "cuda")]
27pub(crate) type EccRecord<
28    'a,
29    const NUM_READS: usize,
30    const BLOCKS: usize,
31    const BLOCK_SIZE: usize,
32> = (
33    &'a mut Rv32VecHeapAdapterRecord<NUM_READS, BLOCKS, BLOCKS, BLOCK_SIZE, BLOCK_SIZE>,
34    FieldExpressionCoreRecordMut<'a>,
35);