- for byte in range(0, self.wordsize):
- sync += gpio_ports[row_start+byte].oe.eq(multi[byte].oe)
- sync += gpio_ports[row_start+byte].puen.eq(multi[byte].puen)
- sync += gpio_ports[row_start+byte].pden.eq(multi[byte].pden)
- # Check to prevent output being set if GPIO configured as input
- # TODO: No checking is done if ie/oe high together
- with m.If(gpio_ports[row_start+byte].oe):
- sync += gpio_ports[row_start+byte].o.eq(multi[byte].io)
- sync += gpio_ports[row_start+byte].bank.eq(multi[byte].bank)
+ # This is a complex case, not needed atm
+ if self.n_gpio > self.wordsize:
+ print("NOT IMPLEMENTED THIS CASE")
+ """
+ for byte in range(0, self.wordsize):
+ if ((row_start+byte) < Const(self.n_gpio)):
+ sync += gpio_ports[row+byte].oe.eq(multi[byte].oe)
+ sync += gpio_ports[row+byte].puen.eq(multi[byte].puen)
+ sync += gpio_ports[row+byte].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 m.If(gpio_ports[row+byte].oe):
+ sync += gpio_ports[row+byte].o.eq(multi[byte].io)
+ with m.Else():
+ sync += multi[byte].io.eq(gpio_ports[row+byte].i)
+ sync += gpio_ports[row+byte].bank.eq(multi[byte].bank)
+ """
+ raise
+ else:
+ for byte in range(self.n_gpio):
+ sync += gpio_ports[byte].oe.eq(multi[byte].oe)
+ sync += gpio_ports[byte].puen.eq(multi[byte].puen)
+ sync += gpio_ports[byte].pden.eq(multi[byte].pden)
+ # Check to prevent output being set if GPIO configured as i
+ # TODO: No checking is done if ie/oe high together
+ with m.If(multi[byte].oe): # gpio_ports[byte].oe):
+ sync += gpio_ports[byte].o.eq(multi[byte].io)
+ with m.Else():
+ sync += multi[byte].io.eq(gpio_ports[byte].i)
+ sync += gpio_ports[byte].bank.eq(multi[byte].bank)