Skip to content

Commit 738e7ec

Browse files
committed
psm: add db property to selectively disconnect bpins
Signed-off-by: Peter Gadfort <[email protected]>
1 parent 70c3beb commit 738e7ec

File tree

9 files changed

+91
-9
lines changed

9 files changed

+91
-9
lines changed

src/psm/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ set_pdnsim_source_settings
156156
| `-bump_interval` | Set the bump population interval, this is used to depopulate the bump grid to emulate signals and other power connections. The default bump pitch is 3. |
157157
| `-strap_track_pitch` | Sets the track pitck to use for moduling voltage sources as straps. The default is 10x. |
158158

159+
#### Selectively diconencting sources
160+
161+
If you need to be able to disconnect some of the terminals in the design, such as in the case of "what-if" analysis or different chip packaging options.
162+
This can be done by assigning `PSM_DISCONNECT` to a terminal or shape in a terminal will cause PDNSim to leave that object disconnected from the analysis.
163+
164+
```tcl
165+
# Assumes bpin is the block pin to be disconnected
166+
odb::dbBoolProperty_create $bpin PSM_DISCONNECT 1
167+
168+
# Assumes box the box shape in the bpin to be disconnected
169+
odb::dbBoolProperty_create $box PSM_DISCONNECT 1
170+
```
171+
159172
### Insert Decap Cells
160173
The `insert_decap` command inserts decap cells in the areas with the highest
161174
IR Drop. The number of decap cells inserted will be limited to the target

src/psm/src/ir_network.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ IRNetwork::generatePolygonsFromBTerms(std::vector<TerminalNode*>& terminals)
330330

331331
for (auto* bterm : net_->getBTerms()) {
332332
for (auto* bpin : bterm->getBPins()) {
333-
for (auto* geom : bpin->getBoxes()) {
333+
for (odb::dbBox* geom : bpin->getBoxes()) {
334334
for (const auto& [layer, shapes] :
335335
generatePolygonsFromBox(geom, odb::dbTransform())) {
336336
shapes_by_layer[layer] += shapes;
@@ -345,7 +345,7 @@ IRNetwork::generatePolygonsFromBTerms(std::vector<TerminalNode*>& terminals)
345345

346346
// create bpin nodes
347347
auto term = std::make_unique<TerminalNode>(pin_shape, layer);
348-
auto pin_node = std::make_unique<BPinNode>(bpin, pin_shape, layer);
348+
auto pin_node = std::make_unique<BPinNode>(bpin, geom, layer);
349349

350350
connections_.push_back(
351351
std::make_unique<TermConnection>(term.get(), pin_node.get()));
@@ -1292,7 +1292,9 @@ Node::NodeSet IRNetwork::getBPinShapeNodes() const
12921292

12931293
std::map<odb::dbTechLayer*, std::set<odb::Rect>> nodes;
12941294
for (const auto& bpin : bpin_nodes_) {
1295-
nodes[bpin->getLayer()].insert(bpin->getShape());
1295+
if (bpin->shouldConnect()) {
1296+
nodes[bpin->getLayer()].insert(bpin->getShape());
1297+
}
12961298
}
12971299

12981300
Node::NodeSet pin_nodes;

src/psm/src/ir_solver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ IRSolver::generateSourceNodesFromBTerms() const
501501

502502
std::vector<std::unique_ptr<SourceNode>> src_nodes;
503503

504-
for (auto* root_node : network_->getBPinShapeNodes()) {
504+
for (Node* root_node : network_->getBPinShapeNodes()) {
505505
src_nodes.push_back(std::make_unique<SourceNode>(root_node));
506506
}
507507

src/psm/src/node.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ std::string ITermNode::describe(const std::string& prefix) const
131131

132132
////////////////////
133133

134-
BPinNode::BPinNode(odb::dbBPin* pin,
135-
const odb::Rect& shape,
136-
odb::dbTechLayer* layer)
137-
: TerminalNode(shape, layer), pin_(pin)
134+
BPinNode::BPinNode(odb::dbBPin* pin, odb::dbBox* box, odb::dbTechLayer* layer)
135+
: TerminalNode(box->getBox(), layer), pin_(pin), box_(box)
138136
{
139137
}
140138

@@ -143,4 +141,19 @@ int BPinNode::getTypeCompareInfo() const
143141
return pin_->getId();
144142
}
145143

144+
bool BPinNode::shouldConnect() const
145+
{
146+
if (auto prop = odb::dbBoolProperty::find(pin_, kDisconnectProperty)) {
147+
if (prop != nullptr && prop->getValue()) {
148+
return false;
149+
}
150+
}
151+
if (auto prop = odb::dbBoolProperty::find(box_, kDisconnectProperty)) {
152+
if (prop != nullptr && prop->getValue()) {
153+
return false;
154+
}
155+
}
156+
return true;
157+
}
158+
146159
} // namespace psm

src/psm/src/node.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "odb/geom_boost.h"
1515

1616
namespace odb {
17+
class dbBox;
1718
class dbTechLayer;
1819
class dbBPin;
1920
class dbITerm;
@@ -125,9 +126,10 @@ class ITermNode : public TerminalNode
125126
class BPinNode : public TerminalNode
126127
{
127128
public:
128-
BPinNode(odb::dbBPin* pin, const odb::Rect& shape, odb::dbTechLayer* layer);
129+
BPinNode(odb::dbBPin* pin, odb::dbBox* box, odb::dbTechLayer* layer);
129130

130131
const odb::dbBPin* getBPin() const { return pin_; }
132+
bool shouldConnect() const;
131133

132134
protected:
133135
NodeType getType() const override { return NodeType::kBPin; }
@@ -136,6 +138,9 @@ class BPinNode : public TerminalNode
136138

137139
private:
138140
odb::dbBPin* pin_;
141+
odb::dbBox* box_;
142+
143+
static constexpr const char* kDisconnectProperty = "PSM_DISCONNECT";
139144
};
140145

141146
} // namespace psm

src/psm/test/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ COMPULSORY_TESTS = [
99
"aes_asap7_vdd",
1010
"aes_test_bterms",
1111
"aes_test_multiple_bterms",
12+
"aes_test_multiple_bterms_skipped",
1213
"aes_test_vdd",
1314
"aes_test_vss",
1415
"check_power_grid",

src/psm/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ or_integration_tests(
44
aes_asap7_vdd
55
aes_test_bterms
66
aes_test_multiple_bterms
7+
aes_test_multiple_bterms_skipped
78
aes_test_vdd
89
aes_test_vss
910
check_power_grid
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells
2+
[INFO ODB-0128] Design: aes_cipher_top
3+
[INFO ODB-0130] Created 390 pins.
4+
[INFO ODB-0131] Created 19835 components and 101835 component-terminals.
5+
[INFO ODB-0132] Created 2 special nets and 39670 connections.
6+
[INFO ODB-0133] Created 18908 nets and 62165 connections.
7+
[INFO PSM-0040] All shapes on net VDD are connected.
8+
########## IR report #################
9+
Net : VDD
10+
Corner : default
11+
Supply voltage : 1.10e+00 V
12+
Worstcase voltage: 1.10e+00 V
13+
Average voltage : 1.10e+00 V
14+
Average IR drop : 2.40e-04 V
15+
Worstcase IR drop: 2.55e-03 V
16+
Percentage drop : 0.23 %
17+
######################################
18+
[INFO PSM-0040] All shapes on net VDD are connected.
19+
########## IR report #################
20+
Net : VDD
21+
Corner : default
22+
Supply voltage : 1.10e+00 V
23+
Worstcase voltage: 1.10e+00 V
24+
Average voltage : 1.10e+00 V
25+
Average IR drop : 4.36e-04 V
26+
Worstcase IR drop: 3.52e-03 V
27+
Percentage drop : 0.32 %
28+
######################################
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
source "helpers.tcl"
2+
read_lef Nangate45/Nangate45.lef
3+
read_def Nangate45_data/aes_multi_bterms.def
4+
read_liberty Nangate45/Nangate45_typ.lib
5+
read_sdc Nangate45_data/aes.sdc
6+
7+
analyze_power_grid -net VDD
8+
9+
# Disconnect all metal6
10+
set bterm [[ord::get_db_block] findBTerm VDD]
11+
foreach bpin [$bterm getBPins] {
12+
foreach box [$bpin getBoxes] {
13+
if { [$box getTechLayer] == [[ord::get_db_tech] findLayer metal6]} {
14+
odb::dbBoolProperty_create $box PSM_DISCONNECT 1
15+
}
16+
}
17+
}
18+
19+
analyze_power_grid -net VDD

0 commit comments

Comments
 (0)