def generate_registers(self, regs, outpath):
    try:
        regs = transforms['remove_reserved_0'].transform(regs)
        regs = transforms['remove_reserved_1'].transform(regs)
        regs = transforms['remove_reserved_sign_extended'].transform(regs)
        regs = transforms['remove_implementation_defined'].transform(regs)
        regs = transforms['special_to_underscore'].transform(regs)
        regs = transforms['insert_valid_first_character'].transform(regs)
        regs = transforms['remove_redundant_am'].transform(regs)
        regs = transforms['remove_redundant_fields'].transform(regs)
        regs = transforms['unique_fieldset_names'].transform(regs)
        regs = filters['no_access_mechanism'].filter_exclusive(regs)
        regs = filters['irregular_size'].filter_exclusive(regs)
        logger.info(('Generating Rust register accessors to: ' + str(outpath)))
        for reg in regs:
            outfile_path = os.path.join(outpath, (reg.name.lower() + '.rs'))
            outfile_path = os.path.abspath(outfile_path)
            with open(outfile_path, 'w') as outfile:
                self._generate_register(outfile, reg)
        self.__update_module_files(outpath)
        self.__update_lib_file(outpath)
    except Exception as e:
        msg = '{g} failed to generate output {out}: {exception}'.format(g=str(type(self).__name__), out=outpath, exception=e)
        raise PalGeneratorException(msg)
def generate_registers(self, regs, outpath):
    try:
        regs = transforms['remove_reserved_0'].transform(regs)
        regs = transforms['remove_reserved_1'].transform(regs)
        regs = transforms['remove_reserved_sign_extended'].transform(regs)
        regs = transforms['remove_implementation_defined'].transform(regs)
        regs = transforms['special_to_underscore'].transform(regs)
        regs = transforms['insert_valid_first_character'].transform(regs)
        regs = transforms['remove_redundant_am'].transform(regs)
        regs = transforms['remove_redundant_fields'].transform(regs)
        regs = transforms['unique_fieldset_names'].transform(regs)
        regs = filters['no_access_mechanism'].filter_exclusive(regs)
        regs = filters['irregular_size'].filter_exclusive(regs)
        logger.info(('Generating Rust register accessors to: ' + str(outpath)))
        for reg in regs:
            outfile_path = os.path.join(outpath, (reg.name.lower() + '.rs'))
            outfile_path = os.path.abspath(outfile_path)
            with open(outfile_path, 'w') as outfile:
                self._generate_register(outfile, reg)
        self.__update_module_files(outpath)
        self.__update_lib_file(outpath)
    except Exception as e:
        msg = '{g} failed to generate output {out}: {exception}'.format(g=str(type(self).__name__), out=outpath, exception=e)
        raise PalGeneratorException(msg)