Nityanand's Weblog

  • view my stats

    free page hit counter
  • Earn Money by viewing ads

  • Useful Links

Archive for February, 2009

What is the difference between a function and a task?

Posted by Nityanand Dubey on February 19, 2009

There are many differences in a function and a task in the verilog

1. Behavior :

Function : function call happens in real time OR no simulation delay can be inserted during the function call
Task : Tasks can be inserted with a delay

2. No of outputs :

Function : A function can have at least one input arg to be passed, and also it can have only one output to drive
Task : Task can have any no of inputs and outputs.

3. Nesting :

Function : A function can call a function inside it but not a task
Task : Task can call either a function or a task inside it.

4. Synthesis :

Function : A function can be synthesized
Task : Tasks are not synthesizable

5. Limitations :

Function : A function does not allow any delay, timing, event inside it
Task : Tasks can have delays, events inside it

6. Usage :

Function : A can be used for RTL as well as behavioral coding ( mostly for combinational logic)
Task : Tasks can be used for behavioral modeling only.

Posted in VERILOG | Tagged: , , , | Leave a Comment »