#[non_exhaustive]pub enum Instr<Id>where
Id: SiteId,{
Ctrl(CtrlInstr<Id>),
Gfa(FieldInstr),
Usonic(UsonicInstr),
Reserved(ReservedInstr),
}
Expand description
Complete AluVM instruction set for the Ultrasonic virtual machine, which includes the following architectures:
- Base ALU control architecture
GFA256
(256-bit Galois-field arithmetics).USONIC
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Ctrl(CtrlInstr<Id>)
Control flow instructions (base ALU ISA)..
Gfa(FieldInstr)
GFA256` (256-bit Galois-field arithmetics).
Usonic(UsonicInstr)
USONIC ISA.
Reserved(ReservedInstr)
Reserved instruction for future use in core ALU
ISAs.
Trait Implementations§
Source§impl<Id> Bytecode<Id> for Instr<Id>where
Id: SiteId,
impl<Id> Bytecode<Id> for Instr<Id>where
Id: SiteId,
Source§fn op_range() -> RangeInclusive<u8>
fn op_range() -> RangeInclusive<u8>
Returns the range of instruction bytecodes covered by a set of operations.
Source§fn opcode_byte(&self) -> u8
fn opcode_byte(&self) -> u8
Returns byte representing instruction code (without its arguments).
Source§fn code_byte_len(&self) -> u16
fn code_byte_len(&self) -> u16
Returns the number of bytes used by the instruction and its arguments when serialized into
the code segment.
Source§fn external_ref(&self) -> Option<Id>
fn external_ref(&self) -> Option<Id>
If the instruction calls or references any external program, returns a reference to it.
Source§fn encode_operands<W>(
&self,
writer: &mut W,
) -> Result<(), <W as BytecodeWrite<Id>>::Error>where
W: BytecodeWrite<Id>,
fn encode_operands<W>(
&self,
writer: &mut W,
) -> Result<(), <W as BytecodeWrite<Id>>::Error>where
W: BytecodeWrite<Id>,
Writes an instruction operands as bytecode, omitting opcode byte.
Source§fn decode_operands<R>(
reader: &mut R,
opcode: u8,
) -> Result<Instr<Id>, CodeEofError>
fn decode_operands<R>( reader: &mut R, opcode: u8, ) -> Result<Instr<Id>, CodeEofError>
Reads an instruction operands from bytecode, provided the opcode byte.
Source§fn encode_instr<W>(
&self,
writer: &mut W,
) -> Result<(), <W as BytecodeWrite<Id>>::Error>where
W: BytecodeWrite<Id>,
fn encode_instr<W>(
&self,
writer: &mut W,
) -> Result<(), <W as BytecodeWrite<Id>>::Error>where
W: BytecodeWrite<Id>,
Write an instruction as bytecode.
Source§fn decode_instr<R>(reader: &mut R) -> Result<Self, CodeEofError>where
Self: Sized,
R: BytecodeRead<Id>,
fn decode_instr<R>(reader: &mut R) -> Result<Self, CodeEofError>where
Self: Sized,
R: BytecodeRead<Id>,
Reads an instruction from bytecode.
Source§impl<Id> From<FieldInstr> for Instr<Id>where
Id: SiteId,
impl<Id> From<FieldInstr> for Instr<Id>where
Id: SiteId,
Source§fn from(v: FieldInstr) -> Instr<Id>
fn from(v: FieldInstr) -> Instr<Id>
Converts to this type from the input type.
Source§impl<Id> From<ReservedInstr> for Instr<Id>where
Id: SiteId,
impl<Id> From<ReservedInstr> for Instr<Id>where
Id: SiteId,
Source§fn from(v: ReservedInstr) -> Instr<Id>
fn from(v: ReservedInstr) -> Instr<Id>
Converts to this type from the input type.
Source§impl<Id> From<UsonicInstr> for Instr<Id>where
Id: SiteId,
impl<Id> From<UsonicInstr> for Instr<Id>where
Id: SiteId,
Source§fn from(v: UsonicInstr) -> Instr<Id>
fn from(v: UsonicInstr) -> Instr<Id>
Converts to this type from the input type.
Source§impl<Id> Instruction<Id> for Instr<Id>where
Id: SiteId,
impl<Id> Instruction<Id> for Instr<Id>where
Id: SiteId,
Source§const ISA_EXT: &'static [&'static str]
const ISA_EXT: &'static [&'static str]
The names of the ISA extension set these instructions cover.
Source§type Core = UsonicCore
type Core = UsonicCore
Extensions to the AluVM core unit provided by this instruction set.
Source§fn is_goto_target(&self) -> bool
fn is_goto_target(&self) -> bool
Whether the instruction can be used as a goto-target.
Source§fn local_goto_pos(&mut self) -> GotoTarget<'_>
fn local_goto_pos(&mut self) -> GotoTarget<'_>
If an instruction is a jump operation inside the library, it should return its goto target
position number.
Source§fn remote_goto_pos(&mut self) -> Option<&mut Site<Id>>
fn remote_goto_pos(&mut self) -> Option<&mut Site<Id>>
If an instruction is a jump operation into an external library, it should return its remote
target.
Source§fn src_regs(
&self,
) -> BTreeSet<<<Instr<Id> as Instruction<Id>>::Core as CoreExt>::Reg>
fn src_regs( &self, ) -> BTreeSet<<<Instr<Id> as Instruction<Id>>::Core as CoreExt>::Reg>
List of registers which value is taken into account by the instruction.
Source§fn dst_regs(
&self,
) -> BTreeSet<<<Instr<Id> as Instruction<Id>>::Core as CoreExt>::Reg>
fn dst_regs( &self, ) -> BTreeSet<<<Instr<Id> as Instruction<Id>>::Core as CoreExt>::Reg>
List of registers which value may be changed by the instruction.
Source§fn op_data_bytes(&self) -> u16
fn op_data_bytes(&self) -> u16
The size of the data coming as an instruction operand (i.e., except data coming from
registers or read from outside the instruction operands).
Source§fn ext_data_bytes(&self) -> u16
fn ext_data_bytes(&self) -> u16
The size of the data read by the instruction from outside the registers (except data coming
as a parameter).
Source§fn exec(
&self,
site: Site<Id>,
core: &mut Core<Id, <Instr<Id> as Instruction<Id>>::Core>,
context: &<Instr<Id> as Instruction<Id>>::Context<'_>,
) -> ExecStep<Site<Id>>
fn exec( &self, site: Site<Id>, core: &mut Core<Id, <Instr<Id> as Instruction<Id>>::Core>, context: &<Instr<Id> as Instruction<Id>>::Context<'_>, ) -> ExecStep<Site<Id>>
Executes the given instruction taking all registers as input and output. Read more
Source§fn isa_ext() -> Confined<BTreeSet<IsaId>, amplify::::collection::confinement::TinyOrdSet::{constant#0}, amplify::::collection::confinement::TinyOrdSet::{constant#1}>
fn isa_ext() -> Confined<BTreeSet<IsaId>, amplify::::collection::confinement::TinyOrdSet::{constant#0}, amplify::::collection::confinement::TinyOrdSet::{constant#1}>
Convert the set of ISA extensions from
Self::ISA_EXT
into a set of IsaId
.Source§fn regs(&self) -> BTreeSet<<Self::Core as CoreExt>::Reg>
fn regs(&self) -> BTreeSet<<Self::Core as CoreExt>::Reg>
Lists all registers which are used by the instruction.
Source§fn src_reg_bytes(&self) -> u16
fn src_reg_bytes(&self) -> u16
The number of bytes in the source registers.
Source§fn dst_reg_bytes(&self) -> u16
fn dst_reg_bytes(&self) -> u16
The number of bytes in the destination registers.
Source§fn base_complexity(&self) -> u64
fn base_complexity(&self) -> u64
Computes base (non-adjusted) complexity of the instruction. Read more
Source§fn complexity(&self) -> u64
fn complexity(&self) -> u64
Returns computational complexity of the instruction. Read more
impl<Id> Copy for Instr<Id>
impl<Id> Eq for Instr<Id>
impl<Id> StructuralPartialEq for Instr<Id>where
Id: SiteId,
Auto Trait Implementations§
impl<Id> Freeze for Instr<Id>where
Id: Freeze,
impl<Id> RefUnwindSafe for Instr<Id>where
Id: RefUnwindSafe,
impl<Id> Send for Instr<Id>where
Id: Send,
impl<Id> Sync for Instr<Id>where
Id: Sync,
impl<Id> Unpin for Instr<Id>where
Id: Unpin,
impl<Id> UnwindSafe for Instr<Id>where
Id: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.