Skip to content

Commit 9fe4455

Browse files
authored
Merge pull request #8529 from The-OpenROAD-Project-staging/ram-misc
ram: add Python wrapper and fix a few Coverity uninit_ctor
2 parents 73ec0cc + 8211129 commit 9fe4455

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

src/ram/CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ messages(
6262
TARGET ram
6363
)
6464

65-
#if (Python3_FOUND AND BUILD_PYTHON)
66-
# swig_lib(NAME ram_py
67-
# NAMESPACE ram
68-
# LANGUAGE python
69-
# I_FILE src/ram-py.i
70-
# SWIG_INCLUDES ${PROJECT_SOURCE_DIR}/include/ram
71-
# SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/ram_py.py
72-
# )
73-
#
74-
# target_link_libraries(ram_py
75-
# PUBLIC
76-
# ram
77-
# odb
78-
# )
79-
#
80-
#endif()
65+
if (Python3_FOUND AND BUILD_PYTHON)
66+
swig_lib(NAME ram_py
67+
NAMESPACE ram
68+
LANGUAGE python
69+
I_FILE src/ram-py.i
70+
SWIG_INCLUDES ${PROJECT_SOURCE_DIR}/include/ram
71+
SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/ram_py.py
72+
)
73+
74+
target_link_libraries(ram_py
75+
PUBLIC
76+
ram
77+
odb
78+
)
79+
80+
endif()
8181

8282
add_subdirectory(test)

src/ram/include/ram/ram.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ class RamGen
9090

9191
sta::dbNetwork* network_;
9292
odb::dbDatabase* db_;
93-
odb::dbBlock* block_;
93+
odb::dbBlock* block_{nullptr};
9494
Logger* logger_;
9595

96-
odb::dbMaster* storage_cell_;
97-
odb::dbMaster* tristate_cell_;
98-
odb::dbMaster* inv_cell_;
99-
odb::dbMaster* and2_cell_;
100-
odb::dbMaster* clock_gate_cell_;
101-
odb::dbMaster* buffer_cell_;
96+
odb::dbMaster* storage_cell_{nullptr};
97+
odb::dbMaster* tristate_cell_{nullptr};
98+
odb::dbMaster* inv_cell_{nullptr};
99+
odb::dbMaster* and2_cell_{nullptr};
100+
odb::dbMaster* clock_gate_cell_{nullptr};
101+
odb::dbMaster* buffer_cell_{nullptr};
102102
};
103103

104104
} // namespace ram

src/ram/src/ram-py.i

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2022-2025, The OpenROAD Authors
3+
4+
%{
5+
#include "ord/OpenRoad.hh"
6+
#include "ram/ram.h"
7+
8+
%}
9+
10+
%include "../../Exception-py.i"
11+
%include "ram/ram.h"

0 commit comments

Comments
 (0)