Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - relational operators

 
Thread Tools Search this Thread
Old 09-11-2006, 11:14 PM   #1
Default relational operators


Hello All
I am using this statement in VHDL

if ( 0 <= (locklength-nlock) < 1 ) then
.....

and there is a compile error

ncvhdl_p: *E,SEQREL (../PLL_MN100.vhd,518|39): illegal sequence of
relational operators [7.1] [7.2.2].

Is there anything wrong in the above statement?

This works in Verilog.

Thanks
krithiga



krithiga81@yahoo.com
  Reply With Quote
Old 09-11-2006, 11:37 PM   #2
Andy
 
Posts: n/a
Default Re: relational operators

You cannot chain logical operators in vhdl.

In your exampe, 0 <= (locklength - nlock) returns boolean, which you
are then trying to compare to 1. Or, (locklength - nlock) < 1 returns
boolean, which you are then trying to compare to 0. Either way, it does
not work.

Andy


wrote:
> Hello All
> I am using this statement in VHDL
>
> if ( 0 <= (locklength-nlock) < 1 ) then
> ....
>
> and there is a compile error
>
> ncvhdl_p: *E,SEQREL (../PLL_MN100.vhd,518|39): illegal sequence of
> relational operators [7.1] [7.2.2].
>
> Is there anything wrong in the above statement?
>
> This works in Verilog.
>
> Thanks
> krithiga


  Reply With Quote
Old 09-11-2006, 11:54 PM   #3
Paul Uiterlinden
 
Posts: n/a
Default Re: relational operators

wrote:

> Hello All
> I am using this statement in VHDL
>
> if ( 0 <= (locklength-nlock) < 1 ) then
> ....
>
> and there is a compile error
>
> ncvhdl_p: *E,SEQREL (../PLL_MN100.vhd,518|39): illegal sequence of
> relational operators [7.1] [7.2.2].
>
> Is there anything wrong in the above statement?


Yes, it is not valid VHDL. Use this instead:

IF (0 <= (locklength-nlock)) AND ((locklength-nlock) < 1) THEN

--
Paul.
  Reply With Quote
Old 09-12-2006, 12:06 AM   #4
krithiga81@yahoo.com
 
Posts: n/a
Default Re: relational operators

Hi
Thanks. It does compile but gives

Error! simulated time overflow
File: ../PLL_MN100.vhd, line = 518, pos = 29
Scope: testbench.dut:$PROCESS_028
Time: 0 FS + 0

.../PLL_MN100.vhd:518 if ( 0 <= (locklength-nlock)) AND
((locklength-nlock) < 1 ) then

I have declared locklength and nlock as integer

Thanks
krithiga

Paul Uiterlinden wrote:
> wrote:
>
> > Hello All
> > I am using this statement in VHDL
> >
> > if ( 0 <= (locklength-nlock) < 1 ) then
> > ....
> >
> > and there is a compile error
> >
> > ncvhdl_p: *E,SEQREL (../PLL_MN100.vhd,518|39): illegal sequence of
> > relational operators [7.1] [7.2.2].
> >
> > Is there anything wrong in the above statement?

>
> Yes, it is not valid VHDL. Use this instead:
>
> IF (0 <= (locklength-nlock)) AND ((locklength-nlock) < 1) THEN
>
> --
> Paul.


  Reply With Quote
Old 09-12-2006, 08:53 AM   #5
Paul Uiterlinden
 
Posts: n/a
Default Re: relational operators

wrote:

> Hi
> Thanks. It does compile but gives
>
> Error! simulated time overflow
> File: ../PLL_MN100.vhd, line = 518, pos = 29
> Scope: testbench.dut:$PROCESS_028
> Time: 0 FS + 0
>
> ../PLL_MN100.vhd:518 if ( 0 <= (locklength-nlock)) AND
> ((locklength-nlock) < 1 ) then
>
> I have declared locklength and nlock as integer


Hmm, that's odd. Could be an error message that does not quite
indicate the correct position of the actual error.

Just guessing: perhaps you've used a variable of type time that should
have been initialized to 0 ns. In that case, use type delay_length in
stead of time. Initialization to 0 ns is then done automatically, as
the left bound of delay_length is 0 ns.

I would suggest to strip down the code to find out where the error
comes from.
--
Paul.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump