pub enum Instruction {
Cpu(CpuInstruction),
LaneConst(LaneConstInstruction),
AtomArrangement(AtomArrangementInstruction),
QuantumGate(QuantumGateInstruction),
Measurement(MeasurementInstruction),
Array(ArrayInstruction),
DetectorObservable(DetectorObservableInstruction),
}Expand description
A single bytecode instruction.
Each variant wraps a device-specific instruction enum. The instruction can be encoded to a 16-byte binary word or printed as SST text assembly.
Variants§
Cpu(CpuInstruction)
CPU/stack operations (device 0x00).
LaneConst(LaneConstInstruction)
Lane address constants (device 0x0F).
AtomArrangement(AtomArrangementInstruction)
Atom arrangement operations (device 0x10).
QuantumGate(QuantumGateInstruction)
Quantum gate operations (device 0x11).
Measurement(MeasurementInstruction)
Measurement operations (device 0x12).
Array(ArrayInstruction)
Array operations (device 0x13).
DetectorObservable(DetectorObservableInstruction)
Detector/observable setup (device 0x14).
Implementations§
Source§impl Instruction
impl Instruction
Sourcepub fn encode(&self) -> (u32, u32, u32, u32)
pub fn encode(&self) -> (u32, u32, u32, u32)
Encode instruction into (opcode, data0, data1, data2).
Opcode word layout: [unused:16][instruction_code:8][device_code:8]
Sourcepub fn decode(
word: u32,
data0: u32,
data1: u32,
_data2: u32,
) -> Result<Self, DecodeError>
pub fn decode( word: u32, data0: u32, data1: u32, _data2: u32, ) -> Result<Self, DecodeError>
Decode an instruction from (opcode_word, data0, data1, data2).
Sourcepub fn from_bytes(bytes: &[u8; 16]) -> Result<Self, DecodeError>
pub fn from_bytes(bytes: &[u8; 16]) -> Result<Self, DecodeError>
Decode from 16 little-endian bytes.
Source§impl Instruction
impl Instruction
Sourcepub fn opcode(&self) -> u16
pub fn opcode(&self) -> u16
Returns the packed opcode as a u16: (instruction_code << 8) | device_code.
Sourcepub fn device_code(&self) -> DeviceCode
pub fn device_code(&self) -> DeviceCode
Returns the device code for this instruction.
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more