Updating global reg's from inside functions/tasks

J

Jay Bhadra

Guest
Let's say I have a single module defining an array and a function

reg[2:0] mem[2:0];

....

function [7:0] f(ip, v)
....
mem[ip] = v;
....
endfunction

Is it going to be a problem if I am going to call function f from
parallel always blocks, as it can update the same location multiple
times? What about a task?

If that's a problem, then what would be a solution to this?
 
jay@cerc.utexas.edu (Jay Bhadra) wrote in message news:<3e59b6a9.0311061129.25d6b0e5@posting.google.com>...
Is it going to be a problem if I am going to call function f from
parallel always blocks, as it can update the same location multiple
times? What about a task?
You will have to be more specific about what you consider to be a
problem.

It will simulate just fine, though the results might be undefined if
the order that the two always blocks execute matters.

A synthesis tool certainly won't handle this if it doesn't handle
writing to the same object from two different always blocks.
 

Welcome to EDABoard.com

Sponsor

Back
Top