Skip to content

Commit

Permalink
Add supplies.voltage to override the vlsi.inputs.supplies.VDD
Browse files Browse the repository at this point in the history
Allow per-supply voltage specification. If unset, defaults to
vlsi.inputs.supplies.VDD (old behavior)
  • Loading branch information
jerryz123 committed Nov 3, 2023
1 parent 87edaf4 commit 33df464
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion hammer/vlsi/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def from_setting(d: dict) -> "SRAMParameters":
('name', str),
('pins', List[str]),
('tie', Optional[str]),
('weight', Optional[int])
('weight', Optional[int]),
('voltage', Optional[str])
])


Expand Down
4 changes: 3 additions & 1 deletion hammer/vlsi/hammer_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,14 +1090,16 @@ def get_all_supplies(self, key: str) -> List[Supply]:
supplies = self.get_setting(key)
output = [] # type: List[Supply]
for raw_supply in supplies:
supply = Supply(name=raw_supply['name'], pins=[], tie=None, weight=1)
supply = Supply(name=raw_supply['name'], pins=[], tie=None, weight=1, voltage=None)
assert 'pin' not in raw_supply, "supply.pin: str has been replaced with supply.pins: List[str]"
if 'pins' in raw_supply:
supply = supply._replace(pins=raw_supply['pins'])
if 'tie' in raw_supply:
supply = supply._replace(tie=raw_supply['tie'])
if 'weight' in raw_supply:
supply = supply._replace(weight=raw_supply['weight'])
if 'voltage' in raw_supply:
supply = supply._replace(voltage=raw_supply['voltage'])
output.append(supply)
return output

Expand Down
10 changes: 7 additions & 3 deletions hammer/vlsi/hammer_vlsi_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2138,8 +2138,11 @@ def cpf_power_specification(self) -> str:
# Define power and ground nets (HARD CODE)
power_nets = self.get_all_power_nets() # type: List[Supply]
ground_nets = self.get_all_ground_nets()# type: List[Supply]
vdd = VoltageValue(self.get_setting("vlsi.inputs.supplies.VDD")) # type: VoltageValue
output.append(f'create_power_nets -nets {{ {" ".join(map(lambda x: x.name, power_nets))} }} -voltage {vdd.value}')
for power_net in power_nets:
vdd = VoltageValue(self.get_setting("vlsi.inputs.supplies.VDD")) # type: VoltageValue
if power_net.voltage is not None:
vdd = VoltageValue(power_net.voltage)
output.append(f'create_power_nets -nets {power_net.name} -voltage {vdd.value}')
output.append(f'create_ground_nets -nets {{ {" ".join(map(lambda x: x.name, ground_nets))} }}')
# Define power domain and connections
output.append(f'create_power_domain -name {domain} -default')
Expand All @@ -2151,7 +2154,8 @@ def cpf_power_specification(self) -> str:
pins_str = ' '.join(pg_net.pins)
output.append(f'create_global_connection -domain {domain} -net {pg_net.name} -pins [list {pins_str}]')
# Create nominal operation condtion and power mode
output.append(f'create_nominal_condition -name {condition} -voltage {vdd.value}')
nominal_vdd = VoltageValue(self.get_setting("vlsi.inputs.supplies.VDD")) # type: VoltageValue
output.append(f'create_nominal_condition -name {condition} -voltage {nominal_vdd.value}')
output.append(f'create_power_mode -name {mode} -default -domain_conditions {{{domain}@{condition}}}')
# Footer
output.append("end_design")
Expand Down

0 comments on commit 33df464

Please sign in to comment.