Skip to content

Commit

Permalink
cores/gpio: remove GPIOInOut, add GPIOTristate
Browse files Browse the repository at this point in the history
sbourdeauducq committed Mar 3, 2016
1 parent 79c89a3 commit b0a4176
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions misoc/cores/gpio.py
Original file line number Diff line number Diff line change
@@ -16,13 +16,22 @@ def __init__(self, signal):
self.comb += signal.eq(self._out.storage)


class GPIOInOut(Module):
def __init__(self, in_signal, out_signal):
self.submodules.gpio_in = GPIOIn(in_signal)
self.submodules.gpio_out = GPIOOut(out_signal)

def get_csrs(self):
return self.gpio_in.get_csrs() + self.gpio_out.get_csrs()
class GPIOTristate(Module, AutoCSR):
def __init__(self, signals):
l = len(signals)
self._in = CSRStatus(l)
self._out = CSRStorage(l)
self._oe = CSRStorage(l)

for n, signal in enumerate(signals):
ts = TSTriple(1)
self.specials += ts.get_tristate(signal)

self.specials += MultiReg(ts.i, self._in.status)
self.comb += [
ts.o.eq(self._out.storage),
ts.oe.eq(self._oe.storage)
]


class Blinker(Module):

0 comments on commit b0a4176

Please sign in to comment.