netlist_carpentry.utils.gate_mixins
¶
Classes:
-
ClkMixin–A mixin class for clocked gates. Clocked gates are gates that have a clock signal.
-
EnMixin– -
RstMixin– -
LoadMixin– -
SRMixin– -
ScanMixin–
ClkMixin
¶
Bases: BaseModel
A mixin class for clocked gates. Clocked gates are gates that have a clock signal. This class provides a common interface for all clocked gates, including methods for evaluating the gate's output and setting its output signal.
Methods:
-
model_post_init–Initializes the gate's ports and connections.
-
set_clk–Sets the clock signal.
Attributes:
-
clk_polarity(Signal) –Which clock edge activates the flip-flop. Default is Signal.HIGH, i.e. rising edge.
-
clk_port(Port[Instance]) –The clock port of the gate.
clk_polarity
property
writable
¶
clk_polarity: Signal
Which clock edge activates the flip-flop. Default is Signal.HIGH, i.e. rising edge.
model_post_init
¶
model_post_init(__context: object) -> None
Initializes the gate's ports and connections.
This method is called after the gate's attributes have been initialized, and it sets up the gate's ports and connections.
set_clk
¶
set_clk(new_signal: SignalOrLogicLevel) -> None
EnMixin
¶
Bases: BaseModel
Methods:
-
set_en–Sets the enable signal.
Attributes:
-
en_polarity(Signal) –Which EN-signal level enables writing on the data storage. Default is Signal.HIGH.
-
en_port(Port[Instance]) –The enable port of the gate.
-
en_signal(Signal) –The enable signal of the gate.
en_polarity
property
writable
¶
en_polarity: Signal
Which EN-signal level enables writing on the data storage. Default is Signal.HIGH.
set_en
¶
set_en(new_signal: SignalOrLogicLevel) -> None
RstMixin
¶
Bases: BaseModel
Methods:
-
set_rst–Sets the reset signal.
Attributes:
-
rst_polarity(Signal) –Which reset level resets the flip-flop. Default is Signal.HIGH: the flipflop is in reset, if the reset signal is HIGH.
-
rst_val_int(int) –Reset value of the flip-flop as integer. Default is 0.
-
rst_port(Port[Instance]) –The reset port of the gate.
-
rst_val(SignalArray) –The value of the flipflop during and after reset. Default is Signal.LOW, i.e. the initial flipflop state is 0 by default.
-
in_reset(bool) –True if the gate is currently in reset, False otherwise.
rst_polarity
property
writable
¶
rst_polarity: Signal
Which reset level resets the flip-flop. Default is Signal.HIGH: the flipflop is in reset, if the reset signal is HIGH.
rst_val_int
property
writable
¶
rst_val_int: int
Reset value of the flip-flop as integer. Default is 0.
rst_val
property
¶
rst_val: SignalArray
The value of the flipflop during and after reset. Default is Signal.LOW, i.e. the initial flipflop state is 0 by default.
set_rst
¶
set_rst(new_signal: SignalOrLogicLevel) -> None
LoadMixin
¶
Bases: BaseModel
Methods:
-
set_al–Sets the asynchronous load enable signal.
Attributes:
-
load_polarity(Signal) –Which load level loads the load value into flip-flop. Default is Signal.HIGH: the flipflop will load, if the load signal is HIGH.
-
al_port(Port[Instance]) –The asynchronous load enable port of the gate, i.e. the port that toggles whether to load data into the flip-flop.
-
ad_port(Port[Instance]) –The asynchronous data load port of the gate, i.e. the port that holds the data to load into the flip-flop.
-
load_val(SignalArray) –The value of the flipflop during and after reset, retrieved from the load data port.
-
load_val_int(Optional[int]) –The value of the flipflop during and after reset as an integer, retrieved from the load data port.
-
in_load(bool) –True if the gate is currently in "load-value" mode, False otherwise.
load_polarity
property
writable
¶
load_polarity: Signal
Which load level loads the load value into flip-flop. Default is Signal.HIGH: the flipflop will load, if the load signal is HIGH.
al_port
property
¶
The asynchronous load enable port of the gate, i.e. the port that toggles whether to load data into the flip-flop.
ad_port
property
¶
The asynchronous data load port of the gate, i.e. the port that holds the data to load into the flip-flop.
load_val
property
¶
load_val: SignalArray
The value of the flipflop during and after reset, retrieved from the load data port.
load_val_int
property
¶
The value of the flipflop during and after reset as an integer, retrieved from the load data port.
in_load
property
¶
in_load: bool
True if the gate is currently in "load-value" mode, False otherwise.
set_al
¶
set_al(new_signal: SignalOrLogicLevel) -> None
SRMixin
¶
Bases: BaseModel
Methods:
Attributes:
-
clr_polarity(Signal) –Which clear level clears the flip-flop. Default is Signal.HIGH: the flipflop goes to 0, if the clear signal is HIGH.
-
clr_port(Port[Instance]) –The clear port of the gate.
-
set_polarity(Signal) –Which set level sets the flip-flop. Default is Signal.HIGH: the flipflop goes to 1, if the set signal is HIGH.
-
set_port(Port[Instance]) –The set port of the gate.
clr_polarity
property
writable
¶
clr_polarity: Signal
Which clear level clears the flip-flop. Default is Signal.HIGH: the flipflop goes to 0, if the clear signal is HIGH.
set_polarity
property
writable
¶
set_polarity: Signal
Which set level sets the flip-flop. Default is Signal.HIGH: the flipflop goes to 1, if the set signal is HIGH.
set_clr
¶
Sets the clear signal.
Parameters:
-
(new_signal¶Signal) –The new clear signal value.
-
(idx¶Union[int, List[int]]) –The index (or indices) to apply the given signal to. Can either be an integer (single index to set) or an iterable of integers (e.g. a list of indices). For every integer of the iterable the signal value of the corresponding port index is set to the given
new_signal. Defaults to 0.
set_set
¶
Sets the set signal.
Parameters:
-
(new_signal¶Signal) –The new set signal value.
-
(idx¶Union[int, List[int]]) –The index (or indices) to apply the given signal to. Can either be an integer (single index to set) or an iterable of integers (e.g. a list of indices). For every integer of the iterable the signal value of the corresponding port index is set to the given
new_signal. Defaults to 0.
ScanMixin
¶
Bases: BaseModel
Methods:
-
set_se–Sets the scan enable signal.
Attributes:
-
se_signal(Signal) –The scan enable signal of the gate.
-
scan_ff_equivalent(Type[ClkMixin]) –Returns the Scan-FF type equivalent for normal FF and the FF type equivalent for Scan-FF.
scan_ff_equivalent
property
¶
Returns the Scan-FF type equivalent for normal FF and the FF type equivalent for Scan-FF.
set_se
¶
set_se(new_signal: SignalOrLogicLevel) -> None