Skip to content

Commit c887b2e

Browse files
Bias pin handling (#409)
* Update STA to exclude bias pins from timing graph and subsequently in write_verilog Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com> * unnecessary space in orig verilog Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com> * Update to use well supplies rather than bias pins Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com> --------- Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
1 parent 645f266 commit c887b2e

9 files changed

Lines changed: 80 additions & 4 deletions

File tree

include/sta/PortDirection.hh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public:
4141
static PortDirection *internal() { return internal_; }
4242
static PortDirection *ground() { return ground_; }
4343
static PortDirection *power() { return power_; }
44+
static PortDirection *well() { return well_; }
4445
static PortDirection *unknown() { return unknown_; }
4546
static PortDirection *find(const char *dir_name);
4647
std::string_view name() const { return name_; }
@@ -57,7 +58,8 @@ public:
5758
bool isAnyTristate() const;
5859
bool isGround() const { return this == ground_; }
5960
bool isPower() const { return this == power_; }
60-
// Ground or power.
61+
bool isWell() const { return this == well_; }
62+
// Ground, power, or well.
6163
bool isPowerGround() const;
6264
bool isInternal() const { return this == internal_; }
6365
bool isUnknown() const { return this == unknown_; }
@@ -76,6 +78,7 @@ private:
7678
static PortDirection *internal_;
7779
static PortDirection *ground_;
7880
static PortDirection *power_;
81+
static PortDirection *well_;
7982
static PortDirection *unknown_;
8083
};
8184

liberty/LibertyReader.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,6 +1215,12 @@ LibertyReader::makePgPinPort(LibertyCell *cell,
12151215
case PwrGndType::internal_power:
12161216
dir = PortDirection::power();
12171217
break;
1218+
case PwrGndType::nwell:
1219+
case PwrGndType::pwell:
1220+
case PwrGndType::deepnwell:
1221+
case PwrGndType::deeppwell:
1222+
dir = PortDirection::well();
1223+
break;
12181224
case PwrGndType::none:
12191225
error(1291, pg_pin_group, "unknown pg_type.");
12201226
break;

liberty/LibertyWriter.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,9 @@ LibertyWriter::asString(const PortDirection *dir)
569569
return "internal";
570570
else if (dir == PortDirection::bidirect())
571571
return "inout";
572-
else if (dir == PortDirection::ground() || dir == PortDirection::power())
572+
else if (dir == PortDirection::ground()
573+
|| dir == PortDirection::power()
574+
|| dir == PortDirection::well())
573575
return "input";
574576
return "unknown";
575577
}

network/PortDirection.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ PortDirection *PortDirection::bidirect_;
3535
PortDirection *PortDirection::internal_;
3636
PortDirection *PortDirection::ground_;
3737
PortDirection *PortDirection::power_;
38+
PortDirection *PortDirection::well_;
3839
PortDirection *PortDirection::unknown_;
3940

4041
void
@@ -47,7 +48,8 @@ PortDirection::init()
4748
internal_ = new PortDirection("internal", 4);
4849
ground_ = new PortDirection("ground", 5);
4950
power_ = new PortDirection("power", 6);
50-
unknown_ = new PortDirection("unknown", 7);
51+
well_ = new PortDirection("well", 7);
52+
unknown_ = new PortDirection("unknown", 8);
5153
}
5254

5355
void
@@ -67,6 +69,8 @@ PortDirection::destroy()
6769
ground_ = nullptr;
6870
delete power_;
6971
power_ = nullptr;
72+
delete well_;
73+
well_ = nullptr;
7074
delete unknown_;
7175
unknown_ = nullptr;
7276
}
@@ -95,6 +99,8 @@ PortDirection::find(const char *dir_name)
9599
return ground_;
96100
else if (stringEqual(dir_name, "power"))
97101
return power_;
102+
else if (stringEqual(dir_name, "well"))
103+
return well_;
98104
else
99105
return nullptr;
100106
}
@@ -125,7 +131,8 @@ bool
125131
PortDirection::isPowerGround() const
126132
{
127133
return this == ground_
128-
|| this == power_;
134+
|| this == power_
135+
|| this == well_;
129136
}
130137

131138
} // namespace

test/regression_vars.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ record_public_tests {
165165
report_json2
166166
suppress_msg
167167
verilog_attribute
168+
verilog_well_supplies
168169
verilog_specify
169170
verilog_write_escape
170171
verilog_unconnected_hpin

test/verilog_well_supplies.ok

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module top (y,
2+
a);
3+
output y;
4+
input a;
5+
6+
7+
sky130_fd_sc_hd__buf_1 u1 (.A(a),
8+
.X(y));
9+
endmodule
10+
module top (y,
11+
a);
12+
output y;
13+
input a;
14+
15+
wire VGND;
16+
wire VNB;
17+
wire VPB;
18+
wire VPWR;
19+
20+
sky130_fd_sc_hd__buf_1 u1 (.VGND(VGND),
21+
.VNB(VNB),
22+
.VPB(VPB),
23+
.VPWR(VPWR),
24+
.A(a),
25+
.X(y));
26+
endmodule

test/verilog_well_supplies.tcl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Check that write_verilog excludes well pins along with power/ground pins.
2+
source helpers.tcl
3+
read_liberty ../examples/sky130hd_tt.lib.gz
4+
read_verilog verilog_well_supplies.v
5+
link_design top
6+
set verilog_file [make_result_file "verilog_well_supplies.v"]
7+
write_verilog $verilog_file
8+
report_file $verilog_file
9+
10+
set verilog_pwr_file [make_result_file "verilog_well_supplies_pwr.v"]
11+
write_verilog -include_pwr_gnd $verilog_pwr_file
12+
report_file $verilog_pwr_file

test/verilog_well_supplies.v

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module top (
2+
output y,
3+
input a
4+
);
5+
supply1 VPWR;
6+
supply0 VGND;
7+
supply1 VPB;
8+
supply0 VNB;
9+
sky130_fd_sc_hd__buf_1 u1 (
10+
.X(y),
11+
.A(a),
12+
.VPWR(VPWR),
13+
.VGND(VGND),
14+
.VPB(VPB),
15+
.VNB(VNB)
16+
);
17+
endmodule

verilog/VerilogWriter.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ VerilogWriter::verilogPortDir(PortDirection *dir)
253253
return "inout";
254254
else if (dir == PortDirection::ground())
255255
return "inout";
256+
else if (dir == PortDirection::well())
257+
return "inout";
256258
else if (dir == PortDirection::internal()
257259
|| dir == PortDirection::unknown())
258260
return "inout";

0 commit comments

Comments
 (0)