Term Class
Term Overview
In najaeda, a najaeda.netlist.Term (also referred to as a Port in Verilog terminology)
can represent the following scenarios:
Single Bit Scalar Terminal: A terminal representing a single scalar signal. See
najaeda.netlist.Term.is_scalar().Full Bus Terminal: A terminal representing an entire bus. See
najaeda.netlist.Term.is_bus().Single Bus Bit Terminal: A terminal representing a single bit of a bus. See
najaeda.netlist.Term.is_bus_bit().
Terms are used for both top-level ports and instance terminals. A term can answer local connectivity through its connected net, or flat connectivity through an equipotential.
Common tasks
clk = instance.get_term("clk")
print(clk.get_direction())
net = clk.get_net()
equi = clk.get_equipotential()
Term Attributes
- class najaeda.netlist.Term(path, term)[source]
Bases:
object- class Direction(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
EnumEnum for the direction of a term.
- bit: int | None
- connect_lower_net(net: Net)[source]
Connect this term to the given lower Net.
- Parameters:
net (Net) – the lower Net to connect to.
- connect_upper_net(net: Net)[source]
Connect this term to the given upper Net.
- Parameters:
net (Net) – the upper Net to connect to.
- count_attributes() int[source]
Count the attributes of this Term.
- Returns:
the number of attributes of this Term.
- Return type:
int
- count_flat_fanout(filter=None)[source]
- delete()[source]
Delete this Term.
- disconnect_lower_net()[source]
Disconnect this term from its lower net.
- disconnect_upper_net()[source]
Disconnect this term from its upper net.
- get_attributes() Iterator[Attribute][source]
Iterate over the attributes of this Term.
- Returns:
the attributes of this Term.
- Return type:
Iterator[Attribute]
- get_bit(index: int)[source]
- Parameters:
index (int) – the index of the bit to get.
- Returns:
the Term bit at the given index or None if it does not exist.
- Return type:
Term or None
- get_bit_number()[source]
- Returns:
the bit index of the term if it is a bit.
- Return type:
int or None
- get_bits()[source]
- Returns:
an iterator over the bits of the term. If the term is scalar, it will return an iterator over itself.
- Return type:
Iterator[Term]
- get_clock_related_inputs()[source]
Get all input terms that are related to the given clock term.
- Parameters:
clock_term – the clock term to check for related inputs.
- Returns:
a list of input terms that are related to the clock term.
- Return type:
List[Term]
- get_clock_related_outputs()[source]
Get all output terms that are related to the given clock term.
- Parameters:
clock_term – the clock term to check for related outputs.
- Returns:
a list of output terms that are related to the clock term.
- Return type:
List[Term]
- get_combinatorial_inputs()[source]
Get all combinatorial input terms of this instance.
- Returns:
a list of combinatorial input terms.
- Return type:
List[Term]
- get_combinatorial_outputs()[source]
Get all combinatorial output terms of this instance.
- Returns:
a list of combinatorial output terms.
- Return type:
List[Term]
- get_equipotential() Equipotential[source]
- Returns:
the Equipotential of this Term.
- Return type:
- get_flat_fanout(filter=None)[source]
- get_lsb() int[source]
- Returns:
the least significant bit of the term if it is a bus.
- Return type:
int or None
- get_msb() int[source]
- Returns:
the most significant bit of the term if it is a bus.
- Return type:
int or None
- get_name() str[source]
- Returns:
the name of the term.
- Return type:
str
- get_snl_term()[source]
- get_source_range() SourceRange | None[source]
Return the source range of this Term, if available.
- get_truth_table()[source]
- get_upper_net() Net[source]
- Returns:
the upper net of the term.
- Return type:
- Remark:
If the term is a top level term, it will return None.
- get_width() int[source]
- Returns:
the width of the term. 1 if scalar.
- Return type:
int
- is_bit() bool[source]
- Returns:
True if the term is a bit.
- Return type:
bool
- is_bus() bool[source]
- Returns:
True if the term is a bus.
- Return type:
bool
- is_bus_bit() bool[source]
- Returns:
True if the term is a bit of a bus.
- Return type:
bool
- is_input() bool[source]
- Returns:
True if the term is an input.
- Return type:
bool
- is_output() bool[source]
- Returns:
True if the term is an output.
- Return type:
bool
- is_scalar() bool[source]
- Returns:
True if the term is a scalar.
- Return type:
bool
- is_sequential() bool[source]
- Returns:
True if the term is a sequential term.
- Return type:
bool
- is_unnamed() bool[source]
- Returns:
True if the term is unnamed.
- Return type:
bool
- key() tuple[source]
Unique, hashable identity of this Term. Stable within a design revision.
- set_lsb(lsb: int)[source]
- Parameters:
lsb (int) – the lsb to set for this Term.
- set_msb(msb: int)[source]
- Parameters:
msb (int) – the msb to set for this Term.