calyx_ir

Struct FSM

Source
pub struct FSM {
    pub attributes: Attributes,
    pub assignments: Vec<Vec<Assignment<Nothing>>>,
    pub transitions: Vec<Transition>,
    pub wires: SmallVec<[RRC<Port>; 2]>,
    /* private fields */
}

Fields§

§attributes: Attributes

Attributes for this FSM

§assignments: Vec<Vec<Assignment<Nothing>>>

State indexes into assignments that are supposed to be enabled at that state

§transitions: Vec<Transition>

State indexes into (potentially guarded) next states

§wires: SmallVec<[RRC<Port>; 2]>

Implementations§

Source§

impl FSM

Source

pub fn name(&self) -> Id

Grants immutable access to the name of this cell.

Source

pub fn new(name: Id) -> Self

Constructs a new FSM construct using a list of cases and a name

Source

pub fn find<S>(&self, name: S) -> Option<RRC<Port>>
where S: Display, Id: PartialEq<S>,

Get a reference to the named hole if it exists.

Source

pub fn get<S>(&self, name: S) -> RRC<Port>
where S: Display + Clone, Id: PartialEq<S>,

Source

pub fn extend_fsm<A, T>(&mut self, assigns: A, transitions: T)
where A: IntoIterator<Item = Vec<Assignment<Nothing>>>, T: IntoIterator<Item = Transition>,

Extend the FSM with new transitions and assignments. Will panic if the lengths are not consistent.

Source

pub fn extend_state_assignments<I>(&mut self, state: u64, assigns: I)
where I: IntoIterator<Item = Assignment<Nothing>>,

Extend the assignments that are supposed to be active at a given state.

Source

pub fn get_called_port_parents<F>(&self, push_parent_name: F) -> Vec<Id>
where F: Fn(&mut Vec<Id>, &RRC<Port>),

Returns a list of names of the groups, cells, or other port parents used by the FSM. Requires as an argument a function that can in-place update a Vec with the name of kinds of port parents you care about.

Source

pub fn merge_assignments(&self) -> Vec<Vec<(usize, Assignment<Nothing>)>>

Each element of the resulting Vec is a collection of assignments writing to the same destination port, where the usize value represents the FSM state at which the assignment should take place.

Trait Implementations§

Source§

impl Debug for FSM

Source§

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

Formats the value using the given formatter. Read more
Source§

impl GetName for FSM

Source§

fn name(&self) -> Id

Return a reference to the object’s name

Auto Trait Implementations§

§

impl Freeze for FSM

§

impl !RefUnwindSafe for FSM

§

impl !Send for FSM

§

impl !Sync for FSM

§

impl Unpin for FSM

§

impl !UnwindSafe for FSM

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.