Struct Core

Source
pub struct Core<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize = { CALL_STACK_SIZE_MAX as usize }> {
    pub cx: Cx,
    /* private fields */
}
Expand description

Registers of a single CPU/VM core.

Fields§

§cx: Cx

Core extension module.

Implementations§

Source§

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Core<Id, Cx, CALL_STACK_SIZE>

Source

pub fn new() -> Self

Initializes registers. Sets CK to true, counters to zero, call stack to empty and the rest of registers to None value.

An alias for Core::with(CoreConfig::default(), Cx::default()).

Source

pub fn with(config: CoreConfig, cx_config: Cx::Config) -> Self

Initializes registers using a configuration object CoreConfig.

Source

pub fn reset(&mut self)

Reset the core extension by setting all the registers to None.

Source§

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Core<Id, Cx, CALL_STACK_SIZE>

Microcode for flag registers.

Source

pub fn co(&self) -> Status

Read overflow/carry flag.

Source

pub fn set_co(&mut self, co: Status)

Set overflow/carry flag to a value.

Source

pub fn cf(&self) -> u64

Return how many times ck was set to a failed state.

Source

pub fn has_failed(&self) -> bool

Return true if ck was in a failed state for at least once.

Source

pub fn ck(&self) -> Status

Return whether check register ck is in a failed state.

Source

pub fn reset_ck(&mut self)

Reset CK register.

Source

pub fn cp(&self) -> u16

Return the size of the call stack.

Source

pub fn push_cs(&mut self, from: Site<Id>) -> Option<u16>

Push a location to a call stack.

§Returns

Top of the call stack.

Source

pub fn pop_cs(&mut self) -> Option<Site<Id>>

Pops a call stack item.

Source

pub fn cl(&self) -> Option<u64>

Return complexity limit value.

Source

pub fn acc_complexity(&mut self, complexity: u64) -> bool

Accumulate complexity value.

§Returns

Boolean indicating whether the complexity limit is reached.

Source

pub fn get(&self, reg: Cx::Reg) -> Option<<Cx::Reg as Register>::Value>

Get register value.

Trait Implementations§

Source§

impl<Id: Clone + SiteId, Cx: Clone + CoreExt, const CALL_STACK_SIZE: usize> Clone for Core<Id, Cx, CALL_STACK_SIZE>

Source§

fn clone(&self) -> Core<Id, Cx, CALL_STACK_SIZE>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Debug for Core<Id, Cx, CALL_STACK_SIZE>

Source§

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

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

impl<Id: SiteId, Cx: CoreExt, const CALL_STACK_SIZE: usize> Default for Core<Id, Cx, CALL_STACK_SIZE>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Id: SiteId, Cx: CoreExt + Supercore<Cx2>, Cx2: CoreExt, const CALL_STACK_SIZE: usize> Supercore<Core<Id, Cx2, CALL_STACK_SIZE>> for Core<Id, Cx, CALL_STACK_SIZE>

Source§

fn subcore(&self) -> Core<Id, Cx2, CALL_STACK_SIZE>

An ISA extension subcore.
Source§

fn merge_subcore(&mut self, subcore: Core<Id, Cx2, CALL_STACK_SIZE>)

Merge the values generated in the subcore ISA extension with the main core.

Auto Trait Implementations§

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> Freeze for Core<Id, Cx, CALL_STACK_SIZE>
where Cx: Freeze,

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> RefUnwindSafe for Core<Id, Cx, CALL_STACK_SIZE>

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> Send for Core<Id, Cx, CALL_STACK_SIZE>
where Cx: Send, Id: Send,

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> Sync for Core<Id, Cx, CALL_STACK_SIZE>
where Cx: Sync, Id: Sync,

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> Unpin for Core<Id, Cx, CALL_STACK_SIZE>
where Cx: Unpin, Id: Unpin,

§

impl<Id, Cx, const CALL_STACK_SIZE: usize> UnwindSafe for Core<Id, Cx, CALL_STACK_SIZE>
where Cx: UnwindSafe, Id: UnwindSafe,

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.

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be 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, 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.