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

Change VHDL generic via command line for synthesis

anonimcs
New Contributor III
1,415 Views

Hello everyone,

I have a project which consists of multiple IPs. I have a qsys file for each configuration of the IPs and I also have a top-level generic that allows me to not have a duplicate of VHDL code just for having different input bit widths. My question here is that I want to configure the generic via command line (or with some scripts) but I couldn't find a way to do so. The closest thing I could find is creating project revisions, but those are not fully flexible as we need to create all project-related files before running synthesis. I was wondering if anyone could configure their generics via command line without having to copy all the project files + the vhdl source code

Labels (1)
0 Kudos
1 Solution
ShengN_Intel
Employee
1,288 Views

Hi,


then how should I make the pin assignments for the pins not used when generic = 0 (they're only used when generic = 1). Is there a way to set them 'conditionally' in the qsf file ?

For above mentioned can't be achieved in .qsf, you may need to use .tcl script if/then/else already as mentioned. For example like below in .tcl:

set a [get_parameter -name C3_CNT]


if {$a == 1} {

    set disable 0

    set enable 1

} else {

  set enable 0

  set disable 1

}

if {$enable} {

set_location_assignment PIN_W28 -to outclk6 -disable -comment IOBANK_3C -remove

set_location_assignment PIN_W28 -to outclk6 -comment IOBANK_3C

export_assignments

}

if {$disable} {

set_location_assignment PIN_W28 -to outclk6 -disable -comment IOBANK_3C

export_assignments

}


Remember that if want to enable, make sure source the .tcl twice in order to remove the previous -disable assignment.


[Take Note This]: Critical Warning(19941): QSF command 'set_parameter' can only apply to the top-level design and cannot include '-to' or '-entity' arguments.

If you notice that 'set_parameter' doesn't take effect, remove the '-to' or '-entity' arguments because it can only apply to top-level design.


Thanks,

Best Regards,

Sheng



View solution in original post

0 Kudos
7 Replies
ShengN_Intel
Employee
1,389 Views

Hi


May use this set_parameter Tcl command https://www.intel.com/content/www/us/en/docs/programmable/683432/22-4/tcl_pkg_project_ui_ver_1-0_cmd_set_parameter.html on your top-level generic.


Thanks,

Best Regards,

Sheng

p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.


0 Kudos
anonimcs
New Contributor III
1,380 Views

Looks promising, which file should I add this command to ?

 

Cheers,

0 Kudos
ShengN_Intel
Employee
1,375 Views

Hi,

 

You can add this tcl command to a .tcl file. Then go to View -> Tcl Console, in the Tcl Console type source <file_name>.tcl. Besides, can go to Tools -> Tcl Scripts and then Select and Run.

Also, you can straightaway include that tcl command in the .qsf file.

 

Thanks,

Best Regards,

Sheng

 

0 Kudos
anonimcs
New Contributor III
1,342 Views

Hi,

Adding the tcl command directly to the qsf file is totally fine for me, but I have a follow-up question. As I mentioned, the entity's port widths are dependent on this generic, then how should I make the pin assignments for the pins not used when generic = 0 (they're only used when generic = 1). Is there a way to set them 'conditionally' in the qsf file ?

 

Cheers

0 Kudos
ShengN_Intel
Employee
1,365 Views

Hi,

 

Sorry for confusion. The package require ::quartus::project is not needed in the previous post community.intel.com/t5/Programmable-Devices/Change-VHDL-generic-via-command-line-for-synthesis/m-p/1534942#M93067 situation. It'll only be needed when you want to project_open and export_assignments the tcl assignment like the .tcl script attached below. Btw, you can generate the .tcl script attached below by going to Project -> Generate Tcl File for Project.

Forgot to mention that if you want to source the .tcl script in command prompt you can use this command quartus_sh -t

 

Thanks,

Best Regards,

sheng

 

0 Kudos
sstrell
Honored Contributor III
1,306 Views

It's just Tcl scripting, so you can use if/then/else.  Good Tcl reference:

https://tmml.sourceforge.net/doc/tcl/index.html

0 Kudos
ShengN_Intel
Employee
1,289 Views

Hi,


then how should I make the pin assignments for the pins not used when generic = 0 (they're only used when generic = 1). Is there a way to set them 'conditionally' in the qsf file ?

For above mentioned can't be achieved in .qsf, you may need to use .tcl script if/then/else already as mentioned. For example like below in .tcl:

set a [get_parameter -name C3_CNT]


if {$a == 1} {

    set disable 0

    set enable 1

} else {

  set enable 0

  set disable 1

}

if {$enable} {

set_location_assignment PIN_W28 -to outclk6 -disable -comment IOBANK_3C -remove

set_location_assignment PIN_W28 -to outclk6 -comment IOBANK_3C

export_assignments

}

if {$disable} {

set_location_assignment PIN_W28 -to outclk6 -disable -comment IOBANK_3C

export_assignments

}


Remember that if want to enable, make sure source the .tcl twice in order to remove the previous -disable assignment.


[Take Note This]: Critical Warning(19941): QSF command 'set_parameter' can only apply to the top-level design and cannot include '-to' or '-entity' arguments.

If you notice that 'set_parameter' doesn't take effect, remove the '-to' or '-entity' arguments because it can only apply to top-level design.


Thanks,

Best Regards,

Sheng



0 Kudos
Reply