Forum Discussion

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

Using a tcl script to assign pins

Is it possible to use a tcl script file to make I/O pin assignments instead of using the Pin Planner?

I tried doing that with a script file such as the following:

package require ::quartus::project

set_location_assignment PIN_B13 -to mode

set_location_assignment PIN_L1 -to clk

# etc...

export_assignments

but that generated a lot of errors when my file was run from the Tcl Scripts dialog box.

5 Replies

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

    --- Quote Start ---

    Is it possible to use a tcl script file to make I/O pin assignments instead of using the Pin Planner?

    --- Quote End ---

    Yes. I've posted plenty of examples that contain scripts. This tutorial has the scripts for several boards:

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

    --- Quote Start ---

    I tried doing that with a script file such as the following:

    package require ::quartus::project

    set_location_assignment PIN_B13 -to mode

    set_location_assignment PIN_L1 -to clk

    # etc...

    export_assignments

    but that generated a lot of errors when my file was run from the Tcl Scripts dialog box.

    --- Quote End ---

    Open up a design that has pin assignments already implemented, and use "Project->Generate Tcl File For Project" to see the correct syntax.

    The syntax is a little verbose. In the scripts I create (key,value) pairs for pin assignments, and then loop over them and convert them to Altera synthesis directives. Its a little more complicated to understand the first time you read the script, however, creating the script is a lot easier for the next board.

    Read the scripts and ask questions.

    Cheers,

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

    I did generate the Tcl file for an implemented project and the statements in my example script are of the same form as in generated file, I just stripped out a lot of stuff that didn't appear to be necessary to just set the pin assignments. The implemented project was for a Max II whereas the current project is for a Cyclone II. I assumed the formats would be the same. Is that correct?

    It would take me quite a while to figure out the tcl syntax; a pity Quartus isn't using Python.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I just edit the .qsf manually. Actually I have a utility that extracts pin-names from a (Orcad or Altium) schematic netlist. I then copy/paste the prepared assignments. Unfortunately the schematic names are all upper-case, so i have some editing to do, but at least the locations are correct. Maybe one day I'll extend the utility to read the (VHDL) top design file(or possibly more appropriate report file).

    So if you are typing a .tcl to insert the locations you might as well just edit the .qsf. The rest of the work like IO standard etc. I do in the Pin Planner. Which I usually have done before to start off the design.

    To Gary: I wish they (the whole EDA) switched to Python, but I guess it won't happen soon :(
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    I did generate the Tcl file for an implemented project and the statements in my example script are of the same form as in generated file, I just stripped out a lot of stuff that didn't appear to be necessary to just set the pin assignments.

    --- Quote End ---

    I guess you cut out something that was necessary :)

    --- Quote Start ---

    The implemented project was for a Max II whereas the current project is for a Cyclone II. I assumed the formats would be the same. Is that correct?

    --- Quote End ---

    Pin assignments are the same.

    There are a few other settings that have slightly different names, I forget what they are, I usually just 'generate' a Tcl file for a project when I'm done, and check that I have all the non-default values copied into my custom Tcl scripts.

    Cheers,

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

    Is it possible to get a copy of the pin extraction utility you're using josyb?