Skip to content

Commit 6f4b517

Browse files
committed
Add support for using the new Low-Leakage power gates
If the config just says "True" (or nothing), then the variant is selected automatically, using the low-leakage one by default for anything up to width=4 and the standard ones for anything wider. Signed-off-by: Sylvain Munaut <[email protected]>
1 parent fa52402 commit 6f4b517

File tree

3 files changed

+35
-16
lines changed

3 files changed

+35
-16
lines changed

py/tt/elements.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -219,23 +219,23 @@ def __init__(self, layout, mh, width, mod_name):
219219

220220
class VddPowerSwitch(PowerSwitch):
221221

222-
def __init__(self, layout, mh):
222+
def __init__(self, layout, mp):
223223
super().__init__(
224224
layout,
225-
mh,
225+
mp.height,
226226
layout.glb.pg_vdd.width,
227-
f'tt_pg_1v8_{mh:d}'
227+
f'tt_pg_1v8_{mp.pg_vdd_variant:s}'
228228
)
229229

230230

231231
class VaaPowerSwitch(PowerSwitch):
232232

233-
def __init__(self, layout, mh):
233+
def __init__(self, layout, mp):
234234
super().__init__(
235235
layout,
236-
mh,
236+
mp.height,
237237
layout.glb.pg_vaa.width,
238-
f'tt_pg_3v3_{mh:d}'
238+
f'tt_pg_3v3_{np.pg_vaa_variant:s}'
239239
)
240240

241241

@@ -413,8 +413,8 @@ def __init__(self, layout, placer, mux_id):
413413
mod_name = f'tt_um_{mp.name:s}',
414414
mw = mp.width,
415415
mh = mp.height,
416-
pg_vdd = mp.pg_vdd,
417-
pg_vaa = mp.pg_vaa,
416+
pg_vdd = mp.pg_vdd_variant is not None,
417+
pg_vaa = mp.pg_vaa_variant is not None,
418418
analog = mp.analog,
419419
)
420420

@@ -449,19 +449,19 @@ def __init__(self, layout, placer, mux_id):
449449
self.add_child(ana_sw, Point(pos_x, pos_y), orient, name=name_pfx+f'tt_asw_{k:d}_I')
450450

451451
# Power gating
452-
if mp.pg_vdd:
452+
if mp.pg_vdd_variant is not None:
453453
# Power Switch instance
454-
vdd_sw = VddPowerSwitch(layout, mh=mp.height)
454+
vdd_sw = VddPowerSwitch(layout, mp)
455455

456456
# Add Power Switch as child
457457
self.add_child(vdd_sw, Point(blk_x, blk_y), 'N' if (blk_id & 1) else 'FS', name=name_pfx+'tt_pg_vdd_I')
458458

459459
# Shift the block
460460
blk_x += layout.glb.pg_vdd.offset
461461

462-
if mp.pg_vaa:
462+
if mp.pg_vaa_variant is not None:
463463
# Power Switch instance
464-
vaa_sw = VaaPowerSwitch(layout, mh=mp.height)
464+
vaa_sw = VaaPowerSwitch(layout, mp)
465465

466466
# Add Power Switch as child
467467
self.add_child(vaa_sw, Point(blk_x, blk_y), 'N' if (blk_id & 1) else 'FS', name=name_pfx+'tt_pg_vaa_I')

py/tt/placer.py

+19
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def __init__(self, placer, cfg_data):
3030
self.pg_vaa = cfg_data.get('pg_vaa', False)
3131
self.analog = cfg_data.get('analog', {})
3232

33+
if self.pg_vdd is True:
34+
self.pg_vdd = 'std' if self.width > 4 else 'll'
35+
3336
def as_dict(self):
3437
return {
3538
'name': self.name,
@@ -52,6 +55,22 @@ def mux_id(self):
5255
def blk_id(self):
5356
return self.placer.p2l(self.pos_x, self.pos_y)[1]
5457

58+
@property
59+
def pg_vdd_variant(self):
60+
if self.pg_vdd == 'std':
61+
return f'{self.height:d}'
62+
elif self.pg_vdd == 'll':
63+
return f'll_{self.height:d}'
64+
else:
65+
return None
66+
67+
@property
68+
def pg_vaa_variant(self):
69+
if self.pg_vdd is True:
70+
return f'{self.height:d}'
71+
else:
72+
return None
73+
5574

5675
class ModulePlacer:
5776

rtl/tt_user_module.v.mak

+4-4
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ module tt_user_module #(
9393
);
9494
% endfor
9595
% endif
96-
% if mod.pg_vdd:
97-
tt_pg_1v8_${mod.height} tt_pg_vdd_I (
96+
% if mod.pg_vdd_variant is not None:
97+
tt_pg_1v8_${mod.pg_vdd_variant} tt_pg_vdd_I (
9898
`ifdef USE_POWER_PINS
9999
.GPWR (l_vdpwr),
100100
.VPWR (VDPWR),
@@ -107,8 +107,8 @@ module tt_user_module #(
107107
assign l_vdpwr = VDPWR;
108108
`endif
109109
% endif
110-
% if mod.pg_vaa:
111-
tt_pg_3v3_${mod.height} tt_pg_vaa_I (
110+
% if mod.pg_vaa_variant is not None:
111+
tt_pg_3v3_${mod.pg_vaa_variant} tt_pg_vaa_I (
112112
`ifdef USE_POWER_PINS
113113
.GPWR (l_vapwr),
114114
.VPWR (VAPWR),

0 commit comments

Comments
 (0)