Net Class

Net Overview

In najaeda, a najaeda.netlist.Net can represent the following scenarios:

  1. Simple Scalar Net: A net that represents a single scalar signal. See najaeda.netlist.Net.is_scalar().

  2. Full Bus Net: A net that encompasses an entire bus. See najaeda.netlist.Net.is_bus().

  3. Single Bit of a Bus: A net that corresponds to an individual bit within a bus. See najaeda.netlist.Net.is_bus_bit().

  4. Concatenation of Bits: A net created by combining multiple bits. See najaeda.netlist.Net.is_concat().

Net Attributes

class najaeda.netlist.Net(path, net=None, net_concat=None)[source]

Bases: object

class Type(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

count_attributes() int[source]

Count the attributes of this Net.

Returns:

the number of attributes of this Net.

Return type:

int

count_design_terms() int[source]

Count the design terminals of this net.

Returns:

the number of design terminals of this net.

Return type:

int

count_inst_terms() int[source]

Count the instance terminals of this net.

Returns:

the number of instance terminals of this net.

Return type:

int

delete()[source]
get_attributes() Iterator[Attribute][source]

Iterate over the attributes of this Net.

Returns:

the attributes of this Net.

Return type:

Iterator[Attribute]

get_bit(index: int)[source]
Parameters:

index (int) – the index of the bit to get.

Returns:

the Net bit at the given index or None if it does not exist.

Return type:

Net

get_bits()[source]

Iterate over the bits of this Net. The iterator will return itself if the Net is scalar. :return: an iterator over the bits of this Net. :rtype: Iterator[Net]

get_design_terms()[source]

Return an iterator over the design terminals of the net. This includes only the terminals that are part of the current design. The iterator will yield Term objects bit per bit.

Returns:

an iterator over the design terminals of the net.

Return type:

Iterator[Term]

get_inst_terms()[source]
Returns:

an iterator over the instance terminals of the net.

Return type:

Iterator[Term]

get_lsb() int[source]
Returns:

the least significant bit of the net if it is a bus.

Return type:

int

get_msb() int[source]
Returns:

the most significant bit of the net if it is a bus.

Return type:

int

get_name() str[source]
Returns:

the name of this Net.

Return type:

str

get_terms()[source]

Return an iterator over the terminals of the net. This includes both design and instance terminals.

Returns:

an iterator over the terminals of the net.

Return type:

Iterator[Term]

get_width() int[source]
Returns:

the width of the net.

Return type:

int

is_bit() bool[source]
Returns:

True if the net is a bit.

Return type:

bool

is_bus() bool[source]
Returns:

True if the net is a bus.

Return type:

bool

is_bus_bit() bool[source]
Returns:

True if the net is a bit of a bus.

Return type:

bool

is_concat() bool[source]
Returns:

True if the net is a concatenation.

Return type:

bool

is_const() bool[source]
Returns:

True if the net is a constant generator.

Return type:

bool

is_const0() bool[source]
Returns:

True if the net is a constant 0 generator.

Return type:

bool

is_const1() bool[source]
Returns:

True if the net is a constant 1 generator.

Return type:

bool

is_scalar() bool[source]
Returns:

True if the net is a scalar.

Return type:

bool

key()[source]

Stable, hashable identity for Net.

set_lsb(lsb: int)[source]
Parameters:

lsb (int) – the lsb to set for this Net.

set_msb(msb: int)[source]
Parameters:

msb (int) – the msb to set for this Net.

set_name(name: str)[source]
Parameters:

name (str) – the name to set for this Net.

set_type(net_type: Type)[source]
Parameters:

net_type (Type) – the type of the net.