Skip to content

Commit

Permalink
Clean up fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanku committed Feb 11, 2024
1 parent 9ce1608 commit 4daaeae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 46 deletions.
52 changes: 8 additions & 44 deletions hammer/technology/sky130/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,6 @@ 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 @@ -212,28 +193,6 @@ 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 @@ -476,12 +435,17 @@ def pegasus_lvs_blackbox_srams(ht: HammerTool) -> bool:
for name in SKY130Tech.sky130_sram_names():
lvs_box += f"\nlvs_black_box {name} -gray"
run_file = ht.lvs_ctl_file # type: ignore
with open(run_file, "a") as f:
f.write(lvs_box)
with open(run_file, "rw") as f:
# Remove SRAM SPICE file includes.
pattern = 'schematic_path.*({}).*spice;\n'.format('|'.join(SKY130Tech.sky130_sram_names()))
matcher = re.compile(pattern)
contents = f.read()
fixed_contents = matcher.sub("", contents) + lvs_box
f.write(fixed_contents)
return True

def sram22_lvs_recognize_gates_all(ht: HammerTool) -> bool:
assert isinstance(ht, HammerLVSTool), "Change 'LVS RECOGNIZE GATES' from 'NONE' to 'ALL' for Sram22"
assert isinstance(ht, HammerLVSTool), "Change 'LVS RECOGNIZE GATES' from 'NONE' to 'ALL' for SRAM22"
run_file = ht.lvs_run_file # type: ignore
with open(run_file, "a") as f:
f.write("LVS RECOGNIZE GATES ALL")
Expand Down
4 changes: 2 additions & 2 deletions hammer/technology/sky130/sky130.tech.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"tool_name": "pegasus",
"deck_name": "pegasus_drc",
"path": "$SKY130_CDS/pegasus/sky130_rev0006.drc.pvl"
"path": "$SKY130_CDS/Sky130_DRC/sky130_rev_0.0_1.0.drc.pvl"
}
],
"additional_drc_text": "",
Expand All @@ -44,7 +44,7 @@
{
"tool_name": "pegasus",
"deck_name": "pegasus_lvs",
"path": "$SKY130_CDS/pegasus/sky130_rev0001.lvs.pvl"
"path": "$SKY130_CDS/Sky130_LVS/Sky130_rev_0.0_0.1.lvs.pvl"
}
],
"additional_lvs_text": "",
Expand Down
1 change: 1 addition & 0 deletions hammer/technology/sky130/sram_compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def generate_sram(self, params: SRAMParameters, corner: MMMCCorner) -> ExtraLibr
nldm_liberty_file=lib_path,
lef_file="{b}/{n}/{n}.lef".format(b=base_dir,n=sram_name),
gds_file="{b}/{n}/{n}.gds".format(b=base_dir,n=sram_name),
spice_file="{b}/{n}/{n}.spice".format(b=base_dir,n=sram_name),
verilog_sim="{b}/{n}/{n}.v".format(b=base_dir,n=sram_name),
corner=Corner(nmos=speed_name, pmos=speed_name, temperature=str(corner.temp.value_in_units("C")) + " C"),
supplies=Supplies(VDD=str(corner.voltage.value_in_units("V")) + " V", GND="0 V"),
Expand Down

0 comments on commit 4daaeae

Please sign in to comment.