E
Evan Lavelle
Guest
The LRM doesn't seem to have much to say on evaluation order. 4.1.4
just says that "the operators shall follow the associativity rules",
an expression "need not" be evaluated if short-circuiting is possible,
and that the operands of '&' might be evaluated left-to-right.
Have I missed something? Are there any requirements on the evaluation
order of the operands of an operator, on argument lists, or anything
else? Or any specific short-circuit requirements?
I've run a quick test (below) on 3 sims; 2 of them produce a result of
12 (ie. the operands of '+' are evaluated left-to-right), and the
other one produces 6 (right-to-left).
Thanks -
Evan
-------------------------------------------------------------------
module test;
integer b;
initial
main;
function integer assign_b;
input val;
integer val;
begin
b = val;
assign_b = val;
end
endfunction
task main;
begin
b = 9;
b = b + assign_b(3);
$display("b is %0d\n", b);
end
endtask
endmodule
just says that "the operators shall follow the associativity rules",
an expression "need not" be evaluated if short-circuiting is possible,
and that the operands of '&' might be evaluated left-to-right.
Have I missed something? Are there any requirements on the evaluation
order of the operands of an operator, on argument lists, or anything
else? Or any specific short-circuit requirements?
I've run a quick test (below) on 3 sims; 2 of them produce a result of
12 (ie. the operands of '+' are evaluated left-to-right), and the
other one produces 6 (right-to-left).
Thanks -
Evan
-------------------------------------------------------------------
module test;
integer b;
initial
main;
function integer assign_b;
input val;
integer val;
begin
b = val;
assign_b = val;
end
endfunction
task main;
begin
b = 9;
b = b + assign_b(3);
$display("b is %0d\n", b);
end
endtask
endmodule