fhdl/tools: do not attempt to rename sync clock domain if it does not exist
authorSebastien Bourdeauducq <sb@m-labs.hk>
Fri, 21 Nov 2014 22:51:05 +0000 (14:51 -0800)
committerSebastien Bourdeauducq <sb@m-labs.hk>
Fri, 21 Nov 2014 22:51:05 +0000 (14:51 -0800)
migen/fhdl/tools.py

index 6596b30c59297505187a9594ee893ec95cbe72f3..ed74ab0e14fb9f84eec7dc553b84dd06e7f1cc1a 100644 (file)
@@ -233,11 +233,12 @@ def rename_clock_domain_expr(f, old, new):
 
 def rename_clock_domain(f, old, new):
        rename_clock_domain_expr(f, old, new)
-       if new in f.sync:
-               f.sync[new].extend(f.sync[old])
-       else:
-               f.sync[new] = f.sync[old]
-       del f.sync[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: