Skip to content

Commit 022947e

Browse files
committed
pad: add user control of mode
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 672c075 commit 022947e

File tree

12 files changed

+1958
-18
lines changed

12 files changed

+1958
-18
lines changed

src/pad/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ place_pads -row IO_SOUTH u_reset.u_in u_reset.u_out
219219
```tcl
220220
place_pads
221221
-row row_name
222+
[-mode mode]
222223
pads
223224
```
224225

@@ -227,6 +228,7 @@ place_pads
227228
| Switch Name | Description |
228229
| ----- | ----- |
229230
| `-row` | Name of the row to place the pad into, examples include: `IO_NORTH`, `IO_SOUTH`, `IO_WEST`, `IO_EAST`, `IO_NORTH_0`, `IO_NORTH_1`. |
231+
| `-mode` | Select the mode to use during pad placement, choices are `bump_aligned` and `uniform`. Default will select `bump_aligned` if possible, otherwise fallback to `uniform`. |
230232
| `pads` | Name of the instances in the order they should be placed (left to right for `IO_SOUTH` and `IO_NORTH` and bottom to top for `IO_WEST` and `IO_EAST`). |
231233

232234

src/pad/include/pad/ICeWall.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ namespace pad {
2626
class RDLRouter;
2727
class RDLGui;
2828

29+
enum class PlacementStrategy
30+
{
31+
DEFAULT,
32+
BUMP_ALIGNED,
33+
UNIFORM
34+
};
35+
2936
class ICeWall
3037
{
3138
public:
@@ -67,7 +74,9 @@ class ICeWall
6774
odb::dbRow* row,
6875
int location,
6976
bool mirror);
70-
void placePads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row);
77+
void placePads(const std::vector<odb::dbInst*>& insts,
78+
odb::dbRow* row,
79+
const PlacementStrategy& mode);
7180
void placeCorner(odb::dbMaster* master, int ring_index);
7281
void placeFiller(const std::vector<odb::dbMaster*>& masters,
7382
odb::dbRow* row,

src/pad/src/ICeWall.cpp

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,9 @@ int64_t ICeWall::computePadBumpDistance(odb::dbInst* inst,
679679
return std::numeric_limits<int64_t>::max();
680680
}
681681

682-
void ICeWall::placePads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row)
682+
void ICeWall::placePads(const std::vector<odb::dbInst*>& insts,
683+
odb::dbRow* row,
684+
const PlacementStrategy& mode)
683685
{
684686
auto* block = getBlock();
685687
if (block == nullptr) {
@@ -761,17 +763,34 @@ void ICeWall::placePads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row)
761763
}
762764
}
763765

764-
if (!iterm_connections.empty()) {
765-
placePadsBumpAligned(insts,
766-
row,
767-
inst_widths,
768-
total_width,
769-
row_width,
770-
row_start,
771-
iterm_connections);
772-
} else {
773-
placePadsUniform(
774-
insts, row, inst_widths, total_width, row_width, row_start);
766+
PlacementStrategy use_mode = mode;
767+
if (use_mode == PlacementStrategy::DEFAULT) {
768+
if (!iterm_connections.empty()) {
769+
use_mode = PlacementStrategy::BUMP_ALIGNED;
770+
}
771+
}
772+
if (use_mode == PlacementStrategy::BUMP_ALIGNED
773+
&& iterm_connections.empty()) {
774+
logger_->warn(
775+
utl::PAD, 9, "Unable to use bump_aligned mode, switching to uniform");
776+
use_mode = PlacementStrategy::UNIFORM;
777+
}
778+
779+
switch (use_mode) {
780+
case PlacementStrategy::BUMP_ALIGNED:
781+
placePadsBumpAligned(insts,
782+
row,
783+
inst_widths,
784+
total_width,
785+
row_width,
786+
row_start,
787+
iterm_connections);
788+
break;
789+
case PlacementStrategy::UNIFORM:
790+
case PlacementStrategy::DEFAULT:
791+
placePadsUniform(
792+
insts, row, inst_widths, total_width, row_width, row_start);
793+
break;
775794
}
776795

777796
logger_->info(

src/pad/src/pad.i

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ utl::Logger* getLogger();
2626
%include "exception.i"
2727
%include "../../Exception.i"
2828

29+
%typemap(in) pad::PlacementStrategy {
30+
char *str = Tcl_GetStringFromObj($input, 0);
31+
if (strcasecmp(str, "bump_aligned") == 0) {
32+
$1 = pad::PlacementStrategy::BUMP_ALIGNED;
33+
} else if (strcasecmp(str, "uniform") == 0) {
34+
$1 = pad::PlacementStrategy::UNIFORM;
35+
} else if (strcasecmp(str, "default") == 0) {
36+
$1 = pad::PlacementStrategy::DEFAULT;
37+
} else {
38+
$1 = pad::PlacementStrategy::DEFAULT;
39+
}
40+
}
2941

3042
%inline %{
3143

@@ -77,9 +89,9 @@ void place_pad(odb::dbMaster* master, const char* name, odb::dbRow* row, int loc
7789
ord::getICeWall()->placePad(master, name, row, location, mirror);
7890
}
7991

80-
void place_pads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row)
92+
void place_pads(const std::vector<odb::dbInst*>& insts, odb::dbRow* row, pad::PlacementStrategy mode)
8193
{
82-
ord::getICeWall()->placePads(insts, row);
94+
ord::getICeWall()->placePads(insts, row, mode);
8395
}
8496

8597
void place_corner(odb::dbMaster* master, int ring_index)

src/pad/src/pad.tcl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,12 @@ proc place_pad { args } {
234234
}
235235

236236
sta::define_cmd_args "place_pads" {-row row_name \
237+
[-mode mode] \
237238
pads}
238239

239240
proc place_pads { args } {
240241
sta::parse_key_args "place_pads" args \
241-
keys {-row} \
242+
keys {-row -mode} \
242243
flags {}
243244

244245
if { $args == {} } {
@@ -249,6 +250,11 @@ proc place_pads { args } {
249250
set args [lindex $args 0]
250251
}
251252

253+
set mode "default"
254+
if { [info exists keys(-mode)] } {
255+
set mode $keys(-mode)
256+
}
257+
252258
set insts []
253259
foreach inst $args {
254260
lappend insts [pad::find_instance $inst]
@@ -257,7 +263,8 @@ proc place_pads { args } {
257263
pad::assert_required place_pads -row
258264
pad::place_pads \
259265
$insts \
260-
[pad::get_row $keys(-row)]
266+
[pad::get_row $keys(-row)] \
267+
$mode
261268
}
262269

263270
sta::define_cmd_args "place_io_fill" {-row row_name \

src/pad/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ COMPULSORY_TESTS = [
3434
"place_pad_wrong_master",
3535
"place_pads_bumps",
3636
"place_pads_bumps_bump_overlap",
37+
"place_pads_bumps_strategy",
3738
"place_pads_too_many",
3839
"place_pads_uniform",
3940
"place_pads_uniform_slip",

src/pad/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ or_integration_tests(
2727
place_pad_overblockage
2828
place_pad_with_bumps
2929
place_pads_bumps_bump_overlap
30+
place_pads_bumps_strategy
3031
place_pad_wrong_master
3132
place_pads_bumps
3233
place_pads_too_many

0 commit comments

Comments
 (0)