Default SEL to 1's if SEL=0 (fixes #43)
[gram.git] / gram / frontend / wishbone.py
index 44856bd2745fac71d6fce29ba2ff1e85f408b1d2..658bf9df235635147b61b955b675d73ad00afaa5 100644 (file)
@@ -37,6 +37,12 @@ class gramWishbone(Peripheral, Elaboratable):
 
         ratio_bitmask = Repl(1, log2_int(self.ratio))
 
+        sel = Signal.like(self.bus.sel)
+        with m.If(self.bus.sel == 0):
+            m.d.comb += sel.eq(Repl(1, sel.width))
+        with m.Else():
+            m.d.comb += sel.eq(self.bus.sel)
+
         with m.Switch(self.bus.adr & ratio_bitmask):
             for i in range(self.ratio):
                 with m.Case(i):