Skip to main content

Instruction

Enum Instruction 

Source
pub enum Instruction {
Show 21 variants Pop, Swap, Return, ConstLoc(u64), ConstLane(u64), ConstZone(u32), InitialFill(u32), Fill(u32), Move(u32), LocalRz(u32), LocalR(u32), GlobalRz, GlobalR, Cz, Measure(u32), AwaitMeasure, NewArray(u32, u32, u32), GetItem(u32), SetDetector, SetObservable, Cpu(Instruction),
}
Expand description

The Bloqade Lanes instruction set, defined on the vihaco framework.

Device operands use only the scalar types vihaco implements byte traits for (u32, u64, i64, f64); the legacy u8/u16 array operands are widened to u32. CPU ops are reused from [vihaco_cpu] via the nested Cpu variant (see module docs).

Variant order is significant. It is both the encoded opcode order and the text parser’s try-order; a token that is a prefix of another must be declared after the longer token (hence *_rz precedes *_r), and the #[delegate] Cpu variant is declared last so device-specific tokens (e.g. get_item <n>) win over any vihaco-cpu token they would otherwise shadow.

Variants§

§

Pop

§

Swap

§

Return

§

ConstLoc(u64)

§

ConstLane(u64)

§

ConstZone(u32)

§

InitialFill(u32)

§

Fill(u32)

§

Move(u32)

§

LocalRz(u32)

§

LocalR(u32)

§

GlobalRz

§

GlobalR

§

Cz

§

Measure(u32)

§

AwaitMeasure

§

NewArray(u32, u32, u32)

§

GetItem(u32)

§

SetDetector

§

SetObservable

§

Cpu(Instruction)

Implementations§

Source§

impl Instruction

Source

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

Canonical opcode name used for decode dispatch (the Python decoder calls _visit_{op_name}) and introspection.

For lanes-native ops this equals the parser #[token] / Display mnemonic. For nested vihaco-cpu ops it returns the decode-handler name (const_float/const_int/dup/halt), which deliberately differs from the vihaco-cpu text syntax (const.f64, …) because decode handler method names cannot contain ..

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Instruction

Source§

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

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

impl Display for Instruction

Source§

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

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

impl FromBytesWithOpcode for Instruction

Source§

fn from_bytes_with_opcode<R: Read>(bytes: &mut R, opcode: u8) -> Result<Self>

Source§

impl OpCode for Instruction

Source§

fn width() -> u32

Source§

fn opcode(&self) -> u8

Source§

impl<'src> Parse<'src> for Instruction

Source§

fn parser() -> impl Parser<'src, &'src str, Self, Err<Simple<'src, char>>>

Source§

impl PartialEq for Instruction

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 WriteBytes for Instruction

Source§

fn write_bytes<W: Write>(&self, io: &mut W) -> Result<()>

Source§

impl StructuralPartialEq for Instruction

Auto Trait Implementations§

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.

§

impl<T> FromBytes for T
where T: FromBytesWithOpcode,

§

fn from_bytes<R>(bytes: &mut R) -> Result<T, Report>
where R: Read,

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.

§

impl<'src, T> IntoMaybe<'src, T> for T
where T: 'src,

§

type Proj<U: 'src> = U

§

fn map_maybe<R>( self, _f: impl FnOnce(&'src T) -> &'src R, g: impl FnOnce(T) -> R, ) -> <T as IntoMaybe<'src, T>>::Proj<R>
where R: 'src,

§

impl<'p, T> Seq<'p, T> for T
where T: Clone,

§

type Item<'a> = &'a T where T: 'a

The item yielded by the iterator.
§

type Iter<'a> = Once<&'a T> where T: 'a

An iterator over the items within this container, by reference.
§

fn seq_iter(&self) -> <T as Seq<'p, T>>::Iter<'_>

Iterate over the elements of the container.
§

fn contains(&self, val: &T) -> bool
where T: PartialEq,

Check whether an item is contained within this sequence.
§

fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>
where 'p: 'b,

Convert an item of the sequence into a [MaybeRef].
§

impl<T> Themed for T
where T: Display,

§

fn ty(&self) -> Decorated<'_, Self>

§

fn target(&self) -> Decorated<'_, Self>

§

fn keyword(&self) -> Decorated<'_, Self>

§

fn symbol(&self) -> Decorated<'_, Self>

§

fn at_symbol(&self) -> Decorated<'_, Self>

§

fn comment(&self) -> Decorated<'_, Self>

§

fn instruction(&self) -> Decorated<'_, Self>

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<T> Instruction for T
where T: OpCode + FromBytes + WriteBytes,

§

impl<T> OrderedSeq<'_, T> for T
where T: Clone,