Intel® Quartus® Prime Standard Edition User Guide: Scripting

ID 683325
Date 9/24/2018
Public
Document Table of Contents

1.8.2. Check Design File Syntax

The UNIX shell script example below assumes the Intel® Quartus® Prime software fir_filter tutorial project exists in the current directory. You can find the fir_filter project in the < Intel® Quartus® Prime directory>/qdesigns/fir_filter directory unless the Intel® Quartus® Prime software tutorial files are not installed.

The script checks the exit code of the quartus_map executable to determine whether there is an error during the syntax check. Files with syntax errors are added to the FILES_WITH_ERRORS variable, and when all files are checked, the script prints a message indicating syntax errors.

When options are not specified, the executable uses the project database values. If not specified in the project database, the executable uses the Intel® Quartus® Prime software default values. For example, the fir_filter project is set to target the Cyclone® device family, so it is not necessary to specify the --family option.

#!/bin/sh
FILES_WITH_ERRORS=""
# Iterate over each file with a .bdf or .v extension
for filename in `ls *.bdf *.v`
do
# Perform a syntax check on the specified file
    quartus_map fir_filter --analyze_file=$filename
  # If the exit code is non-zero, the file has a syntax error
    if [ $? -ne 0 ]
    then
       FILES_WITH_ERRORS="$FILES_WITH_ERRORS $filename"
    fi
done
if [ -z "$FILES_WITH_ERRORS" ]
then
    echo "All files passed the syntax check"
    exit 0
else
    echo "There were syntax errors in the following file(s)"
    echo $FILES_WITH_ERRORS
    exit 1
fi