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?
連結已複製
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;
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.
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;