In reply to dave_59:
In reply to sriram.seshagiri:
You should not have needed to explicitly declare eq_pa_r with an automatic lifetime—that is the implicit default. You need to create a standalone testcase, no one can run your code to try it out, plus it has many typos.
Hi Dave,
Thanks for responding.
I have created a testable code anyone can run and, see. It is also in EDA playground: Automatic Variable example - EDA Playground
module top;
class dummy;
int curr_pid;
int eq_pa;
task body();
eq_pa = 'h100;
for(int i=0; i<10; i++) begin
fork
automatic int j = i;
automatic longint eq_pa_r = eq_pa;
//hiarb_hifis_req(eq_pa_r,j);
hiarb_hifis_req(eq_pa,i);
$display(“New EQ PAR : %0x\n”, eq_pa_r);
join_none;
eq_pa = eq_pa + 'h40;
$display(“New EQ PA : %0x\n”, eq_pa);
end
wait fork;
endtask
function void hiarb_hifis_req(int pa,int i);
$display("Processing thread %0d with EQ PA: %0x",i,pa);
endfunction
endclass
initial begin
dummy dum = new();
dum.body();
end
endmodule
This is the Output I see without using Automatic variable here. Here my question is this should have worked right since like you said since it should have been by default Automatic within a Class entity in System Verilog.
Processing thread 10 with EQ PA: 380
New EQ PAR : 100
Processing thread 10 with EQ PA: 380
New EQ PAR : 140
Processing thread 10 with EQ PA: 380
New EQ PAR : 180
Processing thread 10 with EQ PA: 380
New EQ PAR : 1c0
Processing thread 10 with EQ PA: 380
New EQ PAR : 200
Processing thread 10 with EQ PA: 380
New EQ PAR : 240
Processing thread 10 with EQ PA: 380
New EQ PAR : 280
Processing thread 10 with EQ PA: 380
New EQ PAR : 2c0
Processing thread 10 with EQ PA: 380
New EQ PAR : 300
Processing thread 10 with EQ PA: 380
New EQ PAR : 340
But with using Automatic variable here I get the correct expected output:
Processing thread 0 with EQ PA: 100
New EQ PAR : 100
Processing thread 1 with EQ PA: 140
New EQ PAR : 140
Processing thread 2 with EQ PA: 180
New EQ PAR : 180
Processing thread 3 with EQ PA: 1c0
New EQ PAR : 1c0
Processing thread 4 with EQ PA: 200
New EQ PAR : 200
Processing thread 5 with EQ PA: 240
New EQ PAR : 240
Processing thread 6 with EQ PA: 280
New EQ PAR : 280
Processing thread 7 with EQ PA: 2c0
New EQ PAR : 2c0
Processing thread 8 with EQ PA: 300
New EQ PAR : 300
Processing thread 9 with EQ PA: 340
New EQ PAR : 340