Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21608 Discussions

Tcl script does not run during compilation

Altera_Forum
Honored Contributor II
1,967 Views

The tcl script that supposed to update .v file runs fine if I run it from the tcl console but it does not run during compilation. 

Both .tcl and .v files are in the project files list. 

Any idea?
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
651 Views

To run a script during before compilation, you have to add it to your .qsf like so: 

set_global_assignment -name PRE_FLOW_SCRIPT_FILE quartus_sh:assign_pin.tcl 

 

Note that when the script runs, it does not act like Quartus is open. So you need to open and close the project. For example, if I had a project named gocubs and I wanted to create a pre-flow script called assign_pin.tcl that made a pin assignment, it would look like: 

 

project_open gocubs 

set_location_assignment PIN_M4 -to blaa 

project_close 

 

The big benefit is that it's true Tcl interpreter(unlike the .qsf reader) so you can script about whatever you want.
0 Kudos
Altera_Forum
Honored Contributor II
651 Views

 

--- Quote Start ---  

To run a script during before compilation, you have to add it to your .qsf like so: 

set_global_assignment -name PRE_FLOW_SCRIPT_FILE quartus_sh:assign_pin.tcl 

 

Note that when the script runs, it does not act like Quartus is open. So you need to open and close the project. For example, if I had a project named gocubs and I wanted to create a pre-flow script called assign_pin.tcl that made a pin assignment, it would look like: 

 

project_open gocubs 

set_location_assignment PIN_M4 -to blaa 

project_close 

 

The big benefit is that it's true Tcl interpreter(unlike the .qsf reader) so you can script about whatever you want. 

--- Quote End ---  

 

 

 

 

Thanks! 

I have already this line in my .qsf: 

set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:version_and_time.tcl". 

 

Do I have to add those lines to my .qsf? 

 

project_open <project_name> 

set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:version_and_time.tcl" 

project_close
0 Kudos
Altera_Forum
Honored Contributor II
651 Views

The "project_open...project_close" lines go in the .tcl script. When you press compile, you should see messages that it's running the pre-flow script. (If the script is just writing out an HDL file that has version and time, i.e. it's not doing anything to the project, then you don't need the project_open/project_close.  

 

http://www.alterawiki.com/wiki/tcl_scripts_for_automatic_build_identification
0 Kudos
Altera_Forum
Honored Contributor II
651 Views

 

--- Quote Start ---  

The "project_open...project_close" lines go in the .tcl script. When you press compile, you should see messages that it's running the pre-flow script. (If the script is just writing out an HDL file that has version and time, i.e. it's not doing anything to the project, then you don't need the project_open/project_close.  

 

http://www.alterawiki.com/wiki/tcl_scripts_for_automatic_build_identification 

--- Quote End ---  

 

 

Thanks for the sharing. The wiki link is useful.
0 Kudos
Altera_Forum
Honored Contributor II
651 Views

Great info sharing. Thanks.

0 Kudos
Reply