EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

a defined built-in method for parameters?

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - Verilog Language - a defined built-in method for parameters?

mag
Guest

Fri Oct 22, 2010 7:31 pm   



I haven't found this from looking through the IEEE specs. Please
correct me if there is a way to do this in both synthesizable and non-
synthesizeable code. It would be nice if there was a build-in task or
method to check whether an identifier has been defined.

For example if I were trying to configure something via a generate
statement I could do this:

import my_parameter_package::*;

generate

if (HAS_ADDER.defined)
adder(...);

endgenerate

where the package my_parameter_package may sometimes have
parameter HAS_ADDER = 1
and sometime it does not.

Right now it seems I have to either have "parameter HAS_ADDER=1" or
"paramter HAS_ADDER=0" in my_parameter_package. Seems life would be
simpler if I could just omit the parameter if I don't intend to
positively define it.

d_s_klein
Guest

Wed Oct 27, 2010 11:39 pm   



On Oct 22, 9:31 am, mag <malexgr...@gmail.com> wrote:
Quote:
It would be nice if there was a build-in task or
method to check whether an identifier has been defined.



How about `ifdef ??

mag
Guest

Thu Oct 28, 2010 4:07 pm   



On 2010-10-27 13:39:56 -0700, d_s_klein said:

Quote:
On Oct 22, 9:31 am, mag <malexgr...@gmail.com> wrote:
It would be nice if there was a build-in task or
method to check whether an identifier has been defined.



How about `ifdef ??

`ifdef is problematic. `define macros have global scope and are thus
suscetible to being redefined accidentially. I know there are work
arounds, but they are ineligent hacks (IMHO) that easily can break.

mag
Guest

Thu Oct 28, 2010 4:09 pm   



On 2010-10-28 08:07:21 -0700, mag said:

Quote:
On 2010-10-27 13:39:56 -0700, d_s_klein said:

On Oct 22, 9:31 am, mag <malexgr...@gmail.com> wrote:
It would be nice if there was a build-in task or
method to check whether an identifier has been defined.



How about `ifdef ??

`ifdef is problematic. `define macros have global scope and are thus
suscetible to being redefined accidentially. I know there are work
arounds, but they are ineligent hacks (IMHO) that easily can break.

....inelegant...

elektroda.net NewsGroups Forum Index - Verilog Language - a defined built-in method for parameters?

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony