Recursive functions and Icarus Verilog

  • Thread starter [LinuxFc4]GaLaKtIkUs™
  • Start date
L

[LinuxFc4]GaLaKtIkUs™

Guest
In Icarus Verilog I can't use the keyword "automatic" in tasks or
functions.
This is a real problem for me because it would be impossible to invoke
the same function ot task at the same time :(
Is there an alternative way to do that?
Thanks
Mehdi
 
It is actually unusual to need to invoke the same function or task at
the same time. For a function, the only way this could happen is if
the function calls itself recursively. Since function calls take no
time, there is no other way it will be called while the previous call
is still active.

Since a task can wait, it is possible for another process to call the
task while an earlier call is still waiting. But this requires the
task to be called from two different blocks in the same module. There
is not usually much reason for doing this. Calls to the task in
different modules are calling different instances of the task, and do
not affect each other.
 
[LinuxFc4]GaLaKtIkUs™ wrote:
In Icarus Verilog I can't use the keyword "automatic" in tasks or
functions.
This is a real problem for me because it would be impossible to invoke
the same function ot task at the same time :(
Is there an alternative way to do that?
Thanks
Mehdi
Mehdi,

The use of automatic option is only available in new Verilog-2001
language. Some simulators do not support it or only support it with a
special option. check is Icarus Verilog needs a switch to enable this
function it may save you some coding time!


If the automatic option is not available, you will need to use a
semaphore. You can call the task from several places at the same time,
but each call will need to check the semaphore before it is called, or
wait if it's not available, the task will remove the semaphore while it
is active and then release it for the next call, this way the multiple
calls will not collide when accessing the task at the same simulation
time.

Duncan
 
"[LinuxFc4]GaLaKtIkUsT" <taileb.mehdi@gmail.com> wrote in message news:1125034849.719794.306430@z14g2000cwz.googlegroups.com...
In Icarus Verilog I can't use the keyword "automatic" in tasks or
functions.
This is a real problem for me because it would be impossible to invoke
the same function ot task at the same time :(
Is there an alternative way to do that?
Thanks
Mehdi
Actually, good-old Verilog 95 allows recursive functions and tasks,
even though these are 'static'. Just make sure what you are doing
when you make assignments to the 'return' variable. Remember that
that variable is also static..

Rob
 

Welcome to EDABoard.com

Sponsor

Back
Top