Technology Network

A mockturtle logic network type that extends mockturtle::klut_network. It reimplements all node creation functions to disable structural hashing. Furthermore, create_buf is overwritten such that it creates real buffer nodes that count towards the size of the network and compute the identity function. In the same way, a buffer with more than one fanout node is considered a fanout node (or splitter in some contexts) that copies an incoming signal to two or more data paths.

Network Types

Header: fiction/networks/technology_network.hpp

class technology_network : public mockturtle::klut_network

A mockturtle logic network type that extends klut_network. It reimplements all node creation functions to disable structural hashing. Furthermore, create_buf is overwritten such that it creates real buffer nodes that count towards the size of the network and compute the identity function. In the same way, a buffer with more than one fanout node is considered a fanout node (or splitter in some contexts) that copies an incoming signal to two or more data paths.

This network is used internally for most implemented FCN physical design algorithms and extends klut_network by some further convenience functions but is still fully compatible with the mockturtle network API. The function convert_network can be used to convert any other mockturtle network to this type.

Most functions in this class are borrowed and reimplemented directly from klut_network and are, therefore, only sporadically documented where their behavior might differ. For information consider mockturtle/networks/klut.hpp.

Public Functions

inline technology_network()
inline explicit technology_network(std::shared_ptr<mockturtle::klut_storage> s)

Constructs a network sharing the supplied LUT storage.

inline technology_network clone() const

Returns a network with independent storage.

inline bool is_ci(const node &n) const noexcept

Checks whether a node is a combinational input in constant time.

A node is an input iff it is not a constant and has no fanins, because every gate has at least one fanin and create_node maps functions without fanins to constants. klut_network::is_ci scans all inputs instead.

Parameters:

n – Node to consider.

Returns:

true iff n is a combinational input.

inline bool is_pi(const node &n) const noexcept

Checks whether a node is a primary input in constant time.

Equals is_ci, because this network has no further kinds of combinational inputs.

Parameters:

n – Node to consider.

Returns:

true iff n is a primary input.

template<typename Fn>
inline void foreach_gate(Fn &&fn) const

Applies a function to every gate in constant time per node.

klut_network::foreach_gate tests every node with klut_network::is_ci, which scans all inputs.

Template Parameters:

Fn – Functor type.

Parameters:

fn – Function to apply to each gate.

template<typename Fn>
inline void foreach_fanin(const node &n, Fn &&fn) const

Applies a function to every fanin of a node in constant time per node.

Constants and inputs have no fanins. klut_network::foreach_fanin tells inputs from gates with klut_network::is_ci, which scans all inputs.

Template Parameters:

Fn – Functor type.

Parameters:
  • n – Node whose fanins to visit.

  • fn – Function to apply to each fanin.

inline bool is_po(const node &n) const

Checks whether a node is primary output by considering the signal pointing to it. This is possible because this network does not use complemented signals.

Parameters:

n – Node to consider.

Returns:

true iff n’s signal is primary output.

inline signal create_buf(const signal &a)

Creates a buffer node in the network that computes the identity function and counts towards the network size and depth. A buffer node with more than one output is called a fanout.

Parameters:

a – Incoming signal to the newly created buffer node.

Returns:

Outgoing signal of the newly created buffer node.

inline signal create_not(const signal &a)

Creates a NOT gate with the supplied signal.

inline signal create_and(signal a, signal b)

Creates an AND gate with the supplied signals.

inline signal create_nand(signal a, signal b)

Creates a NAND gate with the supplied signals.

inline signal create_or(signal a, signal b)

Creates an OR gate with the supplied signals.

inline signal create_nor(signal a, signal b)

Creates a NOR gate with the supplied signals.

inline signal create_lt(signal a, signal b)

Creates an LT gate with the function a & !b.

inline signal create_ge(signal a, signal b)

Creates a GE gate with the function !a | b.

inline signal create_gt(signal a, signal b)

Creates a GT gate with the function !a & b.

inline signal create_le(signal a, signal b)

Creates an LE gate with the function a | !b.

inline signal create_xor(signal a, signal b)

Creates an XOR gate with the supplied signals.

inline signal create_xnor(signal a, signal b)

Creates an XNOR gate with the supplied signals.

inline signal create_maj(signal a, signal b, signal c)

Creates a MAJ gate with the supplied signals.

inline signal create_ite(signal a, signal b, signal c)

Creates an ITE gate with the supplied signals.

inline signal create_xor3(signal a, signal b, signal c)

Creates an XOR3 gate with the supplied signals.

inline signal create_dot(signal a, signal b, signal c)

Creates a DOT gate with the supplied signals.

inline signal create_nary_and(const std::vector<signal> &fs)

Reduces the supplied signals through a tree of binary AND gates.

An empty input returns constant true; a single input returns that signal.

inline signal create_nary_or(const std::vector<signal> &fs)

Reduces the supplied signals through a tree of binary OR gates.

An empty input returns constant false; a single input returns that signal.

inline signal create_nary_xor(const std::vector<signal> &fs)

Reduces the supplied signals through a tree of binary XOR gates.

An empty input returns constant false; a single input returns that signal.

inline signal _create_node(const std::vector<signal> &children, uint32_t literal)

Disable structural hashing.

inline signal create_node(const std::vector<signal> &children, const kitty::dynamic_truth_table &function)

Disable structural hashing.

inline signal clone_node(const klut_network &other, const node &source, const std::vector<signal> &children)

Copies a node function with the supplied children.

inline bool is_buf(const node &n) const noexcept

Returns whether the given node n is a buffer node, i.e., whether n computes the identity function and is not a PI. This also returns true on fanout nodes.

Parameters:

n – Node to consider.

Returns:

true iff n is a buffer node.

inline bool is_fanout(const node &n) const noexcept

Returns whether the given node n is a fanout node, i.e., whether n is a buffer node and has more than one output signal.

Parameters:

n – Node to consider.

Returns:

true iff n is a fanout node.

inline bool is_inv(const node &n) const noexcept

Returns whether the given node n is an inverter node.

Parameters:

n – Node to consider.

Returns:

true iff n is an inverter node.

inline bool is_and(const node &n) const noexcept

Returns whether the node implements the AND function.

inline bool is_nand(const node &n) const noexcept

Returns whether the node implements the NAND function.

inline bool is_or(const node &n) const noexcept

Returns whether the node implements the OR function.

inline bool is_nor(const node &n) const noexcept

Returns whether the node implements the NOR function.

inline bool is_lt(const node &n) const noexcept

Returns whether the node implements the LT function.

inline bool is_ge(const node &n) const noexcept

Returns whether the node implements the GE function.

inline bool is_gt(const node &n) const noexcept

Returns whether the node implements the GT function.

inline bool is_le(const node &n) const noexcept

Returns whether the node implements the LE function.

inline bool is_xor(const node &n) const noexcept

Returns whether the node implements the XOR function.

inline bool is_xnor(const node &n) const noexcept

Returns whether the node implements the XNOR function.

inline bool is_maj(const node &n) const noexcept

Returns whether the node implements the MAJ function.

inline bool is_ite(const node &n) const noexcept

Returns whether the node implements the ITE function.

inline bool is_xor3(const node &n) const noexcept

Returns whether the node implements the XOR3 function.

inline bool is_dot(const node &n) const noexcept

Returns whether the node implements the DOT function.

inline bool is_and3(const node &n) const noexcept

Returns whether the node implements the AND3 function.

inline bool is_xor_and(const node &n) const noexcept

Returns whether the node implements the XOR AND function.

inline bool is_or_and(const node &n) const noexcept

Returns whether the node implements the OR AND function.

inline bool is_onehot(const node &n) const noexcept

Returns whether the node implements the ONEHOT function.

inline bool is_gamble(const node &n) const noexcept

Returns whether the node implements the GAMBLE function.

inline bool is_and_xor(const node &n) const noexcept

Returns whether the node implements the AND XOR function.

inline void substitute_po_signals() noexcept

Adds additional buffer nodes for each primary output that does not already point to a buffer.

class aig_network

An AND-inverter graph (AIG) with node and output names.

depth() → int

Returns the number of gates on the longest input-to-output path.

fanins(n: int) → list[int]
gates() → list[int]
get_name(n: int) → str
get_output_name(index: int) → str
has_name(n: int) → bool
has_output_name(index: int) → bool
is_and(n: int) → bool

Returns whether the node implements the AND function.

is_constant(n: int) → bool
is_maj(n: int) → bool

Returns whether the node implements the MAJ function.

is_or(n: int) → bool

Returns whether the node implements the OR function.

is_pi(n: int) → bool
is_xor(n: int) → bool

Returns whether the node implements the XOR function.

nodes() → list[int]
num_gates() → int
num_pis() → int
num_pos() → int
pis() → list[int]
pos() → list[int]
set_name(n: int, name: str) → None
set_output_name(index: int, name: str) → None
size() → int
class xag_network

An XOR-AND-inverter graph (XAG) with node and output names.

depth() → int

Returns the number of gates on the longest input-to-output path.

fanins(n: int) → list[int]
gates() → list[int]
get_name(n: int) → str
get_output_name(index: int) → str
has_name(n: int) → bool
has_output_name(index: int) → bool
is_and(n: int) → bool

Returns whether the node implements the AND function.

is_constant(n: int) → bool
is_maj(n: int) → bool

Returns whether the node implements the MAJ function.

is_or(n: int) → bool

Returns whether the node implements the OR function.

is_pi(n: int) → bool
is_xor(n: int) → bool

Returns whether the node implements the XOR function.

nodes() → list[int]
num_gates() → int
num_pis() → int
num_pos() → int
pis() → list[int]
pos() → list[int]
set_name(n: int, name: str) → None
set_output_name(index: int, name: str) → None
size() → int
class mig_network

A majority-inverter graph (MIG) with node and output names.

depth() → int

Returns the number of gates on the longest input-to-output path.

fanins(n: int) → list[int]
gates() → list[int]
get_name(n: int) → str
get_output_name(index: int) → str
has_name(n: int) → bool
has_output_name(index: int) → bool
is_and(n: int) → bool

Returns whether the node implements the AND function.

is_constant(n: int) → bool
is_maj(n: int) → bool

Returns whether the node implements the MAJ function.

is_or(n: int) → bool

Returns whether the node implements the OR function.

is_pi(n: int) → bool
is_xor(n: int) → bool

Returns whether the node implements the XOR function.

nodes() → list[int]
num_gates() → int
num_pis() → int
num_pos() → int
pis() → list[int]
pos() → list[int]
set_name(n: int, name: str) → None
set_output_name(index: int, name: str) → None
size() → int
class technology_network

A mockturtle logic network type that extends klut_network. It reimplements all node creation functions to disable structural hashing. Furthermore, create_buf is overwritten such that it creates real buffer nodes that count towards the size of the network and compute the identity function. In the same way, a buffer with more than one fanout node is considered a fanout node (or splitter in some contexts) that copies an incoming signal to two or more data paths.

This network is used internally for most implemented FCN physical design algorithms and extends klut_network by some further convenience functions but is still fully compatible with the mockturtle network API. The function convert_network can be used to convert any other mockturtle network to this type.

Most functions in this class are borrowed and reimplemented directly from klut_network and are, therefore, only sporadically documented where their behavior might differ. For information consider mockturtle/networks/klut.hpp.

depth() → int

Returns the number of gates on the longest input-to-output path.

fanins(n: int) → list[int]
gates() → list[int]
get_name(n: int) → str
get_output_name(index: int) → str
has_name(n: int) → bool
has_output_name(index: int) → bool
is_and(n: int) → bool

Returns whether the node implements the AND function.

is_buf(n: int) → bool

Returns whether the given node n is a buffer node, i.e., whether n computes the identity function and is not a PI. This also returns true on fanout nodes.

Parameters:

n – Node to consider.

Returns:

true iff n is a buffer node.

is_constant(n: int) → bool
is_fanout(n: int) → bool

Returns whether the given node n is a fanout node, i.e., whether n is a buffer node and has more than one output signal.

Parameters:

n – Node to consider.

Returns:

true iff n is a fanout node.

is_inv(n: int) → bool

Returns whether the given node n is an inverter node.

Parameters:

n – Node to consider.

Returns:

true iff n is an inverter node.

is_maj(n: int) → bool

Returns whether the node implements the MAJ function.

is_nand(n: int) → bool

Returns whether the node implements the NAND function.

is_nor(n: int) → bool

Returns whether the node implements the NOR function.

is_or(n: int) → bool

Returns whether the node implements the OR function.

is_pi(n: int) → bool
is_po(n: int) → bool
is_xnor(n: int) → bool

Returns whether the node implements the XNOR function.

is_xor(n: int) → bool

Returns whether the node implements the XOR function.

nodes() → list[int]
num_gates() → int
num_pis() → int
num_pos() → int
pis() → list[int]
po_at(index: int) → int
po_index(n: int) → int
pos() → list[int]
set_name(n: int, name: str) → None
set_output_name(index: int, name: str) → None
size() → int