cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor
Visitor
2,582 Views
Registered: ‎03-27-2017

Incomplete Output from $fmonitor and $monitor Tasks

Hello all,

 

I've written a testbench in vivado and I'm using $monitor to view relevant signals.

I also want to store the results so I use $fmonitor as well.  After running the simulation I have 

a different number of entries for $monitor and those output to the results file $fmonitor.

After checking the entries with my golden model, I can see that they are correct,

but incomplete (I should have more entries.)

 

Thanks.

 

------------------------------------------------------------------------------------------------------------------

This is the relevant part of the code that invokes both tasks: 

 

initial begin
  f = $fopen("output.txt","w");
  $monitor("monitor a:%h @ %0t", acc_out, $time);
  $fmonitor(f, "%h", acc_out);
end


initial begin
  //input signal
end

 

0 Kudos
3 Replies
Highlighted
Moderator
Moderator
2,552 Views
Registered: ‎05-31-2017

Re: Incomplete Output from $fmonitor and $monitor Tasks

Hi @jayne6453,

It seems that you haven't closed the opened file ''output.txt".

So, use $fclose("output.txt") for closing the file. Then check the results, they must be same.

 

Thanks & Regards,

A.Shameer.

Highlighted
Visitor
Visitor
2,476 Views
Registered: ‎03-27-2017

Re: Incomplete Output from $fmonitor and $monitor Tasks

Thanks for the reply A.!

 

I also thought that that would be a problem, so I had previously tried $fclose(f)

but the results were always as if the file would close before it finishes writing. 

I also tried running for additional ns and using $finish and $stop and closing

the file afterwards, but the output would still be incomplete.

 

What I do notice is that if I add text to output (example: $time), the number of

lines that get saved to the file are even less.

 

 

 

0 Kudos
Highlighted
Moderator
Moderator
2,447 Views
Registered: ‎05-31-2017

Re: Incomplete Output from $fmonitor and $monitor Tasks

Hi @jayne6453,

There are different number of entries obtained although after using $fclose statement because,

The statement

$monitor("monitor a:%h @ %0t", acc_out, $time);

gets executed when any one of its parameters i.e acc_out or time changes.

But, the statement 

$fmonitor(f, "%h", acc_out);

gets executed only when acc_out changes.

So, try to use the below statement for writing in to the file

$fmonitor(f, "%h @ %0t", acc_out, $time);

 

Hope it helps.

 

Thanks & Regards,

A.Shameer.

 

Please mark the Answer as "Accept as solution" if the information provided is helpful.

Give Kudos to the post which you think is helpful.

0 Kudos