def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None): Value.__init__(self) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert(min < max) self.signed = min < 0 or max < 0 self.nbits = builtins.max(bits_for(min, self.signed), bits_for(max, self.signed)) else: assert(min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False assert(isinstance(self.nbits, int)) self.variable = variable self.reset = reset self.name_override = name_override self.backtrace = tracer.trace_back(name)
def __init__(self, bv=BV(), name=None, variable=False, reset=0, name_override=None): assert(isinstance(bv, BV)) self.bv = bv self.variable = variable self.reset = Constant(reset, bv) self.name_override = name_override self.backtrace = tracer.trace_back(name)
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None, related=None): from migen.fhdl.bitcontainer import bits_for Value.__init__(self) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert(min < max) self.signed = min < 0 or max < 0 self.nbits = builtins.max(bits_for(min, self.signed), bits_for(max, self.signed)) else: assert(min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False if not isinstance(self.nbits, int) or self.nbits <= 0: raise ValueError("Signal width must be a strictly positive integer") self.variable = variable # deprecated self.reset = reset self.name_override = name_override self.backtrace = tracer.trace_back(name) self.related = related
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, reset_less=False, name_override=None, min=None, max=None, related=None, attr=None): from migen.fhdl.bitcontainer import bits_for super().__init__() for n in [name, name_override]: if n is not None and not self._name_re.match(n): raise ValueError( "Signal name {} is not a valid Python identifier".format( repr(n))) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert (min < max) self.signed = min < 0 or max < 0 self.nbits = _builtins.max(bits_for(min, self.signed), bits_for(max, self.signed)) else: assert (min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False if isinstance(reset, (bool, int)): reset = Constant(reset, (self.nbits, self.signed)) if not isinstance(self.nbits, int) or self.nbits <= 0: raise ValueError( "Signal width must be a strictly positive integer") if attr is None: attr = set() self.variable = variable # deprecated self.reset = reset self.reset_less = reset_less self.name_override = name_override self.backtrace = _tracer.trace_back(name) self.related = related self.attr = attr
def __init__(self, bv=BV(), name=None, variable=False, reset=0, name_override=None): assert (isinstance(bv, BV)) self.bv = bv self.variable = variable self.reset = Constant(reset, bv) self.name_override = name_override self.backtrace = tracer.trace_back(name)
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, reset_less=False, name_override=None, min=None, max=None, related=None, attr=None): from migen.fhdl.bitcontainer import bits_for super().__init__() for n in [name, name_override]: if n is not None and not self._name_re.match(n): raise ValueError( "Signal name {} is not a valid Python identifier" .format(repr(n))) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert(min < max) self.signed = min < 0 or max < 0 self.nbits = _builtins.max( bits_for(min, self.signed), bits_for(max, self.signed)) else: assert(min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False if isinstance(reset, (bool, int)): reset = Constant(reset, (self.nbits, self.signed)) if not isinstance(self.nbits, int) or self.nbits <= 0: raise ValueError( "Signal width must be a strictly positive integer") if attr is None: attr = set() self.variable = variable # deprecated self.reset = reset self.reset_less = reset_less self.name_override = name_override self.backtrace = _tracer.trace_back(name) self.related = related self.attr = attr
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None, related=None, attr=None): from migen.fhdl.bitcontainer import bits_for _Value.__init__(self) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert (min < max) self.signed = min < 0 or max < 0 self.nbits = _builtins.max(bits_for(min, self.signed), bits_for(max, self.signed)) else: assert (min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False if not isinstance(self.nbits, int) or self.nbits <= 0: raise ValueError( "Signal width must be a strictly positive integer") if attr is None: attr = set() self.variable = variable # deprecated self.reset = reset self.name_override = name_override self.backtrace = _tracer.trace_back(name) self.related = related self.attr = attr
def __init__(self, bits_sign=None, name=None, variable=False, reset=0, name_override=None, min=None, max=None, related=None): from migen.fhdl.bitcontainer import bits_for Value.__init__(self) # determine number of bits and signedness if bits_sign is None: if min is None: min = 0 if max is None: max = 2 max -= 1 # make both bounds inclusive assert (min < max) self.signed = min < 0 or max < 0 self.nbits = builtins.max(bits_for(min, self.signed), bits_for(max, self.signed)) else: assert (min is None and max is None) if isinstance(bits_sign, tuple): self.nbits, self.signed = bits_sign else: self.nbits, self.signed = bits_sign, False assert (isinstance(self.nbits, int)) self.variable = variable # deprecated self.reset = reset self.name_override = name_override self.backtrace = tracer.trace_back(name) self.related = related