efinix: supports for EfinixTristateImpl with nbits > 1
This commit is contained in:
parent
a6ed4c5c09
commit
df34b3ae6a
|
@ -65,24 +65,36 @@ class EfinixAsyncResetSynchronizer:
|
||||||
class EfinixTristateImpl(Module):
|
class EfinixTristateImpl(Module):
|
||||||
def __init__(self, platform, io, o, oe, i=None):
|
def __init__(self, platform, io, o, oe, i=None):
|
||||||
nbits, sign = value_bits_sign(io)
|
nbits, sign = value_bits_sign(io)
|
||||||
assert nbits == 1
|
|
||||||
io_name = platform.get_pin_name(io)
|
for bit in range(nbits):
|
||||||
io_loc = platform.get_pin_location(io)
|
io_name = platform.get_pin_name(io[bit])
|
||||||
io_o = platform.add_iface_io(io_name + "_OUT")
|
io_loc = platform.get_pin_location(io[bit])
|
||||||
io_oe = platform.add_iface_io(io_name + "_OE")
|
io_o = platform.add_iface_io(io_name + "_OUT")
|
||||||
io_i = platform.add_iface_io(io_name + "_IN")
|
io_oe = platform.add_iface_io(io_name + "_OE")
|
||||||
self.comb += io_o.eq(o)
|
io_i = platform.add_iface_io(io_name + "_IN")
|
||||||
self.comb += io_oe.eq(oe)
|
self.comb += io_o.eq(o[bit])
|
||||||
if i is not None:
|
self.comb += io_oe.eq(oe)
|
||||||
self.comb += i.eq(io_i)
|
if i[bit] is not None:
|
||||||
block = {
|
self.comb += i[bit].eq(io_i)
|
||||||
"type" : "GPIO",
|
block = {
|
||||||
"mode" : "INOUT",
|
"type" : "GPIO",
|
||||||
"name" : io_name,
|
"mode" : "INOUT",
|
||||||
"location" : [io_loc[0]],
|
"name" : io_name,
|
||||||
}
|
"location" : [io_loc[0]],
|
||||||
platform.toolchain.ifacewriter.blocks.append(block)
|
}
|
||||||
platform.toolchain.excluded_ios.append(io_name)
|
|
||||||
|
platform.toolchain.ifacewriter.blocks.append(block)
|
||||||
|
|
||||||
|
# Remove the group from the io list
|
||||||
|
exclude = platform.get_pin_name(io[0], without_index=True)
|
||||||
|
|
||||||
|
# In case of a single signal, there is still a '0' index
|
||||||
|
# to be remove at the end
|
||||||
|
if (nbits == 1) and (exclude[:-1] == '0'):
|
||||||
|
exclude = exclude[:-1]
|
||||||
|
|
||||||
|
platform.toolchain.excluded_ios.append(exclude)
|
||||||
|
|
||||||
|
|
||||||
class EfinixTristate(Module):
|
class EfinixTristate(Module):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -100,7 +100,10 @@ class EfinixPlatform(GenericPlatform):
|
||||||
for s, pins, others, resource in sc:
|
for s, pins, others, resource in sc:
|
||||||
if s == sig:
|
if s == sig:
|
||||||
if resource[2]:
|
if resource[2]:
|
||||||
return resource[0] + "_" + resource[2] + (f"{idx}" if slc else "")
|
name = resource[0] + "_" + resource[2]
|
||||||
|
if without_index is False:
|
||||||
|
name = name + (f"{idx}" if slc else "")
|
||||||
|
return name
|
||||||
else:
|
else:
|
||||||
return resource[0] + (f"{idx}" if slc else "")
|
return resource[0] + (f"{idx}" if slc else "")
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue