On 25 Mar 2006 16:44:53 -0800, "kb33" <
[email protected]>
wrote:
>Hi,
>
>I want to do something like
>
>`define RANGE1 >1 && < 4
>
>(meaning that if a value is greater than 1 and less than 4, it would
>belong to RANGE1. )
Unfortunately this is not possible as the logic necessary to say what
you want reads as:
x > 1 && x < 4
where x is the variable you want to check against the range. What you
can do is to define a rangelow and rangehigh and use them in your code
to read:
`define rangelow 1
`define rangehigh 4
x > `rangelow && x < `rangehigh
Another solution is to use a function
function isinRange1;
input [...] x;
return x > `rangelow && x < `rangehigh;
endfunction
Then you can say
if (isinRange1(x))
etc.
Hth.