build/gowin/common: adding Tristate support
This commit is contained in:
parent
c1e4b3a850
commit
a0cb436467
|
@ -96,6 +96,25 @@ class GowinDifferentialOutput:
|
||||||
def lower(dr):
|
def lower(dr):
|
||||||
return GowinDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)
|
return GowinDifferentialOutputImpl(dr.i, dr.o_p, dr.o_n)
|
||||||
|
|
||||||
|
# Gowin Tristate -----------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class GowinTristateImpl(Module):
|
||||||
|
def __init__(self, io, o, oe, i):
|
||||||
|
nbits, _ = value_bits_sign(io)
|
||||||
|
for bit in range(nbits):
|
||||||
|
self.specials += Instance("IOBUF",
|
||||||
|
io_IO = io[bit] if nbits > 1 else io,
|
||||||
|
o_O = i[bit] if nbits > 1 else i,
|
||||||
|
i_I = o[bit] if nbits > 1 else o,
|
||||||
|
i_OEN = ~oe,
|
||||||
|
)
|
||||||
|
|
||||||
|
class GowinTristate:
|
||||||
|
@staticmethod
|
||||||
|
def lower(dr):
|
||||||
|
print(dr)
|
||||||
|
return GowinTristateImpl(dr.target, dr.o, dr.oe, dr.i)
|
||||||
|
|
||||||
# Gowin Special Overrides --------------------------------------------------------------------------
|
# Gowin Special Overrides --------------------------------------------------------------------------
|
||||||
|
|
||||||
gowin_special_overrides = {
|
gowin_special_overrides = {
|
||||||
|
@ -104,4 +123,5 @@ gowin_special_overrides = {
|
||||||
DDROutput: GowinDDROutput,
|
DDROutput: GowinDDROutput,
|
||||||
DifferentialInput: GowinDifferentialInput,
|
DifferentialInput: GowinDifferentialInput,
|
||||||
DifferentialOutput: GowinDifferentialOutput,
|
DifferentialOutput: GowinDifferentialOutput,
|
||||||
|
Tristate: GowinTristate,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue