sonar/api.py
def vivado(args):
        """
        Helper function to initialize Xilinx tools

        Args:
            args (object): Holds attributes
                path (str): Path to the Xilinx directory containing Vivado
        """
        xilinx_path = os.path.abspath(args.path)
        if not os.path.exists(xilinx_path):
            logger.error("Path does not exist: %s", xilinx_path)
            sys.exit(ReturnValue.SONAR_NONEXISTENT_PATH)

        vivado_path = os.path.join(xilinx_path, "Vivado")
        try:
            vivado_versions = os.listdir(vivado_path)
        except FileNotFoundError:
            logger.error("No 'Vivado/' directory found in %s", xilinx_path)
            sys.exit(ReturnValue.SONAR_INVALID_PATH)

        vivado_script = Constants.SONAR_SHELL_PATH.joinpath("setup_vivado.sh")
        for version in vivado_versions:
            if float(version) <= 2017.2:
                include_dir = os.path.join(
                    xilinx_path, f"Vivado_HLS/{version}/include"
                )
            else:
                include_dir = os.path.join(
                    xilinx_path, f"Vivado/{version}/include"
                )
            args = sonar.include.DotDict(
                {
                    "type": "vivado",
                    # "ID": f"vivado_{version}",
                    "cad": "vivado",
                    "sim": "vivado",
                    "hls": "vivado_hls",
                    "version": version,
                    "hls_include": include_dir,
                    "script": textwrap.dedent(
                        f"""\
                        source {vivado_script} {xilinx_path} {version}
                        export SONAR_CAD_TOOL=vivado
                        export SONAR_CAD_VERSION={version}
                        export SONAR_HLS_TOOL=vivado_hls
                        export SONAR_HLS_VERSION={version}
                        export SONAR_HLS_INCLUDE={include_dir}
                        """
                    ),
                }
            )
            Tool.add(args)
            args = sonar.include.DotDict(
                {
                    "sim": f"vivado:{version}",
                    "hls": f"vivado:{version}",
                    "cad": f"vivado:{version}",
                    "repo": None,
                    "board": None,
                    "name": f"vivado_{version}",
                }
            )
            Env.add(args)

        Helper function to initialize Xilinx tools

        Args:
            args (object): Holds attributes
                path (str): Path to the Xilinx directory containing Vivado
        
Helper function to initialize Xilinx tools
Helper function to initialize Xilinx tools
def vivado(args):
        xilinx_path = os.path.abspath(args.path)
        if not os.path.exists(xilinx_path):
            logger.error("Path does not exist: %s", xilinx_path)
            sys.exit(ReturnValue.SONAR_NONEXISTENT_PATH)
        vivado_path = os.path.join(xilinx_path, "Vivado")
        try:
            vivado_versions = os.listdir(vivado_path)
        except FileNotFoundError:
            logger.error("No 'Vivado/' directory found in %s", xilinx_path)
            sys.exit(ReturnValue.SONAR_INVALID_PATH)
        vivado_script = Constants.SONAR_SHELL_PATH.joinpath("setup_vivado.sh")
        for version in vivado_versions:
            if float(version) <= 2017.2:
                include_dir = os.path.join(
                    xilinx_path, f"Vivado_HLS/{version}/include"
                )
            else:
                include_dir = os.path.join(
                    xilinx_path, f"Vivado/{version}/include"
                )
            args = sonar.include.DotDict(
                {
                    "type": "vivado",
                    "cad": "vivado",
                    "sim": "vivado",
                    "hls": "vivado_hls",
                    "version": version,
                    "hls_include": include_dir,
                    "script": textwrap.dedent(
                        f"""\
                        source {vivado_script} {xilinx_path} {version}
                        export SONAR_CAD_TOOL=vivado
                        export SONAR_CAD_VERSION={version}
                        export SONAR_HLS_TOOL=vivado_hls
                        export SONAR_HLS_VERSION={version}
                        export SONAR_HLS_INCLUDE={include_dir}
                        """
                    ),
                }
            )
            Tool.add(args)
            args = sonar.include.DotDict(
                {
                    "sim": f"vivado:{version}",
                    "hls": f"vivado:{version}",
                    "cad": f"vivado:{version}",
                    "repo": None,
                    "board": None,
                    "name": f"vivado_{version}",
                }
            )
            Env.add(args)
def vivado ( args ) : xilinx_path = os . path . abspath ( args . path ) if not os . path . exists ( xilinx_path ) : logger . error ( "Path does not exist: %s" , xilinx_path ) sys . exit ( ReturnValue . SONAR_NONEXISTENT_PATH ) vivado_path = os . path . join ( xilinx_path , "Vivado" ) try : vivado_versions = os . listdir ( vivado_path ) except FileNotFoundError : logger . error ( "No 'Vivado/' directory found in %s" , xilinx_path ) sys . exit ( ReturnValue . SONAR_INVALID_PATH ) vivado_script = Constants . SONAR_SHELL_PATH . joinpath ( "setup_vivado.sh" ) for version in vivado_versions : if float ( version ) <= 2017.2 : include_dir = os . path . join ( xilinx_path , f"Vivado_HLS/{version}/include" ) else : include_dir = os . path . join ( xilinx_path , f"Vivado/{version}/include" ) args = sonar . include . DotDict ( { "type" : "vivado" , "cad" : "vivado" , "sim" : "vivado" , "hls" : "vivado_hls" , "version" : version , "hls_include" : include_dir , "script" : textwrap . dedent ( f"""\
                        source {vivado_script} {xilinx_path} {version}
                        export SONAR_CAD_TOOL=vivado
                        export SONAR_CAD_VERSION={version}
                        export SONAR_HLS_TOOL=vivado_hls
                        export SONAR_HLS_VERSION={version}
                        export SONAR_HLS_INCLUDE={include_dir}
                        """ ) , } ) Tool . add ( args ) args = sonar . include . DotDict ( { "sim" : f"vivado:{version}" , "hls" : f"vivado:{version}" , "cad" : f"vivado:{version}" , "repo" : None , "board" : None , "name" : f"vivado_{version}" , } ) Env . add ( args )
Helper function to initialize Xilinx tools
Helper function to initialize Xilinx tools
"""
        Helper function to initialize Xilinx tools

        Args:
            args (object): Holds attributes
                path (str): Path to the Xilinx directory containing Vivado
        """ # "ID": f"vivado_{version}",
args
Holds attributes
path (str): Path to the Xilinx directory containing Vivado
Holds attributes path ( str ) : Path to the Xilinx directory containing Vivado