Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

QSF scripting

Hello,

I have multiple project for my FPGA, but I would like to keep only one qsf file for them + some define parameter to select what include files are specific to each project.

Basically I want to load my project as a script with common timing parameters and library files + project specific files.

Does anyone have some tips for me on this?

This will probably be done in the Tcl Console with something like:

load settings.tcl

load projectSpesificFiles.tcl

compile....

Any hits or examples?

Cheers

Stefan

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I'm a big fan of pre-flow scripts. Search on this forum, but they run automatically before the compile starts, even from the GUI.

    set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:io_assignments.tcl"

    You can just have a conditional in there that chooses which files to add. The syntax would be the same as the file being added in the .qsf. You may want to add a first step that removes all files. That can be wildcarded. I forget the exact syntax, but type:

    quartus_sh --qhelp

    Then search under the project library. I think it would be something like "remove_all_global_assignments -name VERILOG_FILE *" Just typing from memory, so need to fix.

    Note that if you use a pre-flow script, it will run from memory and from command line:

    quartus_sh --flow compile <project_name>

    But if your script is of the type:

    quartus_map

    quarts_fit

    etc.

    Then you need to add a first line:

    quartus_sh -t preflow_script.tcl

    Finally, you want to do:

    project_open <project_name>

    <contents to do what you want>

    export_assignments

    project_close

    (Sorry this is a little disorganized, but I think you get the gist.) These scripts can be really powerful, and I don't think Altera has enough examples. Heck, you could use Tk to bring up a GUI asking which build you're targeting, or something like that.

    The only danger is that pre-flow scripts and GUIs don't always place nice. Someone might add a verilog file manually to the project, but if your pre-flow script removes them all, they'll wonder why it keeps disappearing when they compile. It's stuff like that you need to be careful of.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thx for the replay, but I'm using Quartus in windows so command line is not that fantastic in the Command Promp :(

    Well I was wandering if I could to this by opening the Tcl Console in Quartus and source some tcl scripts similar to ModelSim. One to setup the device+ timing constrains and fiting, one to load common library files, one to load project specific files. then one to do the compilation...

    In a perfect world I would be on a Linux machine with a make flow... :P

    Cheer

    Stefan
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Nothing wrong with being on windows. I was just giving that info in case you ran from a make flow, since you want scripting. All of the above works fine in a batch file too.

    The pre-flow script works too, and works in the GUI. By being a pre-flow script, that .qsf assignment has it run automatically. If you want to manually run it from the Tcl console, it will work just as easily, you just have to manually do it every time.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    In a perfect world I would be on a Linux machine with a make flow... :P

    --- Quote End ---

    You can run nmake.exe in a Command Prompt window ;)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    humm, I will try it out the manual way and build it up from there. thx for the replays

    Cheers