class XilinxNoRetimingImpl(Module):
def __init__(self, reg):
- self.specials += SynthesisDirective("attribute register_balancing of {r} is no", r=reg)
+ reg.attribute += " OPTIMIZE =\"OFF\"," # XXX "register balancing is no" equivalent?
class XilinxNoRetiming:
def lower(dr):
return XilinxNoRetimingImpl(dr.reg)
-
class XilinxMultiRegImpl(MultiRegImpl):
def __init__(self, *args, **kwargs):
MultiRegImpl.__init__(self, *args, **kwargs)
- self.specials += [SynthesisDirective("attribute shreg_extract of {r} is no", r=r)
- for r in self.regs]
+ for reg in self.regs:
+ reg.attribute += " SHIFT_EXTRACT=\"NO\", ASYNC_REG=\"TRUE\","
class XilinxMultiReg:
defaults to 0) and `max` (exclusive, defaults to 2).
related : Signal or None
"""
- def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None, related=None):
+ def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None, related=None, attribute=""):
from litex.gen.fhdl.bitcontainer import bits_for
_Value.__init__(self)
self.name_override = name_override
self.backtrace = _tracer.trace_back(name)
self.related = related
+ self.attribute = attribute
def __setattr__(self, k, v):
if k == "reset":
for k, v in cases.items():
if isinstance(k, (bool, int)):
k = Constant(k)
- if (not isinstance(k, Constant)
+ if (not isinstance(k, Constant)
and not (isinstance(k, str) and k == "default")):
raise TypeError("Case object is not a Migen constant")
if not isinstance(v, _collections.Iterable):
r += "\tinput " + _printsig(ns, sig)
r += "\n);\n\n"
for sig in sorted(sigs - ios, key=lambda x: x.duid):
+ attributes = ""
+ if sig.attribute != "":
+ attributes = "(*" + sig.attribute[:-1] + "*) "
if sig in wires:
- r += "wire " + _printsig(ns, sig) + ";\n"
+ r += attributes + "wire " + _printsig(ns, sig) + ";\n"
else:
if reg_initialization:
- r += "reg " + _printsig(ns, sig) + " = " + _printexpr(ns, sig.reset)[0] + ";\n"
+ r += attributes + "reg " + _printsig(ns, sig) + " = " + _printexpr(ns, sig.reset)[0] + ";\n"
else:
- r += "reg " + _printsig(ns, sig) + ";\n"
+ r += attributes + "reg " + _printsig(ns, sig) + ";\n"
r += "\n"
return r