Forum Discussion
Altera_Forum
Honored Contributor
15 years agoi took a stab at creating an lpm_constant alternative. its just a couple lines of parametrized Verilog with a bsf symbol included. here's the readme.txt:
my_constant is an lpm_constant replacement to use my_constant, set the my_constant directory as a Global or Project Library path in Quartus II. to add the directory path, go to Assignments > Settings > Libraries and add the my_constant directory. you will also need to add my_constant.qip as a file in the project. in the Settings window, go to Files and add my_constant/my_constant.qip. my_constant is written with two user configurable parameters: WIDTH and VALUE. the bit width of the constant should be specified as WIDTH and the value of the constant should be set as VALUE. signed and unsigned values are supported. note that there is no type checking to see if WIDTH is valid for the specified VALUE. for example, if WIDTH is 8 and VALUE is 256 the constant will have a value of 8'b00000000 without any warning.