top of page

15.4. Re-entrant Tasks and Functions

Re-entrancy refers to the ability of a task or function to be called again before its previous invocation completes. This requires automatic storage allocation.

What is Re-entrancy?

A re-entrant task/function can be safely called:

  • From multiple places concurrently (fork-join)

  • Recursively (calling itself)

  • While a previous call is still executing

Why Static is NOT Re-entrant

Verilog

Automatic Makes It Re-entrant

Verilog

Recursive Functions - Must Be Automatic

Verilog

When to Use Automatic

  • Required for:

    • Recursive functions/tasks

    • Concurrent calls in fork-join

    • Thread-safe operations

  • Recommended for:

    • Modern verification environments

    • Class methods (SystemVerilog)

    • When in doubt (safer)

static & automatic

Advanced technique
 

  • Instagram
  • Facebook
  • Twitter
  • LinkedIn
  • YouTube

Connect with us

bottom of page