Files
chipyard/vlsi/example-vlsi-sky130
2023-02-06 12:29:29 -08:00

64 lines
2.1 KiB
Python
Executable File

#!/usr/bin/env python3
#
# NOTE: the custom hooks are only used for sky130.
import os
from hammer.vlsi import CLIDriver, HammerTool, HammerToolHookAction
from typing import Dict, Callable, Optional, List
from hammer.technology.sky130 import SKY130Tech
def example_place_tap_cells(x: HammerTool) -> bool:
if x.get_setting("vlsi.core.technology") == "sky130":
x.append('''
# TODO
# Place custom TCL here
''')
return True
def example_add_fillers(x: HammerTool) -> bool:
if x.get_setting("vlsi.core.technology") == "sky130":
x.append('''
# TODO
# Place custom TCL here
''')
return True
def example_tool_settings(x: HammerTool) -> bool:
if x.get_setting("vlsi.core.technology") == "sky130":
x.append('''
# TODO
# Place custom TCL here
# only route in met1 to met4 [metal layers: li1(1), met1(2), ..., met4(5), met5(6)]
set_db route_design_bottom_routing_layer 2
set_db route_design_top_routing_layer 5
''')
return True
class ExampleDriver(CLIDriver):
def get_extra_par_hooks(self) -> List[HammerToolHookAction]:
extra_hooks = [
# Default set of steps can be found in the CAD tool plugin's __init__.py
# make_pre_insertion_hook will execute the custom hook before the specified step
# SYNTAX: make_pre_insertion_hook("EXISTING_STEP", INSERTED_HOOK)
# HammerTool.make_pre_insertion_hook("route_design", example_add_fillers),
# make_post_insertion_hook will execute the custom hook after the specified step
# HammerTool.make_post_insertion_hook("init_design", example_tool_settings),
# make_replacement_hook will replace the specified step with a custom hook
# HammerTool.make_replacement_hook("place_tap_cells", example_place_tap_cells),
# make_removal_hook will remove the specified step from the flow
HammerTool.make_removal_hook("place_bumps"),
# The target step in any of the above calls may be a default step or another one of your custom hooks
]
return extra_hooks
if __name__ == '__main__':
ExampleDriver().main()