def __init__(self, waitstartcycles=0, *args, **kwargs): ''' Constructor is overloaded only to ensure the correct parameters are used such that the Bus is configured properly. ''' self.__waitstartcycles = waitstartcycles BusMonitor.__init__(self, name="", bus_separator="", *args, **kwargs)
def __init__(self, entity, name, clock, lsb_first=True, tuser_bytewise=False, **kwargs): self._init_done = Event( "Init Done" ) # workaround for scheduler immediately running newly added coroutines BusMonitor.__init__(self, entity, name, clock, **kwargs) if hasattr(self.bus, 'tdata'): self._n_bytes, rem = divmod(len(self.bus.tdata), 8) if rem: raise AttributeError("tdata width has to be multiple of 8") else: self._n_bytes = 1 if hasattr(self.bus, 'tuser'): self._tuser_bytewise = tuser_bytewise if tuser_bytewise and self._n_bytes: self._user_bits, rem = divmod(len(self.bus.tuser), self._n_bytes) if rem: raise AttributeError( "in byte-wise mode tuser width has to be multiple of tdata width" ) else: self._user_bits = len(self.bus.tuser) self._lsb_first = lsb_first self._init_done.set()
def __init__(self, entity, clock, scoreboard): BusMonitor.__init__(self, entity, "", clock) self._expected = None self._log = getLogger(scoreboard.log.name + '.' + self.name) self._scoreboard = scoreboard scoreboard.add_interface(self, [], compare_fn=self.compare)
def __init__(self, entity, name, clock, callback=None, reset_n=None): BusMonitor.__init__(self, entity, name, clock, callback=callback, event=None, reset_n=None)
def __init__(self, entity, name, clock, *, config={}, **kwargs): BusMonitor.__init__(self, entity, name, clock, **kwargs) self.config = self._default_config.copy() for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s", configoption, str(value))
def __init__(self, *args, **kwargs): BusMonitor.__init__(self, *args, **kwargs) # Drive some sensible defaults (setimmediatevalue to avoid x asserts) self.bus.ack.setimmediatevalue(0) self.bus.datrd.setimmediatevalue(0) if hasattr(self.bus, "err"): self.bus.err.setimmediatevalue(0) if hasattr(self.bus, "stall"): self.bus.stall.setimmediatevalue(0)
def __init__(self, *args, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, *args, **kwargs) self.config = AvalonSTPkts._default_config.copy() for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s" % (configoption, str(value)))
def __init__(self, *args, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, *args, **kwargs) self.config = self._default_config.copy() for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s", configoption, str(value))
def __init__(self, dut, callback=None, event=None): BusMonitor.__init__(self, dut, None, dut.Clock, dut.Reset, callback=callback, event=event) self.name = "out"
def __init__(self, entity, name, clock): BusDriver.__init__(self, entity, name, clock) BusMonitor.__init__(self, entity, name, clock) self.clock = clock self.bus.PWRITE.setimmediatevalue(0) self.bus.PSELx.setimmediatevalue(0) self.bus.PENABLE.setimmediatevalue(0) self.bus.PADDR.setimmediatevalue(0) self.bus.PWDATA.setimmediatevalue(0)
def __init__(self, entity, name, clock, registers, signals=None, pkg=False, random_ready_probability=0, random_error_probability=0, **kwargs): # has the signals been explicitely defined? if signals: self._signals = signals else: # a SystemVerilog package is used if pkg: self._signals = {} for signal_name in [ 'psel', 'pwrite', 'penable', 'paddr', 'pwdata', 'pstrb' ]: self._signals[ signal_name.upper()] = name + '_h2d.' + signal_name for signal_name in ['prdata', 'pready', 'pslverr']: self._signals[ signal_name.upper()] = name + '_d2h.' + signal_name name = None # just use the default APB names else: self._signals = [ "PSEL", "PWRITE", "PENABLE", "PADDR", "PWDATA", "PRDATA", "PREADY" ] self._optional_signals = ["PSLVERR", "PSTRB"] BusMonitor.__init__(self, entity, name, clock, **kwargs) self.clock = clock # initialise all outputs to zero self.bus.PRDATA.setimmediatevalue(0) self.bus.PREADY.setimmediatevalue(0) self.bus.PSLVERR.setimmediatevalue(0) # store the default registers value self.registers_init = registers # setting for the probability of PREADY delay self.random_ready_probability = random_ready_probability self.random_error_probability = random_error_probability self.reset()
def __init__(self, dut, tb, callback=None, event=None): """tb must be an instance of the Testbench class.""" BusMonitor.__init__(self, dut, None, dut.Clock, dut.Reset, callback=callback, event=event) self.name = "out" self.tb = tb
def __init__(self, entity, name, clock, baud_rate, reset=None, reset_n=None, callback=None, event=None, bus_seperator="_"): BusMonitor.__init__(self, entity, name, clock, reset, reset_n, callback, event, bus_seperator) self.baud_rate = baud_rate self.receiving = False
def __init__(self, entity, name, clock, signals_dict=None, **kwargs): if signals_dict is not None: self._signals=signals_dict self._width = kwargs.pop('width', 32) BusMonitor.__init__(self, entity, name, clock, **kwargs) # Drive some sensible defaults (setimmediatevalue to avoid x asserts) self.bus.ack.setimmediatevalue(0) self.bus.datrd.setimmediatevalue(0) if hasattr(self.bus, "err"): self.bus.err.setimmediatevalue(0) if hasattr(self.bus, "stall"): self.bus.stall.setimmediatevalue(0) if hasattr(self.bus, "rty"): self.bus.rty.setimmediatevalue(0)
def __init__(self, entity, name, clock, *, config={}, report_channel=False, **kwargs): BusMonitor.__init__(self, entity, name, clock, **kwargs) self.config = self._default_config.copy() self.report_channel = report_channel # Set default config maxChannel to max value on channel bus if hasattr(self.bus, 'channel'): self.config['maxChannel'] = (2**len(self.bus.channel)) - 1 else: if report_channel: raise ValueError( "Channel reporting asked on bus without channel signal") for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s", configoption, str(value)) num_data_symbols = (len(self.bus.data) / self.config["dataBitsPerSymbol"]) if (num_data_symbols > 1 and not hasattr(self.bus, 'empty')): raise AttributeError( "%s has %i data symbols, but contains no object named empty" % (self.name, num_data_symbols)) self.config["useEmpty"] = (num_data_symbols > 1) if hasattr(self.bus, 'channel'): if len(self.bus.channel) > 128: raise AttributeError( "AvalonST interface specification defines channel width as 1-128. " "%d channel width is %d" % (self.name, len(self.bus.channel))) maxChannel = (2**len(self.bus.channel)) - 1 if self.config['maxChannel'] > maxChannel: raise AttributeError( "%s has maxChannel=%d, but can only support a maximum channel of " "(2**channel_width)-1=%d, channel_width=%d" % (self.name, self.config['maxChannel'], maxChannel, len(self.bus.channel)))
def __init__(self, wrrddriver, waitstartcycles=0, *args, **kwargs): ''' Takes a WrRdDriver as an inputer so that its read method can be utilized. waitstartcycles can be used to have the monitor wait the specified amount of the clock cycles before it starts blocking on reset. ''' self.__driver = wrrddriver self.__waitstartcycles = waitstartcycles BusMonitor.__init__(self, entity=wrrddriver.entity, clock=wrrddriver.clock, name="", bus_separator="", *args, **kwargs)
def __init__(self, entity, scoreboard): # declare signals to be monitored self._signals = [ "awvalid", "awaddr", "awready", "wvalid", "wready", "wdata", "wstrb", "bvalid", "bready", "bresp", "arvalid", "araddr", "arready", "rvalid", "rready", "rresp", "rdata", "stor0_a", "stor1_a", "stor2_a" ] BusMonitor.__init__(self, entity, "", entity.aclk, reset_n=entity.areset_n) self._expected = None self._log = logging.getLogger(scoreboard.log.name + '.' + self.name) self._scoreboard = scoreboard scoreboard.add_interface(self, [], compare_fn=self.compare)
def __init__(self, entity, name, clock, pkg=False, signals=None, bus_width=32, **kwargs): # has the signals been explicitely defined? if signals: self._signals = signals else: # a SystemVerilog package is used if pkg: self._signals = {} for signal_name in [ 'psel', 'pwrite', 'penable', 'paddr', 'pwdata', 'pstrb' ]: self._signals[ signal_name.upper()] = name + '_h2d_i.' + signal_name for signal_name in ['prdata', 'pready', 'pslverr']: self._signals[ signal_name.upper()] = name + '_d2h_o.' + signal_name name = None # just use the default APB names else: self._signals = [ "PSEL", "PWRITE", "PENABLE", "PADDR", "PWDATA", "PRDATA", "PREADY" ] self._optional_signals = ["PSLVERR", "PSTRB"] BusMonitor.__init__(self, entity, name, clock, **kwargs) self.clock = clock self.bus_width = bus_width # prime the monitor to begin self.reset()
def __init__(self, *args, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, *args, **kwargs) self.config = self._default_config.copy() for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s" % (configoption, str(value))) num_data_symbols = (len(self.bus.data) / self.config["dataBitsPerSymbol"]) if (num_data_symbols > 1 and not hasattr(self.bus, 'empty')): raise AttributeError( "%s has %i data symbols, but contains no object named empty" % (self.name, num_data_symbols)) self.config["useEmpty"] = (num_data_symbols > 1)
def __init__(self, *args, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, *args, **kwargs) self.config = self._default_config.copy() # Set default config maxChannel to max value on channel bus if hasattr(self.bus, 'channel'): self.config['maxChannel'] = (2**len(self.bus.channel)) - 1 for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s", configoption, str(value)) num_data_symbols = (len(self.bus.data) / self.config["dataBitsPerSymbol"]) if (num_data_symbols > 1 and not hasattr(self.bus, 'empty')): raise AttributeError( "%s has %i data symbols, but contains no object named empty" % (self.name, num_data_symbols)) self.config["useEmpty"] = (num_data_symbols > 1) if hasattr(self.bus, 'channel'): if "channel" in self._optional_signals: self.log.warning( "Channel is not fully implemented in this monitor. Recommend use of AvalonSTPktsWithChannel." ) if len(self.bus.channel) > 128: raise AttributeError( "AvalonST interface specification defines channel width as 1-128. " "%d channel width is %d" % (self.name, len(self.bus.channel))) maxChannel = (2**len(self.bus.channel)) - 1 if self.config['maxChannel'] > maxChannel: raise AttributeError( "%s has maxChannel=%d, but can only support a maximum channel of " "(2**channel_width)-1=%d, channel_width=%d" % (self.name, self.config['maxChannel'], maxChannel, len(self.bus.channel)))
def __init__(self, entity, name, clock, baud_rate, trigger_transmit_state, reset=None, reset_n=None, callback=None, event=None, bus_seperator="_"): BusMonitor.__init__(self, entity, name, clock, reset, reset_n, callback, event, bus_seperator) self.tts = trigger_transmit_state self.last_transaction = None self.baud_count = 0 self.baud_rate = baud_rate self.transmitting = False self.bits = 0 self.start_data = 0
def __init__(self, *args, packets=False, aux_signals=False, data_type="buff", **kwargs): """Initialization of Axi4Stream Args: *args: passed directly to the BusMonitor parent constructor. packets (bool, optional): wait for a high TLAST to call _recv. Defaults to False (call _recv on every transfer). aux_signals (bool, optional): when true, return a dict for each AXI4-Stream transfer where the key is the name of the signal and the value is the value of it. When false, return an int for each transfer representing the value of the TDATA signal data_type (str, optional): select the data type passed to _recv, either "buff" (for binary buffers of bytes) or "integer". **kwargs: passed directly to the BusMonitor parent constructor. """ BusMonitor.__init__(self, *args, **kwargs) if packets and not hasattr(self.bus, "TLAST"): raise AttributeError("\'packets=True\', but \'TLAST\' is missing " "on this bus") if data_type not in ("buff", "integer"): raise AttributeError("data_type must be either \"buff\" or " "\"integer\"") self.packets = packets self.aux_signals = aux_signals self.data_type = data_type self.bus_optional_signals = \ tuple(signal for signal in Axi4Stream._optional_data_signals if hasattr(self.bus, signal) and (signal != "TLAST" or not packets))
def __init__(self, *args, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, *args, **kwargs) self.config = self._default_config.copy() self.config.update(BusMonitor._default_config) # Set default config maxChannel to max value on channel bus if hasattr(self.bus, 'channel'): self.config['maxChannel'] = (2 ** len(self.bus.channel)) -1 for configoption, value in config.items(): self.config[configoption] = value self.log.debug("Setting config option %s to %s" % (configoption, str(value))) num_data_symbols = (len(self.bus.data) / self.config["dataBitsPerSymbol"]) if (num_data_symbols > 1 and not hasattr(self.bus, 'empty')): raise AttributeError( "%s has %i data symbols, but contains no object named empty" % (self.name, num_data_symbols)) self.config["useEmpty"] = (num_data_symbols > 1) if hasattr(self.bus, 'channel'): if "channel" in self._optional_signals: self.log.warning("Channel is not fully implemented in this monitor. Recommend use of AvalonSTPktsWithChannel.") if len(self.bus.channel) > 128: raise AttributeError( "AvalonST interface specification defines channel width as 1-128. %d channel width is %d" % (self.name, len(self.bus.channel)) ) maxChannel = (2 ** len(self.bus.channel)) -1 if self.config['maxChannel'] > maxChannel: raise AttributeError( "%s has maxChannel=%d, but can only support a maximum channel of (2**channel_width)-1=%d, channel_width=%d" % (self.name,self.config['maxChannel'],maxChannel,len(self.bus.channel)))
def __init__(self, *args, packets=False, aux_signals=False, **kwargs): """Initialization of Axi4Stream Args: *args: passed directly to the BusMonitor parent constructor. packets (bool, optional): wait for a high TLAST to call _recv. Defaults to False (call _recv on every transaction). aux_signals (bool, optional): return an Axi4StreamTransfer named tuple containing all the data signals, instead of just TDATA. Defaults to False. **kwargs: passed directly to the BusMonitor parent constructor. """ BusMonitor.__init__(self, *args, **kwargs) if packets and not hasattr(self.bus, "TLAST"): raise AttributeError("\'packets=True\', but \'TLAST\' is missing " "on this bus") self.packets = packets self.aux_signals = aux_signals self.bus_optional_signals = \ tuple(signal for signal in Axi4Stream._optional_data_signals if hasattr(self.bus, signal))
def __init__(self, entity, name, clock, **kwargs): config = kwargs.pop('config', {}) BusMonitor.__init__(self, entity, name, clock, **kwargs)
def __init__(self, entity, name, clock, data_name, collector, **kwargs): BusMonitor.__init__(self, entity, name, clock, **kwargs) HasBusValue.__init__(self, entity, data_name) self.collector = collector
def __init__(self, entity, name, clock, **kwargs): BusMonitor.__init__(self, entity, name, clock, **kwargs) self.log.info("Driver start initialization: %s", name)
def __init__(self, *args, **kwargs): BusMonitor.__init__(self, *args, **kwargs)
def __init__(self, entity, name, clock, bank=0, **kwargs): BusMonitor.__init__(self, entity, name, clock, **kwargs) self.bank = bank self.add_callback(self._get_result) self.expected = []
def __init__(self, entity, name, clock): BusMonitor.__init__(self, entity, name, clock) self.clock = clock