In reply to noel:
I was wondering if it’s legal to have assertion in constant function. I couldn’t find an issue in the LRM but when I compiled the code in vcs it says its not supported. I am trying to determine if this is an LRM issue or tool issue. Thanks
Code:
package test_pkg;
function automatic int logb2
(
input int value
);
if (value >= 1)
begin
value = value -1;
for (logb2 = 0; value > 0; logb2++)
value = value >> 1;
return(logb2);
end
else
begin
assert (value >= 1) else $error("%m logb2 function issue with computation logb2 of %d\n", value);
end
endfunction // logb2
endpackage:test_pkg
May be it is something specific to VCS alone ?? I see it working perfectly fine with Cadence simulator…