prjunnamed_netlist

Struct FlipFlop

Source
pub struct FlipFlop {
    pub data: Value,
    pub clock: ControlNet,
    pub clear: ControlNet,
    pub reset: ControlNet,
    pub enable: ControlNet,
    pub reset_over_enable: bool,
    pub clear_value: Const,
    pub reset_value: Const,
    pub init_value: Const,
}
Expand description

A flip-flop cell.

The output is determined by the following rules:

  • at the beginning of time, the output is set to init_value
  • whenever clear as active, the output is set to clear_value
  • whenever clear is not active, and an active edge happens on clock:
    • if reset_over_enable is true:
      • if reset is active, the output is set to reset_value
      • if enable is false, output value is unchanged
    • if reset_over_enable is false:
      • if enable is false, output value is unchanged
      • if reset is active, the output is set to reset_value
    • otherwise, the output is set to data

Fields§

§data: Value§clock: ControlNet

The clock. The active edge is rising if it is a ControlNet::Pos, and falling if it is a ControlNet::Neg.

§clear: ControlNet

Asynchronous reset.

§reset: ControlNet

Synchronous reset.

§enable: ControlNet

Clock enable.

§reset_over_enable: bool

If true, reset has priority over enable. Otherwise, enable has priority over reset.

§clear_value: Const

Must have the same width as data.

§reset_value: Const

Must have the same width as data.

§init_value: Const

Must have the same width as data.

Implementations§

Source§

impl FlipFlop

Source

pub fn new(data: Value, clock: impl Into<ControlNet>) -> Self

Source

pub fn with_data(self, data: impl Into<Value>) -> Self

Source

pub fn with_clock(self, clock: impl Into<ControlNet>) -> Self

Source

pub fn with_clear(self, clear: impl Into<ControlNet>) -> Self

Source

pub fn with_clear_value( self, clear: impl Into<ControlNet>, clear_value: impl Into<Const>, ) -> Self

Source

pub fn with_reset(self, reset: impl Into<ControlNet>) -> Self

Source

pub fn with_reset_value( self, reset: impl Into<ControlNet>, reset_value: impl Into<Const>, ) -> Self

Source

pub fn with_enable(self, enable: impl Into<ControlNet>) -> Self

Source

pub fn with_init(self, value: impl Into<Const>) -> Self

Source

pub fn output_len(&self) -> usize

Source

pub fn has_clock(&self) -> bool

Source

pub fn has_enable(&self) -> bool

Source

pub fn has_reset(&self) -> bool

Source

pub fn has_reset_value(&self) -> bool

Source

pub fn has_clear(&self) -> bool

Source

pub fn has_clear_value(&self) -> bool

Source

pub fn has_init_value(&self) -> bool

Source

pub fn slice(&self, range: impl RangeBounds<usize> + Clone) -> FlipFlop

Source

pub fn remap_reset_over_enable(&mut self, design: &Design)

Source

pub fn remap_enable_over_reset(&mut self, design: &Design)

Source

pub fn unmap_reset(&mut self, design: &Design)

Source

pub fn unmap_enable(&mut self, design: &Design, output: &Value)

Source

pub fn invert(&mut self, design: &Design, output: &Value) -> Value

Source

pub fn visit(&self, f: impl FnMut(Net))

Source

pub fn visit_mut(&mut self, f: impl FnMut(&mut Net))

Trait Implementations§

Source§

impl Clone for FlipFlop

Source§

fn clone(&self) -> FlipFlop

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FlipFlop

Source§

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

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

impl Hash for FlipFlop

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FlipFlop

Source§

fn eq(&self, other: &FlipFlop) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for FlipFlop

Source§

impl StructuralPartialEq for FlipFlop

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.