Many times FPGA developers have needs to switch between different versions of a tool set running on the same machine. Having multiple versions of the same tool(s) installed on a given machine (in this case running Windows) is a perfectly accepted methodology. Here we show how to switch between Altera’s Quartus II version 13.1 and 14.1 from a Windows batch (.bat) script. The script sets all the required Windows environment variables required for each version being initialized.
Altera_Tool_Switch.bat:
@echo off
REM ========================================================================
REM Name: Altera_Tool_Switch.bat
REM Tool: Version switching batch script for Altera's IP, Nios II EDS, and Quartus II
REM Default install path settings (change to match your installation paths for each version).
REM Execute from a DOS command shell.
REM Some users have benefited from additionally moving C:\Quartus\bin and Quartus\win to the front of the PATH env var.
set Altera_13_1=D:\altera\13.1
set Nios_13_1=D:\altera\13.1\nios2eds
set Quartus_13_1=D:\altera\13.1\quartus
set IP_13_1=D:\altera\13.1\ip\altera
set Altera_14_1=D:\altera\14.1
set Nios_14_1=D:\altera\14.1\nios2eds
set Quartus_14_1=D:\altera\14.1\quartus
set IP_14_1=D:\altera\14.1\ip\altera
REM ========================================================================
REM Use the first parameter as the specified version if available.
REM This will skip menu echo below if there exists a first parameter.
set ALT_VER=%1
REM ========================================================================
:ALT_VER_OPTIONS
if not defined ALT_VER (
echo ****************************************************************
echo * Altera Environment Switcher
echo ****************************************************************
echo * Choose an Altera version to update your environment variables.
echo *
echo * Note: Before making a selection, close any open Altera tools.
echo * After running this script, exit the shell from which it
echo * was launched. Only new environments will inherit the
echo * new system environment settings.
echo *
echo * Note: Some of these versions may not exist yet, or the paths
echo * may not match your installation. If you install to
echo * non-standard locations, modify the paths at the top of
echo * this batch file for each non-standard install path per
echo * version.
echo *
echo * For example, to modify the installation path information
echo * for version 13.1, update 3 variables in this batch file:
echo * Nios_13_1, Quartus_13_1, and IP_13_1.
echo *
echo * 1. Version 13.1
echo * 2. Version 14.1
echo * 3. Do not make any changes
echo *
echo * Choose a number to select a version [1, 2, or 3]
set /p ALT_VER=%1
)
if not defined ALT_VER (
echo Valid Altera Tools Version not specified.
goto ALT_VER_OPTIONS
)
REM ========================================================================
REM Set Nios II 13.1
REM
if %ALT_VER% == 1 (
echo Setting environment for version 13.1
setx ALTERA %Altera_13_1%
setx QUARTUS_ROOTDIR %Quartus_13_1%
setx SOPC_BUILDER_PATH %Nios_13_1%;%IP_13_1%
setx SOPC_KIT_NIOS2 %Nios_13_1%
setx IP_ROOTDIR D:/altera/13.1/ip
goto END
)
REM ========================================================================
REM Set Nios II 14.1
REM
if %ALT_VER% == 2 (
echo Setting environment for version 14.1
setx ALTERA %Altera_14_1%
setx QUARTUS_ROOTDIR %Quartus_14_1%
setx SOPC_BUILDER_PATH %Nios_14_1%;%IP_14_1%
setx SOPC_KIT_NIOS2 %Nios_14_1%
setx IP_ROOTDIR D:/altera/14.1/ip
goto END
)
REM ========================================================================
REM Do not make any changes
REM
if %ALT_VER% == 3 (
echo Exiting script with no changes.
goto END
)
REM ========================================================================
REM ALT_VER is not recognized
set ALT_VER=
echo Valid Altera Tools Version not specified.
goto ALT_VER_OPTIONS
REM ========================================================================
:END