From 4daaeae537246ec42fc646a2fcccb49c92043868 Mon Sep 17 00:00:00 2001 From: rohanku Date: Sun, 11 Feb 2024 10:37:20 -0800 Subject: [PATCH] Clean up fixes --- hammer/technology/sky130/__init__.py | 52 +++---------------- hammer/technology/sky130/sky130.tech.json | 4 +- .../sky130/sram_compiler/__init__.py | 1 + 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/hammer/technology/sky130/__init__.py b/hammer/technology/sky130/__init__.py index 9953cf032..8b9afbc9c 100644 --- a/hammer/technology/sky130/__init__.py +++ b/hammer/technology/sky130/__init__.py @@ -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;" @@ -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) @@ -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") diff --git a/hammer/technology/sky130/sky130.tech.json b/hammer/technology/sky130/sky130.tech.json index e6fa3e088..2027459f9 100644 --- a/hammer/technology/sky130/sky130.tech.json +++ b/hammer/technology/sky130/sky130.tech.json @@ -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": "", @@ -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": "", diff --git a/hammer/technology/sky130/sram_compiler/__init__.py b/hammer/technology/sky130/sram_compiler/__init__.py index fb455d9cc..e710304e1 100644 --- a/hammer/technology/sky130/sram_compiler/__init__.py +++ b/hammer/technology/sky130/sram_compiler/__init__.py @@ -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"),