lostinxlation
Advanced Member level 2
- Joined
- Aug 19, 2010
- Messages
- 699
- Helped
- 197
- Reputation
- 394
- Reaction score
- 183
- Trophy points
- 1,323
- Location
- San Jose area
- Activity points
- 5,051
I need to find some way to define a global variable that can be accessed by multiple tasks in Verilog.
For example, this code allows task1 and task2 to access global variable, 'mem', if the said variable is not declared in task1 and task2.
The issue for me is I still need to declare 'mem' inside task1 and task2 so that other team member won't have any issues in compilation, but doing so makes 'mem' a local variable and it cannot be shared as a global variable.
Basically, I'm looking for the way to use a globally accessible variable which is also defined as a local variable inside the task.
If I can pass the variable as an argument between the tasks, it would work as I intend, but I don't know if it's possible to pass around the multi-dimensional variables as arguments(Probably not, I guess).
Does anyone have a good idea how to let multiple tasks share the variable that is declared as a local variable in the tasks ?
For example, this code allows task1 and task2 to access global variable, 'mem', if the said variable is not declared in task1 and task2.
Code:
reg [15:0] mem [0:1023];
task1;
task2;
The issue for me is I still need to declare 'mem' inside task1 and task2 so that other team member won't have any issues in compilation, but doing so makes 'mem' a local variable and it cannot be shared as a global variable.
Basically, I'm looking for the way to use a globally accessible variable which is also defined as a local variable inside the task.
If I can pass the variable as an argument between the tasks, it would work as I intend, but I don't know if it's possible to pass around the multi-dimensional variables as arguments(Probably not, I guess).
Does anyone have a good idea how to let multiple tasks share the variable that is declared as a local variable in the tasks ?
Last edited: