Hi, I have a scenario in scoreboard to always monitor activity on an interface that is parameterized. I have code something like below. But This will give me tool run out of memory issue! Can someone help with a solution to this issue?
task example_monitor_signal;
forever begin
for (int i = 0; i < MAX_EX_PARAM; i++) begin
automatic int j = i;
fork
monitor_signal (j);
join_none
end
end
endtask
task main_phase ();
fork
example_monitor_signal ();
join_none
endtask
Your code is creating infinite number of threads… and each thread is trying to run
monitor_signal.
If you look at the logic, the for_loop runs MAX_EX_PARAM times and creates monitor_signal threads. After this it exits the for_loop, jumps into the forever_loop and reenters for_loop
This creates another MAX_EX_PARAM threads all running monitor_signal.
Hi Juhi,
Thanks for trying out an example. I tried this too. But it does not work everytime a value is changed. Can you explain how your example logic works everytime you change value of abc?
Regards,
Varsha
Hi Juhi,
Referring to your example, If I again send same value of 5 to abc, it does not display again. My requirememt is it should monitor continously. The example you tried to help me definitely works good for one iteration.
module abc;
sc s1;
initial begin
s1=new();
s1.main_phase();
s1.abc=5;
#2;
s1.abc=9;
#3;
s1.abc=6;
#4;
s1.abc=5;
end
endmodule
Thank you! I want to understand why is the below statement added? i tried without it and it goes to infinite loop. I am not understanding how this statemnt killed the current thread.
thread is not killed. It will go to infinite value if you remove it, because abc=a will be immediately executes and it will run forever.
by adding abc!=a, I am letting this thread wait till changed and get the same value again.