def __write_asterics_core__(
     self,
     path: str,
     use_symlinks: bool = True,
     allow_deletion: bool = False,
     module_driver_dirs: bool = False,
 ) -> bool:
     path = self.__check_and_get_output_path__(path)
     if not path:
         return False
     try:
         as_build.prepare_output_path(None, path, allow_deletion)
     except IOError as err:
         LOG.error(
             ("Could not prepare the output directory '%s'" "! - '%s'"),
             path,
             str(err),
         )
         return False
     try:
         self.__write_hw__(
             append_to_path(path, "hardware"), use_symlinks, allow_deletion
         )
         self.__write_sw__(
             append_to_path(path, "software"),
             use_symlinks,
             allow_deletion,
             module_driver_dirs,
         )
     except (IOError, AsError) as err:
         LOG.error(str(err))
         return False
     return True
 def __write_sw__(
     self,
     path: str,
     use_symlinks: bool = True,
     allow_deletion: bool = False,
     module_driver_dirs: bool = False,
 ):
     # Make sure path is good
     path = self.__check_and_get_output_path__(path)
     if not path:
         return False
     path = append_to_path(path, "/")
     # Clean up if not empty
     try:
         as_build.prepare_output_path(None, path, allow_deletion)
     except IOError as err:
         LOG.error(
             ("Could not prepare the output directory '%s'" "! - '%s'"),
             path,
             str(err),
         )
         return False
     # Generate and collect software files
     try:
         self.__gen_sw__(path, use_symlinks, module_driver_dirs)
     except (IOError, AsError) as err:
         LOG.error(str(err))
         return False
     return True
 def __write_hw__(
     self, path: str, use_symlinks: bool = True, allow_deletion: bool = False
 ):
     # Make sure path is good
     opath = self.__check_and_get_output_path__(path)
     if not opath:
         raise AsFileError(path, "Could not create output folder!")
     opath = append_to_path(opath, "/")
     # Clean up if not empty
     try:
         as_build.prepare_output_path(None, opath, allow_deletion)
     except IOError as err:
         LOG.error(
             ("Could not prepare the output directory '%s'" "! - '%s'"),
             opath,
             str(err),
         )
         raise AsFileError(opath, "Could not write to output folder!")
     # Generate and collect hardware files
     try:
         self.__gen_hw__(opath, use_symlinks)
     except IOError:
         LOG.error(
             ("Cannot write to '%s'! - " "Could not create VHDL source files!"),
             opath,
         )
         return False
     except AsError as err:
         LOG.error(str(err))
         return False
    def __write_system__(
        self,
        path: str,
        use_symlinks: bool = True,
        allow_deletion: bool = False,
        module_driver_dirs: bool = False,
        add_vears: bool = False,
    ):
        # Make sure path is good
        path = self.__check_and_get_output_path__(path)
        ip_path = append_to_path(path, self.IP_CORE_REL_PATH)
        if not path:
            return False
        # Clean up if not empty
        try:
            src_path = append_to_path(self.asterics_dir, self.SYSTEM_TEMPLATE_PATH)
            as_build.prepare_output_path(src_path, path, allow_deletion)
        except IOError as err:
            LOG.error(
                ("Could not prepare the output directory '%s'" "! - '%s'"),
                path,
                str(err),
            )
            return False
        # Get paths for HW and SW gen
        sw_path = append_to_path(ip_path, self.DRIVERS_REL_PATH)
        hw_path = append_to_path(ip_path, self.HW_SRC_REL_PATH)
        # Generate and collect source files
        try:
            self.__gen_sw__(sw_path, use_symlinks, module_driver_dirs)
            self.__gen_hw__(hw_path, use_symlinks)
        except (IOError, AsError) as err:
            LOG.error(str(err))
            return False
        # Run packaging
        LOG.info("Running packaging in '%s'.", ip_path)

        add_c1 = self.TCL_ADDITIONS.format(
            design=self.design_name,
            part=self.partname_hw,
            board=self.board_target,
            display_name=self.ipcore_name,
            description=self.ipcore_descr,
        )
        as_build.run_vivado_packaging(self.current_chain, ip_path, add_c1)

        # Add VEARS core
        if add_vears:
            try:
                as_build.add_vears_core(
                    append_to_path(path, "vivado_cores"),
                    self.asterics_dir,
                    use_symlinks,
                )
            except (IOError, AsError) as err:
                LOG.error(str(err))
                return False
        return True
예제 #5
0
 def _write_ip_core_xilinx(
     self,
     path: str,
     use_symlinks: bool = True,
     allow_deletion: bool = False,
     module_driver_dirs: bool = False,
 ):
     err_mgr = self.current_chain.err_mgr
     # Make sure path is good
     path = self._check_and_get_output_path(path)
     if not path:
         return False
     # Clean up if not empty
     try:
         src_path = append_to_path(self.asterics_home,
                                   self.IP_CORE_TEMPLATE_PATH)
         as_build.prepare_output_path(src_path, path, allow_deletion)
     except IOError as err:
         LOG.error(
             ("Could not prepare the output directory '%s'"
              "! - '%s'"),
             path,
             str(err),
         )
         return False
     # Get paths for HW and SW gen
     sw_path = append_to_path(path, self.DRIVERS_REL_PATH)
     hw_path = append_to_path(path, self.HW_SRC_REL_PATH)
     # Generate and collect source files
     try:
         self._gen_sw(sw_path, use_symlinks, module_driver_dirs)
         if err_mgr.has_errors():
             LOG.critical("Abort! Errors occurred during system build:")
             err_mgr.print_errors()
             return False
         self._gen_hw(hw_path, use_symlinks)
         if err_mgr.has_errors():
             LOG.critical("Abort! Errors occurred during system build:")
             err_mgr.print_errors()
             return False
     except (IOError, AsError) as err:
         LOG.error(str(err))
         return False
     add_c1 = self.TCL_ADDITIONS.format(
         design=self.design_name,
         part=self.partname_hw,
         board=self.board_target,
         display_name=self.ipcore_name,
         description=self.ipcore_descr,
     )
     # Run packaging
     LOG.info("Running packaging in '%s'.", path)
     try:
         as_build.run_vivado_packaging(self.current_chain, path, add_c1)
     except (IOError, AsError) as err:
         LOG.error(str(err))
         return False
     return True
예제 #6
0
    def _write_asterics_core(
        self,
        path: str,
        use_symlinks: bool = True,
        allow_deletion: bool = False,
        module_driver_dirs: bool = False,
    ) -> bool:
        err_mgr = self.current_chain.err_mgr
        path = self._check_and_get_output_path(path)
        if not path:
            return False
        try:
            as_build.prepare_output_path(None, path, allow_deletion)
        except IOError as err:
            LOG.error(
                ("Could not prepare the output directory '%s'"
                 "! - '%s'"),
                path,
                str(err),
            )
            return False
        try:
            self._write_hw(append_to_path(path, "hardware"), use_symlinks,
                           allow_deletion)

            if err_mgr.has_errors():
                LOG.critical("Abort! Errors occurred during system build:")
                err_mgr.print_errors()
                return False
            self._write_sw(
                append_to_path(path, "software"),
                use_symlinks,
                allow_deletion,
                module_driver_dirs,
            )
            if err_mgr.has_errors():
                LOG.critical("Abort! Errors occurred during system build:")
                err_mgr.print_errors()
                return False
        except (IOError, AsError) as err:
            LOG.error(str(err))
            err_mgr.print_errors()
            return False
        return True