#[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.
Does not affect the value in the CK register.
Clr
Clears register value by setting it to None.
Does not affect values in the CO and CK registers.
PutD
Puts value into a register, replacing the previous value in it if there was any.
Does not affect values in the CO and CK registers.
Fields
PutZ
Puts zero (0) value into a register, replacing the previous value in it if there was any.
Does not affect values in the CO and CK registers.
PutV
Puts val value, which is a power of 2, into a register, replacing the previous value in
it if there was any.
Does not affect values in the CO and CK registers.
Fields
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 the 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 the CK unchanged.
Fields
Mov
Moves (copies) value from src to dst register, overwriting the previous value in dst.
If src has no value (i.e., set to None), sets dst to None.
Leaves the state of the src register unaffected.
Does not affect values in the CO and CK registers.
Eq
Checks whether src1 and src2 registers are equal.
Sets CO register to represent equivalence of the registers. If both src1 and src2
registers contain no value, sets CK to a failed state.
Does not affect the value in the CK register.
Neg
Negate value in src using finite-field arithmetics, and put result into dst.
Does not affect values in the 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 FQ
order, putting the result to dst_src.
Does not affect values in the CO register.
If either src or dst_src (or both) is set to None, sets CK to [Status::Fail];
otherwise leaves value in the CK unchanged.
Fields
Mul
Multiply src value to dst_src value using finite-field (modulo) arithmetics of the
FQ order, putting the result to dst_src.
Does not affect values in the CO register.
If either src or dst_src (or both) is set to None, sets CK to [Status::Fail];
otherwise leaves value in the CK unchanged.
Implementations§
Source§impl FieldInstr
impl FieldInstr
pub const SET: u8 = 64u8
pub const TEST: u8 = 64u8
pub const CLR: u8 = 64u8
pub const PUTD: u8 = 64u8
pub const PUTZ: u8 = 64u8
pub const PUTV: u8 = 64u8
pub const FITS: u8 = 64u8
pub const MOV: u8 = 65u8
pub const EQ: u8 = 66u8
pub const NEG: u8 = 67u8
pub const ADD: u8 = 68u8
pub const MUL: u8 = 69u8
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,
Source§const ISA_EXT: &'static [&'static str]
const ISA_EXT: &'static [&'static str]
Source§fn is_goto_target(&self) -> bool
fn is_goto_target(&self) -> bool
Source§fn local_goto_pos(&mut self) -> GotoTarget<'_>
fn local_goto_pos(&mut self) -> GotoTarget<'_>
Source§fn remote_goto_pos(&mut self) -> Option<&mut Site<Id>>
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>>
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}>
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>
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
Source§fn base_complexity(&self) -> u64
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.