Skip to content

Commit

Permalink
vendor.xilinx_{7series,spartan6}: emit IBUF/OBUF explicitly.
Browse files Browse the repository at this point in the history
Do this to make sure all buffers, tristate/differential or not, are
instantiated the exact same way, and are subject to the same set of
toolchain bugs, if any.
  • Loading branch information
whitequark committed Jun 17, 2019
1 parent 2a8e7bc commit 3fc5f17
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
12 changes: 10 additions & 2 deletions nmigen/vendor/xilinx_7series.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,23 @@ def get_input(self, pin, port, attrs, invert):
valid_xdrs=(0, 1, 2), valid_attrs=True)
m = Module()
i, o, t = self._get_xdr_buffer(m, pin, i_invert=True if invert else None)
m.d.comb += i.eq(port)
for bit in range(len(port)):
m.submodules += Instance("IBUF",
i_I=port[bit],
o_O=i[bit]
)
return m

def get_output(self, pin, port, attrs, invert):
self._check_feature("single-ended output", pin, attrs,
valid_xdrs=(0, 1, 2), valid_attrs=True)
m = Module()
i, o, t = self._get_xdr_buffer(m, pin, o_invert=True if invert else None)
m.d.comb += port.eq(o)
for bit in range(len(port)):
m.submodules += Instance("OBUF",
i_I=o[bit],
o_O=port[bit]
)
return m

def get_tristate(self, pin, port, attrs, invert):
Expand Down
12 changes: 10 additions & 2 deletions nmigen/vendor/xilinx_spartan6.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,15 +249,23 @@ def get_input(self, pin, port, attrs, invert):
valid_xdrs=(0, 1, 2), valid_attrs=True)
m = Module()
i, o, t = self._get_xdr_buffer(m, pin, i_invert=True if invert else None)
m.d.comb += i.eq(port)
for bit in range(len(port)):
m.submodules += Instance("IBUF",
i_I=port[bit],
o_O=i[bit]
)
return m

def get_output(self, pin, port, attrs, invert):
self._check_feature("single-ended output", pin, attrs,
valid_xdrs=(0, 1, 2), valid_attrs=True)
m = Module()
i, o, t = self._get_xdr_buffer(m, pin, o_invert=True if invert else None)
m.d.comb += port.eq(o)
for bit in range(len(port)):
m.submodules += Instance("OBUF",
i_I=o[bit],
o_O=port[bit]
)
return m

def get_tristate(self, pin, port, attrs, invert):
Expand Down

0 comments on commit 3fc5f17

Please sign in to comment.