Below code will help us to understand the application of automatic and static keyword of SystemVerilog.
Simulator used to compile below code is ius_9.2s33.
////////////////////////////////////////////////////////////////////////
Code that shows application of AUTOMATIC TASK
////////////////////////////////////////////////////////////////////////
class check_automatic;
task automatic read1;
int a;
int b;
a +=1;
b +=1;
#2;
$display($time,"read 1 : a = %d, b= %d",a,b);
endtask
task display ();
fork
read1;
read1;
join
endtask
endclass
module test;
check_automatic check = new;
Simulator used to compile below code is ius_9.2s33.
////////////////////////////////////////////////////////////////////////
Code that shows application of AUTOMATIC TASK
////////////////////////////////////////////////////////////////////////
class check_automatic;
task automatic read1;
int a;
int b;
a +=1;
b +=1;
#2;
$display($time,"read 1 : a = %d, b= %d",a,b);
endtask
task display ();
fork
read1;
read1;
join
endtask
endclass
module test;
check_automatic check = new;
initial begin
#5 check.display;
end
endmodule
#5 check.display;
end
endmodule
//// OUTPUT///
7read 1 : a = 1, b= 1
7read 1 : a = 1, b= 1
ncsim: *W,RNQUIE: Simulation is complete.\
7read 1 : a = 1, b= 1
ncsim: *W,RNQUIE: Simulation is complete.\
////////////////////////////////////////////////////////////////////////
Code that shows application of STATIC TASK
////////////////////////////////////////////////////////////////////////
Code that shows application of STATIC TASK
////////////////////////////////////////////////////////////////////////
class check_automatic;
task static read1;
int a;
int b;
a +=1;
b +=1;
#2;
$display($time,"read 1 : a = %d, b= %d",a,b);
endtask
task display ();
fork
read1;
read1;
join
endtask
endclass
module test;
check_automatic check = new;
task static read1;
int a;
int b;
a +=1;
b +=1;
#2;
$display($time,"read 1 : a = %d, b= %d",a,b);
endtask
task display ();
fork
read1;
read1;
join
endtask
endclass
module test;
check_automatic check = new;
initial begin
#5 check.display;
end
endmodule
#5 check.display;
end
endmodule
7read 1 : a = 2, b= 2
7read 1 : a = 2, b= 2
ncsim: *W,RNQUIE: Simulation is complete.
7read 1 : a = 2, b= 2
ncsim: *W,RNQUIE: Simulation is complete.
some explanation to the above code would add great value to the understanding of the readers... thank you..
ReplyDeleteHey i do love your post and this blog make me awesome..very useful and i like to share this into my friends just to read your post...well this blog say in keep up your dream and lets make that together..thanks again for posting..what a great blog.
ReplyDeletePIC Bonus
I am expecting a little brief explanation of the code..
ReplyDeleteThank you..