Skip to content

Commit 467ed78

Browse files
authored
Merge pull request #4662 from oharboe/fakeram-asap7-min-width
FakeRAM asap7: a macro at least one power-strap pitch wide
2 parents 202c7fc + ca63907 commit 467ed78

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

‎tools/FakeRAM2.0/orfs_asap7/generate.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@
3838
"fin_pitch_nm": 27,
3939
"snap_width_nm": 190,
4040
"snap_height_nm": 1400,
41+
# A macro's power pins are horizontal M4 rails, which the platform's
42+
# macro grid connects to the core's vertical M5 straps
43+
# (openRoad/pdn/grid_strategy-M1-M2-M5-M6.tcl: each net every 5.4 um,
44+
# 0.12 um wide). A narrower macro can sit between two straps of a
45+
# net, its grid gets no shapes and pdngen fails the whole design
46+
# (PDN-0233, or PDN-0179 when it cannot repair the channels). One pitch plus a strap, plus the rails' 0.048 um inset
47+
# at both edges, puts a strap of each net across the rails wherever
48+
# the macro lands.
49+
"min_width_um": 5.4 + 0.12 + 2 * 0.048,
4150
}
4251

4352
ASAP7_TIMING_CONFIG = {

‎tools/FakeRAM2.0/test/macro_dim_test.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ def test_macro_dim_add_height(self):
7171
self.assertAlmostEqual(height, exp_height, delta=self._delta)
7272
self.assertAlmostEqual(width, exp_width, delta=self._delta)
7373

74+
def test_macro_dim_min_width(self):
75+
"""A narrow macro is widened to min_width_um; a wide one is not"""
76+
77+
process_data = TestUtils.get_base_process_data().copy()
78+
process_data["min_width_um"] = 10.0
79+
process = Process(process_data)
80+
# 39 bits at 2048 deep is 5.054 um wide, below the floor
81+
width, height = process.get_macro_dimensions(39, 2048, 1, 0)
82+
self.assertAlmostEqual(width, 10.0, delta=self._delta)
83+
self.assertAlmostEqual(height, 663.552, delta=self._delta)
84+
# four banks make it 20.216 um wide, above the floor
85+
width, _ = process.get_macro_dimensions(39, 2048, 4, 0)
86+
self.assertAlmostEqual(width, 5.054 * 4, delta=self._delta)
87+
88+
def test_min_width_must_be_a_width(self):
89+
"""A min_width_um that is not a non-negative number is refused"""
90+
91+
for bad in (None, "5.6", -1.0):
92+
process_data = TestUtils.get_base_process_data().copy()
93+
process_data["min_width_um"] = bad
94+
with self.assertRaises(Exception):
95+
Process(process_data)
96+
7497
def test_macro_dim_invalid_banks(self):
7598
"""Tests detection that an invalid bank value was given"""
7699

‎tools/FakeRAM2.0/utils/class_process.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ def __init__(self, json_data):
9191
self._calc_y_step()
9292
self.bitcell_width_um = json_data.get("bitcell_width_um", None)
9393
self.bitcell_height_um = json_data.get("bitcell_height_um", None)
94+
# The narrowest macro the platform's power grid can reach; 0 for
95+
# no floor. See ASAP7_PROCESS_CONFIG in orfs_asap7/generate.py.
96+
self.min_width_um = json_data.get("min_width_um", 0.0)
97+
if (
98+
not isinstance(self.min_width_um, (int, float))
99+
or isinstance(self.min_width_um, bool)
100+
or self.min_width_um < 0
101+
):
102+
raise Exception(
103+
"min_width_um %r is not a width in um" % (self.min_width_um,)
104+
)
94105

95106
# Set to True when we want to use the process parameters or bitcell
96107
# sizes to calculate the macro dimensions. Set to False for spreadsheet
@@ -153,6 +164,7 @@ def get_macro_dimensions(self, width_in_bits, depth, num_banks, additional_heigh
153164
total_width = all_bitcell_width * 1.2
154165

155166
total_height += additional_height
167+
total_width = max(total_width, self.min_width_um)
156168

157169
return (total_width, total_height)
158170

0 commit comments

Comments
 (0)