10#include <py2cpp/dict.hpp>
11#include <py2cpp/range.hpp>
12#include <py2cpp/set.hpp>
31template <
typename graph_t>
struct Netlist {
33 using node_t =
typename graph_t::node_t;
34 using index_t =
typename nodeview_t::key_type;
85 auto begin()
const {
return this->modules.begin(); }
87 auto end()
const {
return this->modules.end(); }
139 return this->module_weight.empty() ? 1U : this->module_weight[v];
155template <
typename graph_t>
160 num_modules(modules.size()),
161 num_nets(nets.size()) {
177 for (
const auto& v : this->
modules) {
178 if (this->max_degree < this->
gr.degree(v)) {
183 for (
const auto& net : this->
nets) {
184 if (this->max_net_degree < this->
gr.degree(net)) {
190template <
typename graph_t>
192 :
Netlist{std::move(gr), py::range(numModules), py::range(numModules, numModules + numNets)} {}
194#include <xnetwork/classes/graph.hpp>
uint32_t index_t
Definition netlist.hpp:198
xnetwork::SimpleGraph graph_t
Definition netlist.hpp:197
Netlist data structure.
Definition netlist.hpp:31
typename graph_t::nodeview_t nodeview_t
Definition netlist.hpp:32
size_t max_net_degree
Maximum degree among all nets.
Definition netlist.hpp:52
typename nodeview_t::key_type index_t
Definition netlist.hpp:34
bool has_fixed_modules
Flag indicating whether any modules have fixed positions.
Definition netlist.hpp:57
nodeview_t modules
Node view for modules (circuit components)
Definition netlist.hpp:40
size_t max_degree
Maximum degree among all modules.
Definition netlist.hpp:50
auto get_net_weight(const node_t &) const -> uint32_t
Get the net weight.
Definition netlist.hpp:147
auto get_module_weight(const node_t &v) const -> unsigned int
Get the module weight.
Definition netlist.hpp:138
size_t num_pads
Number of pads (I/O nodes)
Definition netlist.hpp:48
size_t num_nets
Number of nets in the netlist.
Definition netlist.hpp:46
typename graph_t::node_t node_t
Definition netlist.hpp:33
auto number_of_nodes() const -> size_t
Get the number of nodes.
Definition netlist.hpp:108
auto get_max_degree() const -> size_t
Get the max degree.
Definition netlist.hpp:123
auto number_of_nets() const -> size_t
Get the number of nets.
Definition netlist.hpp:101
auto end() const
Definition netlist.hpp:87
auto number_of_modules() const -> size_t
Get the number of modules.
Definition netlist.hpp:94
auto begin() const
Definition netlist.hpp:85
size_t num_modules
Number of modules in the netlist.
Definition netlist.hpp:44
graph_t gr
The underlying graph structure.
Definition netlist.hpp:38
py::set< node_t > module_fixed
Set of modules with fixed positions.
Definition netlist.hpp:59
nodeview_t nets
Node view for nets (connections)
Definition netlist.hpp:42
auto get_max_net_degree() const -> size_t
Get the max net degree.
Definition netlist.hpp:130
Netlist(graph_t gr, const nodeview_t &modules, const nodeview_t &nets)
Construct a new Netlist object.
Definition netlist.hpp:156
std::vector< unsigned int > module_weight
Weight for each module.
Definition netlist.hpp:55
Snapshot of partition state for rollback.
Definition netlist.hpp:209
py::set< Node > extern_nets
Set of external nets (nets crossing partition boundaries)
Definition netlist.hpp:211
py::dict< index_t, std::uint8_t > extern_modules
Dictionary mapping external modules to their partition assignments.
Definition netlist.hpp:213