litex/examples/basic/tristate.py

17 lines
414 B
Python
Raw Normal View History

2013-02-14 18:17:24 -05:00
from migen.fhdl.structure import *
2013-02-22 11:56:35 -05:00
from migen.fhdl.specials import Tristate
2013-03-12 11:45:28 -04:00
from migen.fhdl.module import Module
2013-02-14 18:17:24 -05:00
from migen.fhdl import verilog
2013-03-12 11:45:28 -04:00
class Example(Module):
def __init__(self, n=6):
self.pad = Signal(n)
self.o = Signal(n)
self.oe = Signal()
self.i = Signal(n)
2013-02-14 18:17:24 -05:00
2013-03-12 11:45:28 -04:00
self.specials += Tristate(self.pad, self.o, self.oe, self.i)
e = Example()
print(verilog.convert(e, ios={e.pad, e.o, e.oe, e.i}))