From 2d7754508ac6dfa42227f98a15f8924406b6eabb Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Sat, 21 Oct 2023 23:28:42 -0700 Subject: [PATCH 1/4] De-uniquify hierarchical blocks in genus for hierarchical flows With DDI, syn_generic uniquifies ILM module names. Prevent this by deuniquifying after syn_generic. --- hammer/synthesis/genus/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hammer/synthesis/genus/__init__.py b/hammer/synthesis/genus/__init__.py index 3f2c1966b..3cad88276 100644 --- a/hammer/synthesis/genus/__init__.py +++ b/hammer/synthesis/genus/__init__.py @@ -4,7 +4,7 @@ from hammer.vlsi import HammerTool, HammerToolStep, HammerToolHookAction, HierarchicalMode from hammer.utils import VerilogUtils -from hammer.vlsi import HammerSynthesisTool +from hammer.vlsi import HammerSynthesisTool, PlacementConstraintType from hammer.logging import HammerVLSILogging from hammer.vlsi import MMMCCornerType import hammer.tech as hammer_tech @@ -302,6 +302,16 @@ def syn_generic(self) -> bool: # Clock mapping needs at least the attributes cts_inverter_cells and cts_logic_cells to be set self.append("set_db map_clock_tree true") self.verbose_append("syn_generic") + + # With DDI, hierarchical instances may be uniquified. Use change_link to deuniquify them + if self.hierarchical_mode.is_nonleaf_hierarchical(): + pcs = list(filter(lambda c: c.type == PlacementConstraintType.Hierarchical, self.get_placement_constraints())) + for pc in pcs: + self.append(""" +if {{ [get_db hinst:{inst} .module.name] ne \"{master}\" }} {{ + change_link -instances {{{inst}}} -design_name module:{top}/{master} +}}""".format(inst=pc.path, top=self.top_module, master=pc.master)) + return True def syn_map(self) -> bool: From fa1373b1a9960e220e44f5e958f595aa5b9eb3eb Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Sun, 22 Oct 2023 13:06:07 -0700 Subject: [PATCH 2/4] Only de-uniquify for DDI versions >= 211 --- hammer/synthesis/genus/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hammer/synthesis/genus/__init__.py b/hammer/synthesis/genus/__init__.py index 3cad88276..6ed096dba 100644 --- a/hammer/synthesis/genus/__init__.py +++ b/hammer/synthesis/genus/__init__.py @@ -304,7 +304,7 @@ def syn_generic(self) -> bool: self.verbose_append("syn_generic") # With DDI, hierarchical instances may be uniquified. Use change_link to deuniquify them - if self.hierarchical_mode.is_nonleaf_hierarchical(): + if self.hierarchical_mode.is_nonleaf_hierarchical() and self.version() >= self.version_number("211"): pcs = list(filter(lambda c: c.type == PlacementConstraintType.Hierarchical, self.get_placement_constraints())) for pc in pcs: self.append(""" From d9440af5ae663f8349d4c563964a499e5037f872 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Sun, 22 Oct 2023 13:41:04 -0700 Subject: [PATCH 3/4] Add warning messages when de-uniquifying in genus --- hammer/synthesis/genus/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hammer/synthesis/genus/__init__.py b/hammer/synthesis/genus/__init__.py index 6ed096dba..2153cf97d 100644 --- a/hammer/synthesis/genus/__init__.py +++ b/hammer/synthesis/genus/__init__.py @@ -308,7 +308,10 @@ def syn_generic(self) -> bool: pcs = list(filter(lambda c: c.type == PlacementConstraintType.Hierarchical, self.get_placement_constraints())) for pc in pcs: self.append(""" -if {{ [get_db hinst:{inst} .module.name] ne \"{master}\" }} {{ +# Attempt to deuniquify hinst:{inst}, incase it was uniquified +set uniquified_name [get_db hinst:{inst} .module.name] +if {{ $uniquified_name ne \"{master}\" }} {{ + puts [format \"WARNING: instance hinst:{inst} was uniquified to be an instance of $uniquified_name, not {master}. Attempting to fix\"] change_link -instances {{{inst}}} -design_name module:{top}/{master} }}""".format(inst=pc.path, top=self.top_module, master=pc.master)) From dc017b25161152a0123e75aff5fe5caadb2d1b45 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Sun, 22 Oct 2023 16:56:41 -0700 Subject: [PATCH 4/4] change_link should copy_attributes of the uniquified instance --- hammer/synthesis/genus/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hammer/synthesis/genus/__init__.py b/hammer/synthesis/genus/__init__.py index 2153cf97d..deeec5359 100644 --- a/hammer/synthesis/genus/__init__.py +++ b/hammer/synthesis/genus/__init__.py @@ -312,7 +312,7 @@ def syn_generic(self) -> bool: set uniquified_name [get_db hinst:{inst} .module.name] if {{ $uniquified_name ne \"{master}\" }} {{ puts [format \"WARNING: instance hinst:{inst} was uniquified to be an instance of $uniquified_name, not {master}. Attempting to fix\"] - change_link -instances {{{inst}}} -design_name module:{top}/{master} + change_link -copy_attributes -instances {{{inst}}} -design_name module:{top}/{master} }}""".format(inst=pc.path, top=self.top_module, master=pc.master)) return True