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
clearas active, the output is set toclear_value - whenever
clearis not active, and an active edge happens onclock:- if
reset_over_enableis true:- if
resetis active, the output is set toreset_value - if
enableis false, output value is unchanged
- if
- if
reset_over_enableis false:- if
enableis false, output value is unchanged - if
resetis active, the output is set toreset_value
- if
- otherwise, the output is set to
data
- if
Fields§
§data: Value§clock: ControlNetThe clock. The active edge is rising if it is a ControlNet::Pos, and falling if it is
a ControlNet::Neg.
clear: ControlNetAsynchronous reset.
reset: ControlNetSynchronous reset.
enable: ControlNetClock enable.
reset_over_enable: boolIf true, reset has priority over enable. Otherwise, enable has priority over reset.
clear_value: ConstMust have the same width as data.
reset_value: ConstMust have the same width as data.
init_value: ConstMust have the same width as data.
Implementations§
Source§impl FlipFlop
impl FlipFlop
pub fn new(data: Value, clock: impl Into<ControlNet>) -> Self
pub fn with_data(self, data: impl Into<Value>) -> Self
pub fn with_clock(self, clock: impl Into<ControlNet>) -> Self
pub fn with_clear(self, clear: impl Into<ControlNet>) -> Self
pub fn with_clear_value( self, clear: impl Into<ControlNet>, clear_value: impl Into<Const>, ) -> Self
pub fn with_reset(self, reset: impl Into<ControlNet>) -> Self
pub fn with_reset_value( self, reset: impl Into<ControlNet>, reset_value: impl Into<Const>, ) -> Self
pub fn with_enable(self, enable: impl Into<ControlNet>) -> Self
pub fn with_init(self, value: impl Into<Const>) -> Self
pub fn output_len(&self) -> usize
pub fn has_clock(&self) -> bool
pub fn has_enable(&self) -> bool
pub fn has_reset(&self) -> bool
pub fn has_reset_value(&self) -> bool
pub fn has_clear(&self) -> bool
pub fn has_clear_value(&self) -> bool
pub fn has_init_value(&self) -> bool
pub fn slice(&self, range: impl RangeBounds<usize> + Clone) -> FlipFlop
pub fn remap_reset_over_enable(&mut self, design: &Design)
pub fn remap_enable_over_reset(&mut self, design: &Design)
pub fn unmap_reset(&mut self, design: &Design)
pub fn unmap_enable(&mut self, design: &Design, output: &Value)
pub fn invert(&mut self, design: &Design, output: &Value) -> Value
pub fn visit(&self, f: impl FnMut(Net))
pub fn visit_mut(&mut self, f: impl FnMut(&mut Net))
Trait Implementations§
impl Eq for FlipFlop
impl StructuralPartialEq for FlipFlop
Auto Trait Implementations§
impl Freeze for FlipFlop
impl RefUnwindSafe for FlipFlop
impl Send for FlipFlop
impl Sync for FlipFlop
impl Unpin for FlipFlop
impl UnwindSafe for FlipFlop
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.