CkPttn 1.2.4
Loading...
Searching...
No Matches
HierNetlist.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ckpttn/array_like.hpp> // for ShiftArray
9#include <cstdint> // for uint8_t
10#include <netlistx/netlist.hpp> // for Netlist, Netlist<>::nodeview_t
11#include <py2cpp/dict.hpp> // for dict
12#include <py2cpp/set.hpp> // for set
13#include <span> // for span
14// #include <type_traits> // for move
15#include <vector> // for vector
16#include <xnetwork/classes/graph.hpp> // for SimpleGraph, Graph, Graph<>::n...
17
18// using node_t = int;
19
20// struct PartInfo
21// {
22// std::vector<std::uint8_t> part;
23// py::set<node_t> extern_nets;
24// };
25
35template <typename graph_t> class HierNetlist : public Netlist<graph_t> {
36 public:
37 using nodeview_t = typename graph_t::nodeview_t;
38 using node_t = typename graph_t::node_t;
39 using index_t = typename nodeview_t::key_type;
40
41 /* For multi-level algorithms */
45 std::vector<node_t> node_up_map;
47 std::vector<node_t> node_down_map;
49 py::dict<index_t, node_t> cluster_down_map;
52
61
70 void projection_down(std::span<const std::uint8_t> part,
71 std::span<std::uint8_t> part_down) const;
72
79 void projection_up(std::span<const std::uint8_t> part, std::span<std::uint8_t> part_up) const;
80
90 auto get_net_weight(const node_t& net) const -> uint32_t {
91 return this->net_weight.empty() ? 1U : this->net_weight[net];
92 }
93};
94
102template <typename graph_t>
104 : Netlist<graph_t>{std::move(gr), modules, nets} {}
105
106// template <typename graph_t>
107// HierNetlist<graph_t>::HierNetlist(graph_t gr, uint32_t numModules, uint32_t
108// numNets)
109// : Netlist<graph_t> {std::move(gr), py::range<uint32_t>(numModules),
110// py::range<uint32_t>(numModules, numModules + numNets)}
111// {
112// }
113
ShiftArray container with shifted index access.
Hierarchical Netlist.
Definition HierNetlist.hpp:35
typename nodeview_t::key_type index_t
Definition HierNetlist.hpp:39
HierNetlist(graph_t gr, const nodeview_t &modules, const nodeview_t &nets)
Constructs a new HierNetlist object.
Definition HierNetlist.hpp:103
typename graph_t::node_t node_t
Definition HierNetlist.hpp:38
void projection_down(std::span< const std::uint8_t > part, std::span< std::uint8_t > part_down) const
Projection down.
ShiftArray< std::vector< uint32_t > > net_weight
Net weights for each net in the hierarchical netlist.
Definition HierNetlist.hpp:51
auto get_net_weight(const node_t &net) const -> uint32_t
Returns the weight of the specified net.
Definition HierNetlist.hpp:90
const Netlist< graph_t > * parent
Pointer to the parent netlist in the hierarchy.
Definition HierNetlist.hpp:43
void projection_up(std::span< const std::uint8_t > part, std::span< std::uint8_t > part_up) const
Projects a part up to a higher level of the hierarchy.
std::vector< node_t > node_up_map
Mapping from this level's nodes to parent's nodes (upward)
Definition HierNetlist.hpp:45
py::dict< index_t, node_t > cluster_down_map
Mapping from cluster index to child nodes.
Definition HierNetlist.hpp:49
typename graph_t::nodeview_t nodeview_t
Definition HierNetlist.hpp:37
std::vector< node_t > node_down_map
Mapping from this level's nodes to children's nodes (downward)
Definition HierNetlist.hpp:47
Shift Array container with shifted index access.
Definition array_like.hpp:47
xnetwork::SimpleGraph graph_t
Definition netlist.hpp:197
Netlist data structure.
Definition netlist.hpp:31
nodeview_t modules
Node view for modules (circuit components)
Definition netlist.hpp:40
graph_t gr
The underlying graph structure.
Definition netlist.hpp:38
nodeview_t nets
Node view for nets (connections)
Definition netlist.hpp:42