def get_system_information(self, filename=None, fpg_info=None): """ Get information about the design running on the FPGA. If filename is given, get it from there, otherwise query the host via KATCP. :param filename: fpg filename :param fpg_info: a tuple containing device_info and coreinfo dictionaries :return: <nothing> the information is populated in the class """ if (filename is None) and (fpg_info is None): raise RuntimeError('Either filename or parsed fpg data must be given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = fpg_info[0] memorymap_dict = fpg_info[1] # add system registers device_dict.update(self.__add_sys_registers()) # reset current devices and create new ones from the new design information self.__reset_device_info() self.__create_memory_devices(device_dict, memorymap_dict) self.__create_other_devices(device_dict) # populate some system information try: self.system_info.update(device_dict['77777']) except KeyError: LOGGER.warn('%s: no sys info key in design info!' % self.host) # and RCS information if included if '77777_git' in device_dict: self.rcs_info['git'] = device_dict['77777_git'] if '77777_svn' in device_dict: self.rcs_info['svn'] = device_dict['77777_svn']
def get_system_information(self, filename=None, fpg_info=None): """ Get information about the design running on the FPGA. If filename is given, get it from file, otherwise query the host via KATCP. :param filename: fpg filename :param fpg_info: a tuple containing device_info and coreinfo dictionaries :return: <nothing> the information is populated in the class """ # try and get the info from the running host first if self.transport.is_running(): if (filename is not None) or (fpg_info is not None): LOGGER.info('get_system_information: device running, ' 'so overriding arguments.') try: filename, fpg_info = \ self.transport.get_system_information_from_transport() except NotImplementedError: LOGGER.info( 'no get_system_information_from_transport available') # otherwise look at the arguments given if (filename is None) and (fpg_info is None): raise RuntimeError('Either filename or parsed fpg data ' 'must be given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = fpg_info[0] memorymap_dict = fpg_info[1] # add system registers device_dict.update(self._add_sys_registers()) # reset current devices and create new ones from the new # design information self._reset_device_info() self._create_memory_devices(device_dict, memorymap_dict) self._create_other_devices(device_dict) # populate some system information try: self.system_info.update(device_dict['77777']) except KeyError: LOGGER.warn('%s: no sys info key in design info!' % self.host) # and RCS information if included for device_name in device_dict: if device_name.startswith('77777_git_'): name = device_name[device_name.find('_', 10) + 1:] if 'git' not in self.rcs_info: self.rcs_info['git'] = {} self.rcs_info['git'][name] = device_dict[device_name] if '77777_svn' in device_dict: self.rcs_info['svn'] = device_dict['77777_svn'] self.transport.memory_devices = self.memory_devices self.transport.gbes = self.gbes self.transport.post_get_system_information()
def get_system_information(self, filename=None, fpg_info=None): """ Get information about the design running on the FPGA. If filename is given, get it from there, otherwise query the host via KATCP. :param filename: fpg filename :return: <nothing> the information is populated in the class """ if (not self.is_running()) and (filename is None): raise RuntimeError('This can only be run on a running device when no file is given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = self._read_design_info_from_host() memorymap_dict = self._read_coreinfo_from_host() super(KatcpFpga, self).get_system_information(fpg_info=(device_dict, memorymap_dict))
def get_system_information(self, filename=None, fpg_info=None, **kwargs): """ Get information about the design running on the FPGA. If filename is given, get it from file, otherwise query the host via KATCP. :param filename: fpg filename :param fpg_info: a tuple containing device_info and coreinfo dictionaries :return: <nothing> the information is populated in the class """ t_filename, t_fpg_info = \ self.transport.get_system_information_from_transport() filename = filename or t_filename fpg_info = fpg_info or t_fpg_info if (filename is None) and (fpg_info is None): raise RuntimeError('Either filename or parsed fpg data ' 'must be given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = fpg_info[0] memorymap_dict = fpg_info[1] # add system registers device_dict.update(self._add_sys_registers()) # reset current devices and create new ones from the new # design information self._reset_device_info() # populate some system information try: self.system_info.update(device_dict['77777']) except KeyError: self.logger.warn('No sys info key in design info!') # and RCS information if included for device_name in device_dict: if device_name.startswith('77777_git'): name = device_name[device_name.find('_', 10) + 1:] if 'git' not in self.rcs_info: self.rcs_info['git'] = {} self.rcs_info['git'][name] = device_dict[device_name] if '77777_svn' in device_dict: self.rcs_info['svn'] = device_dict['77777_svn'] #Determine if the new or old register map is used new_reg_map_mac_word1_hex = self.transport.read_wishbone(0x54000 + 0x03 * 4) old_reg_map_mac_word1_hex = self.transport.read_wishbone(0x54000 + 0x00 * 4) if(new_reg_map_mac_word1_hex == 0x650): #self.logger.debug('Using new 40GbE core register map') legacy_reg_map = False elif(old_reg_map_mac_word1_hex == 0x650): #self.logger.debug('Using old 40GbE core register map') legacy_reg_map = True else: self.logger.error('Unknown 40GbE core register map') raise Exception('Unknown register map') #Create Register Map self._create_memory_devices(device_dict, memorymap_dict, legacy_reg_map=legacy_reg_map) self._create_other_devices(device_dict) self.transport.memory_devices = self.memory_devices self.transport.post_get_system_information()
def get_system_information(self, filename=None, fpg_info=None, initialise_objects=False, **kwargs): """ Get information about the design running on the FPGA. If filename is given, get it from file, otherwise query the host via KATCP. :param filename: fpg filename :param fpg_info: a tuple containing device_info and coreinfo dictionaries :param initialise_objects: Flag included in the event some child objects can be initialised upon creation/startup of the SKARAB with the new firmware - e.g. The SKARAB ADC's PLL SYNC :return: <nothing> the information is populated in the class """ t_filename, t_fpg_info = \ self.transport.get_system_information_from_transport() filename = filename or t_filename fpg_info = fpg_info or t_fpg_info if (filename is None) and (fpg_info is None): raise RuntimeError('Either filename or parsed fpg data ' 'must be given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = fpg_info[0] memorymap_dict = fpg_info[1] # add system registers device_dict.update(self._add_sys_registers()) # reset current devices and create new ones from the new # design information self._reset_device_info() # populate some system information try: self.system_info.update(device_dict['77777']) except KeyError: self.logger.warn('No sys info key in design info!') # and RCS information if included for device_name in device_dict: if device_name.startswith('77777_git'): if 'git' not in self.rcs_info: self.rcs_info['git'] = {} self.rcs_info['git'].update(device_dict[device_name]) if device_name.startswith('77777_svn'): if 'svn' not in self.rcs_info: self.rcs_info['svn'] = {} self.rcs_info['svn'].update(device_dict[device_name]) try: self.rcs_info['git'].pop('tag') except: pass # Create Register Map self._create_memory_devices(device_dict, memorymap_dict, initialise=initialise_objects) self._create_other_devices(device_dict, initialise=initialise_objects) self._create_casper_adc_devices(device_dict, initialise=initialise_objects) self.transport.memory_devices = self.memory_devices self.transport.post_get_system_information()
def get_system_information(self, filename=None, fpg_info=None, initialise_objects=False, **kwargs): """ Get information about the design running on the FPGA. If filename is given, get it from file, otherwise query the host via KATCP. :param filename: fpg filename :param fpg_info: a tuple containing device_info and coreinfo dictionaries :param initialise_objects: Flag included in the event some child objects can be initialised upon creation/startup of the SKARAB with the new firmware - e.g. The SKARAB ADC's PLL SYNC :return: <nothing> the information is populated in the class """ t_filename, t_fpg_info = \ self.transport.get_system_information_from_transport() filename = filename or t_filename fpg_info = fpg_info or t_fpg_info if (filename is None) and (fpg_info is None): raise RuntimeError('Either filename or parsed fpg data ' 'must be given.') if filename is not None: device_dict, memorymap_dict = parse_fpg(filename) else: device_dict = fpg_info[0] memorymap_dict = fpg_info[1] # add system registers device_dict.update(self._add_sys_registers()) # reset current devices and create new ones from the new # design information self._reset_device_info() # populate some system information try: self.system_info.update(device_dict['77777']) except KeyError: self.logger.warn('No sys info key in design info!') # and RCS information if included for device_name in device_dict: if device_name.startswith('77777_git'): name = device_name[device_name.find('_', 10) + 1:] if 'git' not in self.rcs_info: self.rcs_info['git'] = {} self.rcs_info['git'][name] = device_dict[device_name] if '77777_svn' in device_dict: self.rcs_info['svn'] = device_dict['77777_svn'] legacy_reg_map = False if type(self.transport) is SkarabTransport: # Determine if the new or old register map is used new_reg_map_mac_word1_hex = self.transport.read_wishbone(0x54000 + 0x03 * 4) old_reg_map_mac_word1_hex = self.transport.read_wishbone(0x54000 + 0x00 * 4) if(new_reg_map_mac_word1_hex == 0x650): self.logger.debug('Using new 40GbE core register map') legacy_reg_map = False elif(old_reg_map_mac_word1_hex == 0x650): self.logger.debug('Using old 40GbE core register map') legacy_reg_map = True else: self.logger.error('Unknown 40GbE core register map') raise ValueError('Unknown register map') # Create Register Map self._create_memory_devices(device_dict, memorymap_dict, legacy_reg_map=legacy_reg_map, initialise=initialise_objects) self._create_casper_adc_devices(device_dict, initialise=initialise_objects) self._create_other_devices(device_dict, initialise=initialise_objects) self.transport.memory_devices = self.memory_devices self.transport.post_get_system_information()