self._append("end\n")
self.rtlil._buffer.write(str(self))
+ def attribute(self, name, value):
+ if isinstance(value, str):
+ self._append("attribute \\{} \"{}\"\n", name, value.replace("\"", "\\\""))
+ else:
+ self._append("attribute \\{} {}\n", name, int(value))
+
def wire(self, width, port_id=None, port_kind=None, name=None, src=""):
self._src(src)
name = self._make_name(name, local=False)
wire_name = "{}_{}".format(self.sub_name, node.name)
else:
wire_name = node.name
+ for attr_name, attr_value in node.attrs.items():
+ self.rtlil.attribute(attr_name, attr_value)
wire_curr = self.rtlil.wire(width=node.nbits, name=wire_name,
port_id=port_id, port_kind=port_kind)
if node in self.driven:
If `bits_sign` is `None`, the signal bit width and signedness are
determined by the integer range given by `min` (inclusive,
defaults to 0) and `max` (exclusive, defaults to 2).
+ attrs : dict
+ Dictionary of synthesis attributes.
Attributes
----------
signed : bool
name : str
reset : int
+ reset_less : bool
+ attrs : dict
"""
- def __init__(self, bits_sign=None, name=None, reset=0, reset_less=False, min=None, max=None):
+ def __init__(self, bits_sign=None, name=None, reset=0, reset_less=False, min=None, max=None,
+ attrs=None):
super().__init__()
if name is None:
self.reset = reset
self.reset_less = reset_less
+ self.attrs = OrderedDict(() if attrs is None else attrs)
+
def bits_sign(self):
return self.nbits, self.signed
__all__ = ["MultiReg"]
-class MultiReg(Module):
+class MultiReg:
def __init__(self, i, o, odomain="sys", n=2, reset=0):
self.i = i
self.o = o
self.odomain = odomain
self._regs = [Signal(self.i.bits_sign(), name="cdc{}".format(i),
- reset=reset, reset_less=True)#, attrs=("no_retiming",))
+ reset=reset, reset_less=True, attrs={"no_retiming": True})
for i in range(n)]
def get_fragment(self, platform):