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

VHDL String Compare and FPGA Family Determination

Altera_Forum
Honored Contributor II
5,012 Views

Is there a VHDL string compare function included in the tool, and if so what library must be included? I'm trying to generate different code depending on which Altera FPGA I'm targeting. Perhaps also/instead there is a dedicated function for determining the current family by setting a variable in the code or project?

0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
3,829 Views

there is no way to use different libraries depending on any string. 

 

You can use generics to control the instatiation of different components depending on device family. 

 

There is no way of auto-collecting the device family. You have to set this yourself via a constant. You might be able to pick it up from Quartus via TCL and modify the constant/generic - but my TCL isnt very good. 

 

As for string compare, you can just use an equals (remember its case sensitive): 

 

cyclone_gen : if family = "CYCLONE" generate ... end generate cyclone_gen;
0 Kudos
Altera_Forum
Honored Contributor II
3,829 Views

Thank you, that is pretty much exactly what I was looking for. I was a bit confused because in our Xilinx projects here they seem to use some libary function equalsIgnoreCase and I didn't know if I would have to do the same. For me ignoring case isn't that important.

0 Kudos
Altera_Forum
Honored Contributor II
3,829 Views

that function will be to cancel out people putting in "CycloNE" or something as a generic. The function probably converts both strings to lower case then does an 

 

if string1 = string2 then return true;
0 Kudos
Reply