a defined built-in method for parameters?

M

mag

Guest
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.
 
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 ??
 
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.
 
On 2010-10-28 08:07:21 -0700, mag said:

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...
 

Welcome to EDABoard.com

Sponsor

Back
Top