UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

Incomplete Output from $fmonitor and $monitor Tasks

Highlighted
Visitor
Posts: 2
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

 

Xilinx Employee
Posts: 13
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.

Visitor
Posts: 2
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.

 

 

 

Xilinx Employee
Posts: 13
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.