Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why are nonblocking assignments not allowed in Verilog functions?

I have read that use of nonblocking assignments is not allowed in Verilog functions. Can anyone suggest a plausible explanation for this?

like image 777
Akash Avatar asked Aug 20 '12 10:08

Akash


1 Answers

The IEEE Std for Verilog (1364-2001), section "10.3.4 Function rules" states:

A function shall not have any nonblocking assignments.

The 1800-2009 IEEE Std elaborates more on this:

Functions shall execute with no delay. Thus, a process calling a function shall return immediately. Statements that do not block shall be allowed inside a function; specifically, nonblocking assignments, event triggers, clocking drives, and fork-join_none constructs shall be allowed inside a function.

The intention was for functions to be simple to evaluate in the Verilog event queue. If you need to advance time, use a task instead of a function.

like image 199
toolic Avatar answered Nov 15 '22 12:11

toolic