mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 16:53:07 +00:00
23 lines
589 B
Rust
23 lines
589 B
Rust
use std::ops::Range;
|
|
|
|
use crate::circuit_data::CircuitConfig;
|
|
|
|
/// Represents a wire in the circuit.
|
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
|
pub struct Wire {
|
|
/// The index of the associated gate.
|
|
pub gate: usize,
|
|
/// The index of the gate input wherein this wire is inserted.
|
|
pub input: usize,
|
|
}
|
|
|
|
impl Wire {
|
|
pub fn is_routable(&self, config: &CircuitConfig) -> bool {
|
|
self.input < config.num_routed_wires
|
|
}
|
|
|
|
pub fn from_range(gate: usize, range: Range<usize>) -> Vec<Self> {
|
|
range.map(|i| Wire { gate, input: i }).collect()
|
|
}
|
|
}
|