pub struct LocalVarDecl {
pub width: u32,
pub signed: bool,
}Expand description
The declared type of one local-variable slot: every value stored in the slot is first cast to it (16.10 “the value of a local variable is a value of its declared type”; 16.8.2 “cast to the type of” for an input/inout formal’s initial value and for the value written back to an output/inout actual). The builder derives it from the variable’s declared integral type; a non-integral local variable is a loud build error, never a slot.
Fields§
§width: u32Width in bits (>= 1).
signed: boolWhether the type is signed: a signed value is sign-extended from its top bit after truncation, an unsigned one zero-extended.
Implementations§
Source§impl LocalVarDecl
impl LocalVarDecl
Sourcepub fn is_wide(&self) -> bool
pub fn is_wide(&self) -> bool
Whether the variable is wider than one frame slot (> 64 bits) and so
occupies slots consecutive frame slots, see
Automaton::new_local_var.
Sourcepub fn limbs(&self) -> usize
pub fn limbs(&self) -> usize
How many 64-bit limbs one plane (value or unknown) of the variable has:
ceil(width / 64), and 1 for a narrow variable.
Sourcepub fn slots(&self) -> usize
pub fn slots(&self) -> usize
How many consecutive frame slots the variable occupies: 1 when it fits
an i64, else 2 * limbs() – the value limbs (least significant
first), then the unknown-plane limbs (x/z bits, same order). A wide
variable is four-state; a narrow one is the two-state i64 it always was.
Sourcepub fn cast(&self, value: i64) -> i64
pub fn cast(&self, value: i64) -> i64
value fitted to this type: truncated to width bits,
then sign-extended when signed. A slot holds an i64,
so a type of 64 bits or more is the identity here: a wider variable is
stored limb by limb in several slots (slots, the
helpers of crate::sva::wide fit it as a whole) and each limb slot is
an ordinary 64-bit unsigned one.
Trait Implementations§
Source§impl Clone for LocalVarDecl
impl Clone for LocalVarDecl
impl Copy for LocalVarDecl
Source§impl Debug for LocalVarDecl
impl Debug for LocalVarDecl
impl Eq for LocalVarDecl
Source§impl Hash for LocalVarDecl
impl Hash for LocalVarDecl
Source§impl PartialEq for LocalVarDecl
impl PartialEq for LocalVarDecl
impl StructuralPartialEq for LocalVarDecl
Auto Trait Implementations§
impl Freeze for LocalVarDecl
impl RefUnwindSafe for LocalVarDecl
impl Send for LocalVarDecl
impl Sync for LocalVarDecl
impl Unpin for LocalVarDecl
impl UnsafeUnpin for LocalVarDecl
impl UnwindSafe for LocalVarDecl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.