calyx_opt::analysis

Struct InferenceAnalysis

Source
pub struct InferenceAnalysis {
    pub latency_data: HashMap<Id, GoDone>,
    pub static_component_latencies: HashMap<Id, u64>,
    /* private fields */
}
Expand description

Default implemnetation is almost certainly not helpful. You should probably use from_ctx instead.

Fields§

§latency_data: HashMap<Id, GoDone>

component name -> vec<(go signal, done signal, latency)>

§static_component_latencies: HashMap<Id, u64>

Maps static component names to their latencies, but there can only be one go port on the component. (This is a subset of the information given by latency_data), and is helpful for inferring invokes. Perhaps someday we should get rid of it and only make it one field.

Implementations§

Source§

impl InferenceAnalysis

Source

pub fn from_ctx(ctx: &Context) -> Self

Builds FixUp struct from a ctx. Looks at all primitives and component signatures to get latency information.

Source

pub fn add_component( &mut self, (comp_name, latency, go_done): (Id, u64, GoDone), )

Updates the component, given a component name and a new latency and GoDone object.

Source

pub fn remove_component(&mut self, comp_name: Id)

Updates the component, given a component name and a new latency. Note that this expects that the component already is accounted for in self.latency_data and self.static_component_latencies.

Source

pub fn adjust_component(&mut self, (comp_name, adjusted_latency): (Id, u64))

Updates the component, given a component name and a new latency. Note that this expects that the component already is accounted for in self.latency_data and self.static_component_latencies.

Source

pub fn get_possible_latency(c: &Control) -> Option<u64>

Returns Some(latency) if a control statement has a latency, because it is static or is has the @promotable attribute

Source

pub fn remove_promotable_from_seq(seq: &mut Seq)

Source

pub fn remove_promotable_attribute(c: &mut Control)

Removes the @promotable attribute from the control program. Recursively visits the children of the control.

Source

pub fn fixup_seq(&self, seq: &mut Seq)

Source

pub fn fixup_par(&self, par: &mut Par)

Source

pub fn fixup_if(&self, _if: &mut If)

Source

pub fn fixup_while(&self, _while: &mut While)

Source

pub fn fixup_repeat(&self, repeat: &mut Repeat)

Source

pub fn fixup_ctrl(&self, ctrl: &mut Control)

Source

pub fn fixup_timing(&self, comp: &mut Component)

“Fixes Up” the component. In particular:

  1. Removes @promotable annotations for any groups that write to any updated_components.
  2. Try to re-infer groups’ latencies.
  3. Removes all @promotable annotation from the control program.
  4. Re-infers the @promotable annotations for any groups or control.

Note that this only fixes up the component’s ``internals’’. It does not fix the component’s signature.

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.