Seed Sweeping

After you choose an appropriate optimization level (or the default), try running a seed sweep and taking the best of these runs to close timing. The annealer uses a random number generator that you can control using a seed parameter. Running a 10-seed sweep typically results in an fMAX variation of 10% to 20% in a well-behaved circuit, but can be higher for random differences that only occur in one seed. Keep these tips in mind:

  • Run a seed sweep every time you make a small change to the design.
  • No seed value is better than any other.
  • Different seed values may be best on different machines.

Example Usage

Sweep seeds using the default settings. In this mode, the script runs 10 different seeds with seed numbers 0 - 9. That is, it runs seed=0, seed=1, etc.

efx_run_pnr_sweep.py helloworld.xml sweep_seeds 
efx_run_pnr_sweep.bat helloworld.xml sweep_seeds

Compile 6 seeds with seed numbers 0 - 5:

efx_run_pnr_sweep.py helloworld.xml sweep_seeds --num_seeds 6
efx_run_pnr_sweep.bat helloworld.xml sweep_seeds --num_seeds 6

Compile with seed numbers 3, 4, and 5:

efx_run_pnr_sweep.py helloworld.xml sweep_seeds --start_seed 3 --end_seed 5
efx_run_pnr_sweep.bat helloworld.xml sweep_seeds --start_seed 3 --end_seed 5

Compile with 6 seeds, starting with seed number 3:

efx_run_pnr_sweep.py helloworld.xml sweep_seeds --start_seed 3 --num_seeds 6
efx_run_pnr_sweep.bat helloworld.xml sweep_seeds --start_seed 3 --num_seeds 6

Using the Results

When seed sweeping completes, open the timing.sum.rpt file in the project directory. It gives an overview of the clocks analyzed and their frequency for each seed. The following code shows and excerpt of the summary report for seed sweeping the pt_demo project with the default 10 seeds. The number after seed_ is the random seed number the compiler used.

|---------------------------------------------------------|
|       Maximum possible analyzed clocks frequency        |
|---------------------------------------------------------|
|                                                         |
|---------------------------------------------------------|
| Clock Name: Oclk                                        |
|---------------------------------------------------------|
|        |   Period (ns)    | Frequency (MHz)  |   Edge   |
|---------------------------------------------------------|
| seed_0 |      6.211       |     161.006      |  (R-R)   |
| seed_1 |      7.211       |     138.678      |  (R-R)   |
| seed_2 |      7.852       |     127.363      |  (R-R)   |
| seed_3 |      7.883       |     126.858      |  (R-R)   |
| seed_4 |      5.453       |     183.381      |  (R-R)   |
| seed_5 |      5.328       |     187.683      |  (R-R)   |
| seed_6 |      7.563       |     132.231      |  (R-R)   |
| seed_7 |      5.633       |     177.531      |  (R-R)   |
| seed_8 |      5.547       |     180.282      |  (R-R)   |
| seed_9 |      4.656       |     214.765      |  (R-R)   |
|---------------------------------------------------------|

You can also review detailed reports for each run in the run_sweep_<string>/seed_<number>/outflow directory.

If you are happy with the results for one of the seeds, you can set that option in your project. For example, to apply seed_9 to your project:

  1. Open the Project Editor.
  2. Click the Place and Route tab.
  3. Enter 9 in the Value cell.
  4. Click OK.
  5. Recompile.