2
\$\begingroup\$

I have the following assert statement in a for loop, which is within a generate block:

34   assert ((a[j] == 1'b1) || (a[j] == 1'b0))
35   else $error("Input 'a[" + j + "]' is not a digital logic value");

When I try to compile, I get the following error:

Error: file(34): near "(": syntax error, unexpected '(', expecting property

From what I can see, I'm not missing any parentheses in the

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

It isn't telling you that you're missing any parentheses; it's telling you that it isn't expecting a parenthesis at all in that spot.

You didn't provide any context, but if your assert is outside a procedural block (initial or always), then a property name must appear between the assert and the (. This is known as an "concurrent assert".

The other type (the syntax you used) is an "immediate assert", and can only appear inside a procedural block.

Additional details here.

\$\endgroup\$
1
  • \$\begingroup\$ I changed my generate block to be an always block. That has fixed the problem. Thanks! \$\endgroup\$ Commented Sep 4, 2019 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.