Forum Discussion

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

How to run TCl to do operation in Quartus II?

Recently, I am learning Tcl scripting language, try to program Tcl to operate the Quartus II. I watched the free training in Altera website, it shows many example codes but I still don't know where I can program in Quartus II?

Should I create a .tcl file inside Quatus II then write the codes in it? If like that, how can I run the program I wrote? Hope anyone who is familiar with it can help me.

Thanks very much!

8 Replies

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

    Hi,

    you can read the build in help in quartus

    1) by File menu > New... > Design Files > Tcl script

    or you can use a text editor

    2) To run your script, go to View menu > Utility windows > Tcl concole... then type source your_script.tcl if your_script.tcl is in the project directory (there are other command line... with "quartus_sh" for example)

    At doulos.com, there are also few well explained examples.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    To be honest, there are almost too many ways to do Tcl scripting with Quartus.

    You can do:

    quartus_sh -t <script>

    This runs outside of the project, so you need to open and close the project if you're making assignments to it. The nice thing with this is it allows you to control Quartus projects. For example, I made my own seed sweeper in this manner, before Design Space Explorer was around. There are other modules besides quartus_sh. There's quartus_cdb to run ECOs. quartus_sta can do timing analysis scripts.

    In Quartus you can go to Edit -> Tcl Console, and then source Tcl files from there.

    What is it you're trying to do?

    And don't forget the invaluable command for scripting:

    quartus_sh --qhelp
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Recently, I am learning Tcl scripting language, try to program Tcl to operate the Quartus II. I watched the free training in Altera website, it shows many example codes but I still don't know where I can program in Quartus II?

    Should I create a .tcl file inside Quatus II then write the codes in it? If like that, how can I run the program I wrote? Hope anyone who is familiar with it can help me.

    --- Quote End ---

    These threads have some basic examples:

    http://www.alteraforum.com/forum/showthread.php?t=35687

    http://www.alteraforum.com/forum/showthread.php?t=33462

    This thread has links to a more complex example:

    http://www.alteraforum.com/forum/showthread.php?t=35678

    as does this tutorial:

    http://www.alterawiki.com/wiki/using_the_usb-blaster_as_an_sopc/qsys_avalon-mm_master_tutorial

    Cheers,

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

    Thanks very much, mmTsuchi. I try the method you told, it works. I also found a "Tcl Scripts" option inside Tools option, what is usage of it?

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

    --- Quote Start ---

    To be honest, there are almost too many ways to do Tcl scripting with Quartus.

    You can do:

    quartus_sh -t <script>

    This runs outside of the project, so you need to open and close the project if you're making assignments to it. The nice thing with this is it allows you to control Quartus projects. For example, I made my own seed sweeper in this manner, before Design Space Explorer was around. There are other modules besides quartus_sh. There's quartus_cdb to run ECOs. quartus_sta can do timing analysis scripts.

    In Quartus you can go to Edit -> Tcl Console, and then source Tcl files from there.

    What is it you're trying to do?

    And don't forget the invaluable command for scripting:

    quartus_sh --qhelp

    --- Quote End ---

    Thanks for reply, Rysc. I am just starting try to learn write Tcl to operate Quartus. Like you

    mentioned:

    You can do:

    quartus_sh -t <script>

    And don't forget the invaluable command for scripting:

    quartus_sh --qhelp

    My question is where I can write these codes then how to run them? I think one option is you mentioned Tcl Console, right? Any other approach?

    Thanks very much.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi, Daves, thanks very much for reply. I checked the links you give. I think the basic process as following:

    1. Have the design project in Quartus II (e.g. program using HDL)

    2. Create a Tcl script file and program Tcl inside the file (e.g. set pins, compile the project, do static timing simulation)

    3. Run the tcl script file using Tcl console inside Quartus II.

    right? And for now, as my understanding, we use Tcl in Quartus is for operating Quartus (pin assignments, project compile, static timing analysis.....), not for design, right?

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

    --- Quote Start ---

    as my understanding, we use Tcl in Quartus is for operating Quartus (pin assignments, project compile, static timing analysis.....), not for design, right?

    --- Quote End ---

    That is correct.

    TCL = Tool Command Language

    Its a language for controlling (scripting) tools.

    You write your code in VHDL, you write timing constraints in Tcl (in an .sdc) file, you can manage the Quartus and Modelsim project build sequence using Tcl, and you can post-process timing analysis results using Tcl.

    Cheers,

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

    --- Quote Start ---

    That is correct.

    TCL = Tool Command Language

    Its a language for controlling (scripting) tools.

    You write your code in VHDL, you write timing constraints in Tcl (in an .sdc) file, you can manage the Quartus and Modelsim project build sequence using Tcl, and you can post-process timing analysis results using Tcl.

    Cheers,

    Dave

    --- Quote End ---

    Thanks very much, Dave!