pub struct Lower<'a> {
    pub binds: OrdArena<PBind, Bind, (bool, bool)>,
    pub values: OrdArena<PVal, Value, bool>,
    pub widths: OrdArena<PWidth, Width, (bool, bool)>,
    pub cw: OrdArena<PCWidth, CWidth, bool>,
    pub dynamic_width: Option<PCWidth>,
    pub names: Names<'a>,
    pub fn_names: FnNames<'a>,
}

Fields§

§binds: OrdArena<PBind, Bind, (bool, bool)>

The first bool is if the binding is used, the second is for if it needs to be mutable

§values: OrdArena<PVal, Value, bool>

The bool is if the value is used

§widths: OrdArena<PWidth, Width, (bool, bool)>

The first bool is if the width is used for lt checks, the second if it needs to be assigned to a let binding

§cw: OrdArena<PCWidth, CWidth, bool>§dynamic_width: Option<PCWidth>§names: Names<'a>§fn_names: FnNames<'a>

Implementations§

source§

impl<'a> Lower<'a>

source

pub fn new(names: Names<'a>, fn_names: FnNames<'a>) -> Self

source

pub fn try_txt_bound_to_binding(&mut self, txt: &[char]) -> String

In cases like a[(a.bw() - 16)..] we want to replace a.bw() with Bits::bw(bind_to_a) or else we run into borrow issues. This is admittedly jank, but fixes the vast majority of these kinds of cases without needing a full fledged parser for arithmetic and function calls.

source

pub fn lower_bound(&mut self, usb: &Usb) -> PVal

source

pub fn lower_comp(&mut self, comp: &mut Component) -> Option<PWidth>

Returns the width corresponding to the range of the component, and internally pushes the upperbound-bitwidth check.

source

pub fn lower_concat(&mut self, concat: &mut Concatenation)

source

pub fn lower_le_checks(&mut self) -> (bool, String, String)

Checks that ranges aren’t reversed and the upper bounds are not beyond bitwidths. Returns true and “0;0” for both strings if there are no checks (for awint_dag purposes)

source

pub fn lower_common_checks(&mut self, ast: &Ast) -> (bool, String, String)

Checks that we aren’t trying to squeeze unbounded fillers into negative widths for nondeterministic cases and that deterministic concat widths are equal to the common bitwidth. Returns true and “0;0” for both strings if there are no checks (for awint_dag purposes)

source

pub fn write_field( &mut self, s: &mut String, lhs: &str, to: Option<&str>, rhs: &str, from: Option<&str>, width: &str, width1: bool )

source

pub fn field_comp( &mut self, s: &mut String, comp: &Component, msb_align: bool, from_buf: bool, first_in_align: bool, last_in_align: bool )

source

pub fn field_concat(&mut self, concat: &Concatenation, from_buf: bool) -> String

source

pub fn lower_fielding( &mut self, ast: &Ast, source_has_filler: bool, need_buffer: bool ) -> String

source

pub fn lower_cws(&mut self) -> String

source

pub fn lower_widths(&mut self) -> String

source

pub fn lower_values(&mut self) -> String

source

pub fn lower_bindings<F: FnMut(Awi) -> String>( &mut self, static_construction_fn: F ) -> String

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Lower<'a>

§

impl<'a> Send for Lower<'a>

§

impl<'a> Sync for Lower<'a>

§

impl<'a> Unpin for Lower<'a>

§

impl<'a> UnwindSafe for Lower<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.