nMigen workaround: put default case at the end of the Switch
authorJean THOMAS <git0@pub.jeanthomas.me>
Mon, 15 Jun 2020 13:34:37 +0000 (15:34 +0200)
committerJean THOMAS <git0@pub.jeanthomas.me>
Mon, 15 Jun 2020 13:35:03 +0000 (15:35 +0200)
gram/core/crossbar.py

index 2b8d1169f302fbc2865f48629ab3c10f6a7cc3a3..70d2afbad36d955f80139f2e4df08acb20e14b84 100644 (file)
@@ -211,17 +211,17 @@ class gramCrossbar(Elaboratable):
 
         # Route data writes ------------------------------------------------------------------------
         with m.Switch(Cat(*master_wdata_readys)):
-            with m.Case():
-                m.d.comb += [
-                    controller.wdata.eq(0),
-                    controller.wdata_we.eq(0),
-                ]
             for nm, master in enumerate(self.masters):
                 with m.Case(2**nm):
                     m.d.comb += [
                         controller.wdata.eq(master.wdata.data),
                         controller.wdata_we.eq(master.wdata.we),
                     ]
+            with m.Case():
+                m.d.comb += [
+                    controller.wdata.eq(0),
+                    controller.wdata_we.eq(0),
+                ]
 
         # Route data reads -------------------------------------------------------------------------
         for master in self.masters: