Skip to main content

Memory

Struct Memory 

Source
pub struct Memory { /* private fields */ }
Expand description

A memory (see the module documentation).

Implementations§

Source§

impl Memory

Source

pub fn new(name: &str, addr: Width, cell: Width, endian: Endian) -> Memory

A memory named name (its unknown cells use unused symbols name.0, name.1, …) from addresses of width addr to cells of width cell, all of it unknown.

Source

pub fn zeroed(self) -> Memory

Unknown cells read as zero instead (memory that starts cleared). Previously returned load expressions retain their original contents.

Source

pub fn with_region(self, start: u128, cells: &[BitVec]) -> Result<Memory, Error>

Known contents from address start on, one value per cell (for example a binary’s read-only data). Regions must not overlap, including themselves when addresses wrap. Previously returned load expressions retain their original contents.

Source

pub fn with_bytes(self, start: u128, bytes: &[u8]) -> Result<Memory, Error>

Known contents of byte cells from address start on.

Source

pub fn initial(&self) -> Version

The memory before any store.

Source

pub fn addr_width(&self) -> Width

The address width.

Source

pub fn cell_width(&self) -> Width

The cell width.

Source

pub fn store( &mut self, cx: &mut Context, at: Version, addr: Expr, value: Expr, ) -> Result<Version, Error>

Stores value (a whole number of cells) at addr in version at: the new version.

Source

pub fn load( &mut self, cx: &mut Context, at: Version, addr: Expr, cells: u16, ) -> Result<Expr, Error>

Loads cells consecutive cells at addr from version at, as one value.

Source

pub fn reads(&self) -> &[(Expr, Expr)]

The reads of unknown cells so far: each one’s address and symbol, in order.

Source

pub fn bind( &self, cx: &mut Context, env: &[(SymbolKey, BitVec)], image: &dyn Fn(&BitVec) -> Option<BitVec>, ) -> Result<Vec<(SymbolKey, BitVec)>, Error>

Values for the symbols of the unknown cells read so far, from a memory image and the values of the other symbols (a read’s address may depend on them, and on earlier reads): each address is evaluated in turn and the image asked for its cell (None: 0).

Trait Implementations§

Source§

impl Clone for Memory

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Memory

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.