Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21602 ディスカッション

VHDL String Compare and FPGA Family Determination

Altera_Forum
名誉コントリビューター II
5,016件の閲覧回数

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 件の賞賛
3 返答(返信)
Altera_Forum
名誉コントリビューター II
3,833件の閲覧回数

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;
Altera_Forum
名誉コントリビューター II
3,833件の閲覧回数

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.

Altera_Forum
名誉コントリビューター II
3,833件の閲覧回数

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;
返信