Skip to content

Commit 7d7829f

Browse files
authored
Merge pull request #2736 from The-OpenROAD-Project-staging/pdn-py
Pdn py
2 parents 908a9bb + 15c89d9 commit 7d7829f

File tree

4 files changed

+7
-29
lines changed

4 files changed

+7
-29
lines changed

src/pdn/include/pdn/PdnGen.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class PdnGen
8080
{
8181
public:
8282
PdnGen();
83+
~PdnGen();
8384

8485
void init(dbDatabase* db, Logger* logger);
8586

src/pdn/src/PdnGen-py.i

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,40 +34,26 @@
3434
///////////////////////////////////////////////////////////////////////////////
3535
%module pdngen
3636
%{
37-
38-
// These includes are needed by the SWIG generated CXX files mostly
39-
// for determining the size of Classes that they define. Since that are
40-
// not actually wrapped, the classes defined in these files will appear as
41-
// opaque pointers in Python.
42-
#include "../src/connect.h"
43-
#include "../src/domain.h"
44-
#include "../src/grid.h"
45-
#include "../src/power_cells.h"
46-
#include "../src/renderer.h"
47-
4837
#include "pdn/PdnGen.hh"
4938
#include "odb/db.h"
5039
#include <array>
5140
#include <string>
5241
#include <memory>
5342
#include <vector>
5443

55-
using pdn::ExtensionMode;
5644
using namespace pdn;
57-
5845
%}
5946

6047
%include <std_vector.i>
6148
%include <std_array.i>
6249
%include <std_map.i>
50+
%include <std_set.i>
51+
%include <std_string.i>
6352

64-
// this maps unsigned long to the enum ExtensionMode
6553
%include typemaps.i
66-
%apply unsigned long { ExtensionMode };
6754

6855
%import "odb.i"
6956
%clear int & x, int & y; // defined in dbtypes.i, must be cleared here.
70-
%include <std_string.i>
7157

7258
// These are needed to coax swig into sending or returning Python
7359
// lists, arrays, or sets (as appropriate) of opaque pointers. Note
@@ -83,19 +69,8 @@ namespace std {
8369
%template(viagen_list) std::vector<odb::dbTechViaGenerateRule *>;
8470
%template(techvia_list) std::vector<odb::dbTechVia *>;
8571
%template(layer_list) std::vector<odb::dbTechLayer *>;
72+
%template(net_set) std::set<odb::dbNet*>;
8673
}
8774

8875
%include "../../Exception-py.i"
8976
%include "pdn/PdnGen.hh"
90-
91-
%inline %{
92-
93-
namespace pdn {
94-
95-
// difficult to pass a set. repair_pdn_via takes a vector and then
96-
// rebuilds the set in C++, so we just borrow that here.
97-
void repair_pdn_vias(const std::vector<odb::dbNet*>& nets);
98-
99-
} // namespace
100-
101-
%} // %inline

src/pdn/src/PdnGen.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ PdnGen::PdnGen() : db_(nullptr), logger_(nullptr)
6969
{
7070
}
7171

72+
PdnGen::~PdnGen() = default;
73+
7274
void PdnGen::init(dbDatabase* db, Logger* logger)
7375
{
7476
db_ = db;

src/pdn/test/pdn_aux.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,5 +665,5 @@ def repair_pdn_vias(design, *, net=None, all=False):
665665
if net.getSigType() == "POWER" or net.getSigType() == "GROUND":
666666
nets.append(net)
667667

668-
pdn.repair_pdn_vias(nets)
668+
pdngen.repairVias(nets)
669669

0 commit comments

Comments
 (0)