migen/fhdl/tools: fix rename_clock_domain when new == old
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 24 Jul 2015 10:48:51 +0000 (12:48 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 24 Jul 2015 10:48:51 +0000 (12:48 +0200)
Clock domain renaming should support new == old to allow programmatically determined clock domain renaming.

migen/fhdl/tools.py

index 9a6c3a668cb0d10533ba1956a8f53c34b3171a25..685f4df375b68663eb659debfdec56f69eccf213 100644 (file)
@@ -256,12 +256,13 @@ def rename_clock_domain_expr(f, old, new):
 
 def rename_clock_domain(f, old, new):
     rename_clock_domain_expr(f, old, new)
-    if old in f.sync:
-        if new in f.sync:
-            f.sync[new].extend(f.sync[old])
-        else:
-            f.sync[new] = f.sync[old]
-        del f.sync[old]
+    if new != old:
+        if old in f.sync:
+            if new in f.sync:
+                f.sync[new].extend(f.sync[old])
+            else:
+                f.sync[new] = f.sync[old]
+            del f.sync[old]
     for special in f.specials:
         special.rename_clock_domain(old, new)
     try: