Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SKY130 PDK fixes for Calibre and latest SKY130A release #842

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 42 additions & 1 deletion hammer/technology/sky130/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,25 @@ def setup_verilog(self) -> None:
with open(dest_path, 'r') as sf:
sl = sf.readlines()

# Find timing declaration
start_idx = [idx for idx, line in enumerate(sl) if "`ifndef SKY130_FD_SC_HD__LPFLOW_BLEEDER_1_TIMING_V" in line][0]

# Search for the broken statement
search_range = range(start_idx+1, len(sl))
broken_specify_idx = len(sl)-1
broken_substr = "(SHORT => VPWR) = (0:0:0,0:0:0,0:0:0,0:0:0,0:0:0,0:0:0);"

broken_specify_idx = [idx for idx in search_range if broken_substr in sl[idx]][0]
endif_idx = [idx for idx in search_range if "`endif" in sl[idx]][0]

# Now, delete all the specify statements if specify exists before an endif.
if broken_specify_idx < endif_idx:
self.logger.info("Removing incorrectly formed specify block.")
cell_def_range = range(start_idx+1, endif_idx)
start_specify_idx = [idx for idx in cell_def_range if "specify" in sl[idx]][0]
end_specify_idx = [idx for idx in cell_def_range if "endspecify" in sl[idx]][0]
sl[start_specify_idx:end_specify_idx+1] = [] # Dice

# Deal with the nonexistent net tactfully (don't code in brittle replacements)
self.logger.info("Fixing broken net references with select specify blocks.")
pattern = r"^\s*wire SLEEP.*B.*delayed;"
Expand Down Expand Up @@ -193,6 +212,28 @@ def setup_io_lefs(self) -> None:
# force class to spacer
start = [idx for idx, line in enumerate(sl) if f'MACRO {cell}' in line]
sl[start[0] + 1] = sl[start[0] + 1].replace('AREAIO', 'SPACER')

# Current version has two one-off error that break lef parser.
self.logger.info("Fixing broken sky130_ef_io__analog_esd_pad LEF definition.")
start_broken_macro_list = ["MACRO sky130_ef_io__analog_esd_pad\n", "MACRO sky130_ef_io__analog_pad\n"]
end_broken_macro_list = ["END sky130_ef_io__analog_pad\n", "END sky130_ef_io__analog_noesd_pad\n"]
end_fixed_macro_list = ["END sky130_ef_io__analog_esd_pad\n", "END sky130_ef_io__analog_pad\n"]

for start_broken_macro, end_broken_macro, end_fixed_macro in zip(start_broken_macro_list, end_broken_macro_list, end_fixed_macro_list):
# Get all start indices to be checked
start_check_indices = [idx for idx, line in enumerate(sl) if line == start_broken_macro]

# Extract broken macro
for idx_broken_macro in start_check_indices:
# Find the start of the next_macro
idx_start_next_macro = [idx for idx in range(idx_broken_macro+1, len(sl)) if "MACRO" in sl[idx]][0]
# Find the broken macro ending
idx_end_broken_macro = len(sl)
idx_end_broken_macro = [idx for idx in range(idx_broken_macro+1, len(sl)) if end_broken_macro in sl[idx]][0]

# Fix
if idx_end_broken_macro < idx_start_next_macro:
sl[idx_end_broken_macro] = end_fixed_macro

df.writelines(sl)

Expand Down Expand Up @@ -487,7 +528,7 @@ def setup_calibre_lvs_deck(ht: HammerTool) -> bool:
continue
if not source_path.exists():
raise FileNotFoundError(f"LVS deck not found: {source_path}")
dest_path = ht.technology.expand_tech_cache_path(str(deck.path))
dest_path = deck.path
ht.technology.ensure_dirs_exist(dest_path)
with open(source_path, 'r') as sf:
with open(dest_path, 'w') as df:
Expand Down
2 changes: 1 addition & 1 deletion hammer/technology/sky130/sky130.tech.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
]
},
{
"spice_file": "$SKY130A/libs.ref/sky130_fd_io/spice/sky130_ef_io__analog_pad.spice",
"spice_file": "$SKY130A/libs.ref/sky130_fd_io/spice/sky130_ef_io__analog.spice",
"provides": [
{
"lib_type": "technology"
Expand Down
Loading