Skip to content

Commit

Permalink
Add power_straps.by_tracks.power_nets API
Browse files Browse the repository at this point in the history
This setting, if set, allows precise control over which supplies in a
design the auto-strap generation should generate stripes for.
Previously, it would generate straps for all supplies
  • Loading branch information
jerryz123 committed Nov 3, 2023
1 parent 6462367 commit 87edaf4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions hammer/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,9 @@ par:
# Otherwise should be set to some layer name
# type: str

power_nets: [] # List of power nets to generate straps for. If empty, generates straps for all nets in vlsi.inputs.supplies
# type: List[str]

# DRC settings
drc.inputs:
# DRC settings
Expand Down
4 changes: 4 additions & 0 deletions hammer/config/defaults_types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ par:
# type: str
bottom_via_layer: str

# Indicates which power nets straps should be generated for
# type: list[str]
power_nets: list[str]

# DRC settings
drc.inputs:
# Top RTL module.
Expand Down
15 changes: 11 additions & 4 deletions hammer/vlsi/hammer_vlsi_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,17 +649,24 @@ def generate_power_straps_tcl(self) -> List[str]:
generate_rail_layer = self.get_setting("{}.generate_rail_layer".format(namespace))
ground_net_names = list(map(lambda x: x.name, self.get_independent_ground_nets())) # type: List[str]
power_net_names = list(map(lambda x: x.name, self.get_independent_power_nets())) # type: List[str]
specified_power_net_names = self.get_setting("{}.power_nets".format(namespace))
if len(specified_power_net_names) != 0: # filter by user specified settings
assert all(map(lambda n: n in power_net_names, specified_power_net_names))
power_net_names = specified_power_net_names
bottom_via_option = self.get_setting("{}.bottom_via_layer".format(namespace))
if bottom_via_option == "rail":
bottom_via_layer = self.get_setting("technology.core.std_cell_rail_layer")
else:
bottom_via_layer = bottom_via_option

def get_weight(s: Supply) -> int:
def get_weight(supply_name: str) -> int:
supply = list(filter(lambda s: s.name == supply_name, self.get_independent_power_nets()))
# Check that single supply with name exists
assert len(supply) == 1
# Check that it's not None
assert isinstance(s.weight, int)
return s.weight
weights = list(map(get_weight, self.get_independent_power_nets())) # type: List[int]
assert isinstance(supply[0].weight, int)
return supply[0].weight
weights = list(map(get_weight, power_net_names)) # type: List[int]
assert len(ground_net_names) == 1, "FIXME, I am assuming there's only 1 ground net"
return self.specify_all_power_straps_by_tracks(layers, bottom_via_layer, ground_net_names[0], power_net_names, weights, bbox, pin_layers, generate_rail_layer)
else:
Expand Down

0 comments on commit 87edaf4

Please sign in to comment.