Struct awint_macro_internals::Lower
source · 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>
impl<'a> Lower<'a>
pub fn new(names: Names<'a>, fn_names: FnNames<'a>) -> Self
sourcepub fn try_txt_bound_to_binding(&mut self, txt: &[char]) -> String
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.
pub fn lower_bound(&mut self, usb: &Usb) -> PVal
sourcepub fn lower_comp(&mut self, comp: &mut Component) -> Option<PWidth>
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.
pub fn lower_concat(&mut self, concat: &mut Concatenation)
sourcepub fn lower_le_checks(&mut self) -> (bool, String, String)
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)
sourcepub fn lower_common_checks(&mut self, ast: &Ast) -> (bool, String, String)
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)