- domain += multi[byte].oe.eq(gp[gpio].oe)
- domain += multi[byte].puen.eq(gp[gpio].puen)
- domain += multi[byte].pden.eq(gp[gpio].pden)
- # Check to prevent output being set if GPIO configured as i
- # TODO: No checking is done if ie/oe high together
- with module.If(multi[byte].oe):
- domain += multi[byte].io.eq(gp[gpio].o)
- with module.Else():
- domain += multi[byte].io.eq(gp[byte].i)
- domain += multi[byte].bank.eq(gp[gpio].bank)
+ self.rd_connect_one_byte(module, domain, gp, multi, byte, 0)
+
+ def rd_connect_one_byte(self, module, domain, gp, multi, byte, offset):
+ domain += multi[byte].oe.eq(gp[byte+offset].oe)
+ domain += multi[byte].puen.eq(gp[byte+offset].puen)
+ domain += multi[byte].pden.eq(gp[byte+offset].pden)
+ with module.If(gp[byte+offset].oe):
+ domain += multi[byte].ie.eq(0)
+ domain += multi[byte].io.eq(gp[byte+offset].o)
+ with module.Else():
+ domain += multi[byte].ie.eq(1) # Return GPIO as i by default
+ domain += multi[byte].io.eq(gp[byte+offset].i)
+
+ domain += multi[byte].bank.eq(gp[byte+offset].bank)
+
+ def wr_connect_one_byte(self, module, domain, gp, multi, byte, offset):
+ domain += gp[byte+offset].oe.eq(multi[byte].oe)
+ domain += gp[byte+offset].puen.eq(multi[byte].puen)
+ domain += gp[byte+offset].pden.eq(multi[byte].pden)
+ # prevent output being set if GPIO configured as i
+ # TODO: No checking is done if ie/oe high together
+ with module.If(multi[byte].oe):
+ domain += gp[byte+offset].o.eq(multi[byte].io)
+ with module.Else():
+ domain += gp[byte+offset].o.eq(0)
+ domain += gp[byte+offset].bank.eq(multi[byte].bank)