Subject: Questions on section 8.10
From: Stuart Sutherland (stuart@sutherland-hdl.com)
Date: Mon Dec 10 2001 - 08:13:36 PST
All,
I have a few questions regarding Section 8.10, on event controls.
----------------------
1) The text says:
"SystemVerilog adds the following enhancement:
@(posedge clk iff rst == 0)
The event expression only triggers if the expression after the iff is 1, in
this case when rst ==0. Note that such an expression is evaluated when clk
changes not when rst changes. Also note that iff has precedence over or.
This can be made clearer by the use of parentheses."
If I add some context:
@(posedge clk iff rst == 0) begin
if (!rst) q <= 0;
else q <= d;
end
I don't see how the reset assignment ever occurs. As soon as reset goes
active, the iff condition will be false, and the event control will not
trigger. Therefore the procedure will never execute when reset is
active. Am I missing something?
----------------------
2) The way I read the BNF (which is often wrong) it seems to indicate that
iff is an optional part of an event_expression, and that the @ can contain
any number of event_expressions. Therefore, the following is legal:
@(posedge clk iff rst & set or negedge set iff !rst or negedge rst) begin
Is the above example syntactically legal? Does it functionally represent
that reset has priority over preset?
----------------------
3) The end of section 8.10 says:
"The @(changed expression) differs from @(expression) in that the changed
keyword explicitly defines that the event control only triggers on a change
of the result of the expression...
Note that SystemVerilog allows assignment expressions to be used in an
event control, e.g. @((a = b + c)). The event control is only sensitive to
changes in variables or nets on the right side of the assignment, b and c
in this example."
So, what happens if I do:
@(changed (a = b * c)) //assume b is 0, and c changes
Does the last sentance of the text still apply, or does the event control
trigger on a change to the result of b * c instead of the "variables or
nets on the right side of the assignment"?
----------------------
Stu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stuart Sutherland Sutherland HDL Inc.
stuart@sutherland-hdl.com 22805 SW 92nd Place
phone: 503-692-0898 Tualatin, OR 97062
www.sutherland-hdl.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This archive was generated by hypermail 2b28 : Mon Dec 10 2001 - 08:12:25 PST