Quartus® Prime Pro Edition User Guide: Scripting

ID 683432
Date 7/08/2024
Public
Document Table of Contents

1.7.7. Fit a Design Using Multiple Seeds

This shell script example assumes that the Quartus® Prime software tutorial project called fir_filter exists in the current directory (defined in the file fir_filter.qpf). If the tutorial files are installed on your system, this project exists in the < Quartus® Prime directory>/qdesigns<quartus_version_number> /fir_filter directory.

Because the top-level entity in the project does not have the same name as the project, you must specify the revision name for the top-level entity with the --rev option. The --seed option specifies the seeds to use for fitting.

A seed is a parameter that affects the random initial placement of the Quartus® Prime Fitter. Varying the seed can result in better performance for some designs.

After each fitting attempt, the script creates new directories for the results of each fitting attempt and copies the complete project to the new directory so that the results are available for viewing and debugging after the script has completed.

#!/bin/sh
ERROR_SEEDS=""
quartus_syn fir_filter --rev=filtref
# Iterate over a number of seeds
for seed in 1 2 3 4 5
do
echo "Starting fit with seed=$seed"
# Perform a fitting attempt with the specified seed
quartus_fit fir_filter --seed=$seed --rev=filtref
# If the exit-code is non-zero, the fitting attempt was
# successful, so copy the project to a new directory
if [ $? -eq 0 ]
then
		   mkdir ../fir_filter-seed_$seed
		   mkdir ../fir_filter-seed_$seed/db
		   cp * ../fir_filter-seed_$seed
		   cp db/* ../fir_filter-seed_$seed/db
else
		   ERROR_SEEDS="$ERROR_SEEDS $seed"
fi
done
if [ -z "$ERROR_SEEDS" ]
then
echo "Seed sweeping was successful"
exit 0
else
echo "There were errors with the following seed(s)"
echo $ERROR_SEEDS
exit 1
fi
Tip: Use Design Space Explorer II (DSE) included with the Quartus® Prime software script (by typing quartus_dse at a command prompt) to improve design performance by performing automated seed sweeping.