#[non_exhaustive]pub enum FieldInstr {
Test {
src: RegE,
},
Clr {
dst: RegE,
},
PutD {
dst: RegE,
data: fe256,
},
PutZ {
dst: RegE,
},
PutV {
dst: RegE,
val: ConstVal,
},
Fits {
src: RegE,
bits: Bits,
},
Mov {
dst: RegE,
src: RegE,
},
Eq {
src1: RegE,
src2: RegE,
},
Neg {
dst: RegE,
src: RegE,
},
Add {
dst_src: RegE,
src: RegE,
},
Mul {
dst_src: RegE,
src: RegE,
},
}Expand description
Arithmetic instructions for finite fields.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Test
Tests if register contains a value and is not set to None.
Sets CO register to [Status::Ok] if a register contains a value, and to [Status::Fail]
otherwise.
Doesn’t affect value in CK register.
Clr
Clears register value by setting it to None.
Doesn’t affect values in CO and CK registers.
PutD
Puts value into a register, replacing previous value in it, if there was any.
Doesn’t affect values in CO and CK registers.
PutZ
Puts zero (0) value into a register, replacing previous value in it, if there was any.
Doesn’t affect values in CO and CK registers.
PutV
Puts val value, which is a power of 2, into a register, replacing previous value in it, if
there was any.
Doesn’t affect values in CO and CK registers.
Fits
Test whether a value in a register fits in the provided number of bits.
Sets CO register to [Status::Ok] if the value fits given number of bits, and to
[Status::Fail] otherwise.
If src is set to None, sets both CO and CK to [Status::Fail]; otherwise leaves
value in CK unchanged.
Mov
Moves (copies) value from src to dst register, overwriting previous value in dst. If
src has no value (i.e. set to None), sets dst to None. State of src register
remains unaffected.
Doesn’t affect values in CO and CK registers.
Eq
Checks whether src1 and src2 registers are equal. If both src1 and src2 registers
contain no value, considers them equal.
Sets CO register to represent equivalence of the registers.
Doesn’t affect value in CK register.
Neg
Negate value in src using finite-field arithmetics, and put result into dst.
Doesn’t affect values in CO register.
If src is set to None, sets CK to [Status::Fail]; otherwise leaves value in CK
unchanged.
Add
Add src value to dst_src value using finite-field (modulo) arithmetics of the order,
putting result to dst_src.
Doesn’t affect values in CO register.
If either src or dst_src (or both) is set to None, sets CK to [Status::Fail];
otherwise leaves value in CK unchanged.
Mul
Multiply src value to dst_src value using finite-field (modulo) arithmetics of the
order, putting result to dst_src.
Doesn’t affect values in CO register.
If either src or dst_src (or both) is set to None, sets CK to [Status::Fail];
otherwise leaves value in CK unchanged.
Trait Implementations§
Source§impl<Id> Bytecode<Id> for FieldInstrwhere
Id: SiteId,
impl<Id> Bytecode<Id> for FieldInstrwhere
Id: SiteId,
Source§fn op_range() -> RangeInclusive<u8>
fn op_range() -> RangeInclusive<u8>
Source§fn opcode_byte(&self) -> u8
fn opcode_byte(&self) -> u8
Source§fn code_byte_len(&self) -> u16
fn code_byte_len(&self) -> u16
Source§fn external_ref(&self) -> Option<Id>
fn external_ref(&self) -> Option<Id>
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>,
Source§fn decode_operands<R>(
reader: &mut R,
opcode: u8,
) -> Result<FieldInstr, CodeEofError>
fn decode_operands<R>( reader: &mut R, opcode: u8, ) -> Result<FieldInstr, CodeEofError>
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>,
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>,
Source§impl Clone for FieldInstr
impl Clone for FieldInstr
Source§fn clone(&self) -> FieldInstr
fn clone(&self) -> FieldInstr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldInstr
impl Debug for FieldInstr
Source§impl Display for FieldInstr
impl Display for FieldInstr
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>
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>
Source§impl Hash for FieldInstr
impl Hash for FieldInstr
Source§impl<Id> Instruction<Id> for FieldInstrwhere
Id: SiteId,
impl<Id> Instruction<Id> for FieldInstrwhere
Id: SiteId,
const ISA_EXT: &'static [&'static str]
type Core = GfaCore
fn is_goto_target(&self) -> bool
fn local_goto_pos(&mut self) -> Option<&mut u16>
fn remote_goto_pos(&mut self) -> Option<&mut Site<Id>>
Source§fn src_regs(&self) -> BTreeSet<RegE>
fn src_regs(&self) -> BTreeSet<RegE>
Source§fn dst_regs(&self) -> BTreeSet<RegE>
fn dst_regs(&self) -> BTreeSet<RegE>
Source§fn op_data_bytes(&self) -> u16
fn op_data_bytes(&self) -> u16
Source§fn ext_data_bytes(&self) -> u16
fn ext_data_bytes(&self) -> u16
Source§fn complexity(&self) -> u64
fn complexity(&self) -> u64
Source§fn exec(
&self,
_: Site<Id>,
core: &mut Core<Id, GfaCore>,
_: &<FieldInstr as Instruction<Id>>::Context<'_>,
) -> ExecStep<Site<Id>>
fn exec( &self, _: Site<Id>, core: &mut Core<Id, GfaCore>, _: &<FieldInstr as Instruction<Id>>::Context<'_>, ) -> ExecStep<Site<Id>>
fn isa_ext() -> Confined<BTreeSet<IsaId>, amplify::::collection::confinement::TinyOrdSet::{constant#0}, amplify::::collection::confinement::TinyOrdSet::{constant#1}>
Source§fn regs(&self) -> BTreeSet<<Self::Core as CoreExt>::Reg>
fn regs(&self) -> BTreeSet<<Self::Core as CoreExt>::Reg>
Source§fn src_reg_bytes(&self) -> u16
fn src_reg_bytes(&self) -> u16
Source§fn dst_reg_bytes(&self) -> u16
fn dst_reg_bytes(&self) -> u16
fn base_complexity(&self) -> u64
Source§impl PartialEq for FieldInstr
impl PartialEq for FieldInstr
impl Copy for FieldInstr
impl Eq for FieldInstr
impl StructuralPartialEq for FieldInstr
Auto Trait Implementations§
impl Freeze for FieldInstr
impl RefUnwindSafe for FieldInstr
impl Send for FieldInstr
impl Sync for FieldInstr
impl Unpin for FieldInstr
impl UnwindSafe for FieldInstr
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
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
key and return true if they are equal.