Subject: Re: Using iff example
From: Peter Flake (flake@co-design.com)
Date: Tue Dec 11 2001 - 05:15:54 PST
Hi Stu,
Your examples are good.
At 08:46 PM 12/10/01 -0800, Stuart Sutherland wrote:
>Peter,
>
>If I understood our conversation today correctly, the following two
>examples are a more correct way to use 'iff':
>
>always @(posedge clock iff load == 1) //synchronous reset
> if (!reset) count <= 0;
> else if (load) count <= d; //gated input
> else count <= count + 1;
>
>always @(posedge clock iff load == 1 or negedge reset) //asynchronous reset
> if (!reset) count <= 0;
> else if (load) count <= d; //gated input
> else count <= count + 1;
>
>But, I still have doubts that this will work correctly. A real counter
>should reset regardless of the value of the load input. Section 8.10 says
>'iff' has precedence over 'or', so the control input will also disable the
>ability to reset the counter.
Because 'iff' has precedence over 'or', the expression is like
(posedge clock iff load == 1) or negedge reset
which shows that the load does not disable the reset.
Unfortunately this is not allowable syntax, and it causes syntax problems
if we try to allow it.
Our customer considers
@(a iff b) ....
to be more readable than
begin @a while(!b) @a; .... end // V2001
Regards,
Peter.
This archive was generated by hypermail 2b28 : Tue Dec 11 2001 - 07:39:22 PST