This is a convenience method. Signal(flen(other)) is used frequently but that
drops the signedness. Signal((other.nbits, other.signed)) would be correct but
is long.
def __repr__(self):
return "<Signal " + (self.backtrace[-1][0] or "anonymous") + " at " + hex(id(self)) + ">"
+ @classmethod
+ def like(cls, other):
+ """Create Signal based on another.
+
+ Parameters
+ ----------
+ other : Value
+ Object to base this Signal on.
+
+ See `migen.fhdl.bitcontainer.value_bits_sign`() for details.
+ """
+ from migen.fhdl.bitcontainer import value_bits_sign
+ return cls(value_bits_sign(other))
+
class ClockSignal(Value):
"""Clock signal for a given clock domain