Sunday, August 5, 2012


What is the difference between a function and a task? in 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
  1. 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.
  1. 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.
  1. Synthesis :
Function : A function can be synthesized
Task : Tasks are not synthesizable
  1. Limitations :
Function : A function does not allow any delay, timing, event inside it
Task : Tasks can have delays, events inside it
  1. 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.

No comments:

Post a Comment