Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Global variables in Verilog

Status
Not open for further replies.

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.
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:

you can declare mem globally and use it through one task for read and write! other task can use this task!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top