system verilog error with ncvlog

Status
Not open for further replies.

aizyc

Newbie level 4
Joined
Nov 26, 2010
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
hyderabad
Activity points
1,329
hi
i hav written the "generator class " code for a router
my simulation is stuck with an error . please help me with a solution asap.

this is the piece of code
------------------------------------------------
function generator::new(string name = "generator");
if(TRACE_ON)
$display("[TRACE] %t %s:%m", $realtime,name);
this.name = name;
this.pkt2send = new();
this.out_box = new[16];

foreach(this.out_box)
begin
this.out_box = new();
end
endfunction
----------------------------------------------------------------
---- the error-----


foreach(this.out_box)

|
ncvlog: *E,EXPAIF (generator.sv,27|16): Expecting simple array identifier in foreach.

foreach(this.out_box)
|
ncvlog: *E,MISEXX (generator.sv,27|28): expecting an '=' or '<=' sign in an assignment [9.2(IEEE)].
foreach(this.out_box)
|
ncvlog: *E,NOTSTT (generator.sv,27|28): expecting a statement [9(IEEE)].


thanks.
 

thnx 4 d reply .
yes i hav declared variable as int i.
and i hav found a sol fr it by using a for loop instead f foreach.

i have anothr problem now in d piece f code below.

task scoreboard :: check();
int index[$];
string message;
static int pkts_checked = 0;
if(TRACE_ON) $display("[trace]%t %s:%m",$realtime,name);
index = refpkt.find_first_index() with (item.da == pkt2cmp.da);
if(index.size() <= 0)
begin
$display("\n%m\n[error]%t %s not found in reference queue\n",
$realtime,pkt2cmp.name);
pkt2cmp.display("error");
$finish;
end
pkt2send = refpkt[index[0]];
refpkt.delete(index[0]);
if(!pkt2send.compare(pkt2cmp, message))
begin
$display("\n%m\n[error]%t packet #%0d %s\n",$realtime,
pkts_changed, message);
pkt2send.display("error");
pkt2cmp.display("error");
$finish;
end
$display("[note]%t packet #%0d %s", $realtime, pkts_checked++, message);
if(pkts_checked >= run_for_n_packets)
->done;
endtask

in the line
index = refpkt.find_first_index() with (item.da == pkt2cmp.da);
shows the follwing error.
|
ncvlog: *E,EXPIDN (scoreboard.sv,54|34): expecting an identifier (null).

i have tried it wd removing () aftr refpkt.find_first_index with .....
also have tried it with .find_index() with....

but noth as such workd out. plz help wd sm other suggestion.
thnx.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…