Skip to main content

ScOp

Enum ScOp 

Source
pub enum ScOp {
Show 16 variants Input { id: ValueId, name: String, ty: ScType, }, Output { id: ValueId, name: String, source: ValueId, }, Constant { id: ValueId, value: ScConst, ty: ScType, }, Encode { id: ValueId, prob: ValueId, length: usize, seed: u16, }, BitwiseAnd { id: ValueId, lhs: ValueId, rhs: ValueId, }, Popcount { id: ValueId, input: ValueId, }, LifStep { id: ValueId, current: ValueId, leak: ValueId, gain: ValueId, noise: ValueId, params: LifParams, }, DenseForward { id: ValueId, inputs: ValueId, weights: ValueId, leak: ValueId, gain: ValueId, params: DenseParams, }, BitwiseXor { id: ValueId, lhs: ValueId, rhs: ValueId, }, Reduce { id: ValueId, input: ValueId, mode: ReduceMode, }, GraphForward { id: ValueId, features: ValueId, adjacency: ValueId, n_nodes: usize, n_features: usize, }, SoftmaxAttention { id: ValueId, q: ValueId, k: ValueId, v: ValueId, dim_k: usize, }, KuramotoStep { id: ValueId, phases: ValueId, omega: ValueId, coupling: ValueId, dt: f64, }, Scale { id: ValueId, input: ValueId, factor: f64, }, Offset { id: ValueId, input: ValueId, offset: f64, }, DivConst { id: ValueId, input: ValueId, divisor: u64, },
}
Expand description

A single operation in the SC compute graph.

Each variant produces exactly one value identified by id. Input operands reference values produced by earlier operations.

Variants§

§

Input

Module input port. No operands; value comes from external I/O.

Fields

§name: String
§

Output

Module output port. Consumes one value; no new value produced. id is a dummy (not referenced by other ops).

Fields

§name: String
§source: ValueId
§

Constant

Compile-time constant.

Fields

§value: ScConst
§

Encode

Encode a probability (Rate or FixedPoint) into a Bitstream. Maps to sc_bitstream_encoder in HDL.

Fields

§prob: ValueId

Input probability value.

§length: usize

Bitstream length.

§seed: u16

LFSR seed parameter name (resolved from graph params).

§

BitwiseAnd

Bitwise AND of two bitstreams (stochastic multiply). Maps to sc_bitstream_synapse in HDL.

Fields

§

Popcount

Population count: count 1-bits in a bitstream. Part of sc_dotproduct_to_current in HDL.

Fields

§input: ValueId
§

LifStep

Single LIF neuron step. Maps to sc_lif_neuron in HDL.

Fields

§current: ValueId

Input current (FixedPoint).

§leak: ValueId

Leak coefficient (FixedPoint).

§gain: ValueId

Input gain coefficient (FixedPoint).

§noise: ValueId

External noise (FixedPoint, can be zero constant).

§params: LifParams

Neuron parameters.

§

DenseForward

Dense SC layer: N_INPUTS → N_NEURONS with full SC pipeline. Maps to sc_dense_layer_core in HDL.

Fields

§inputs: ValueId

Input values (Vec<Rate> or Vec<FixedPoint>).

§weights: ValueId

Weight matrix (Vec<Rate> or Vec<FixedPoint>), row-major [n_neurons × n_inputs].

§leak: ValueId

Leak coefficient for all neurons.

§gain: ValueId

Gain coefficient for all neurons.

§params: DenseParams

Layer parameters.

§

BitwiseXor

Bitwise XOR of two bitstreams (HDC binding).

Fields

§

Reduce

Reduce a vector to a scalar (Sum or Max).

Fields

§input: ValueId
§

GraphForward

Graph forward: input features × adjacency → aggregated output.

Fields

§features: ValueId
§adjacency: ValueId
§n_nodes: usize
§n_features: usize
§

SoftmaxAttention

Softmax attention: Q·K^T/sqrt(d) → softmax → ·V.

§

KuramotoStep

Single Kuramoto integration step: dθ/dt = ω + ΣK sin(θ_m - θ_n).

Fields

§phases: ValueId
§omega: ValueId
§coupling: ValueId
§dt: f64
§

Scale

Scale a value by a constant: output = input * factor.

Fields

§input: ValueId
§factor: f64
§

Offset

Offset a value by a constant: output = input + offset.

Fields

§input: ValueId
§offset: f64
§

DivConst

Integer division by a constant (for rate computation).

Fields

§input: ValueId
§divisor: u64

Implementations§

Source§

impl ScOp

Source

pub fn result_id(&self) -> ValueId

Return the ValueId produced by this operation.

Source

pub fn operands(&self) -> Vec<ValueId>

Return all ValueIds consumed by this operation.

Source

pub fn op_name(&self) -> &'static str

Human-readable operation name for the text format.

Trait Implementations§

Source§

impl Clone for ScOp

Source§

fn clone(&self) -> ScOp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScOp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ScOp

Source§

fn eq(&self, other: &ScOp) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ScOp

Auto Trait Implementations§

§

impl Freeze for ScOp

§

impl RefUnwindSafe for ScOp

§

impl Send for ScOp

§

impl Sync for ScOp

§

impl Unpin for ScOp

§

impl UnsafeUnpin for ScOp

§

impl UnwindSafe for ScOp

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Ungil for T
where T: Send,