Hi all,
I have just started learning about SV environment and was trying to build an environment, i am facing an error " Unresolved reference to ‘this’ for non-static field ‘pkt’ " in the generator code:-
`include "stimul.sv"
class gen;
packet1 pkt;
typedef mailbox #(pkt) in_box_type;
in_box_type in_box=new();
string name;
int number_packets;
function new(string name="packets",int number_packets);
this.name=name;
this.number_packets=number_packets;
endfunction
extern task start();
endclass
task gen::start();
for(int i=0;i<number_packets;i++)
begin
pkt=new;
if(pkt.randomize())
in_box.put(pkt);
$display(" from %s , number of packet: %d",this.name,in_box.num());
end
endtask
the stimul.sv :-
class packet1;
randc bit data;
bit count;
bit reset;
string name;
function new(string name="from stimuli");
this.name=name;
endfunction
endclass