Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to write in the log file

Status
Not open for further replies.

Roronoa137

Junior Member level 1
Joined
Jul 26, 2019
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
165
Hello, I'm creating a file in the test bench and writing something in it using commands $fopen, $fdisplay and $fclose.

What I would like to know is if there is a way to write directly in the log file or to create a file that is updated during the simulation and doesn't required to be closed before displaying something. Can someone kindly help me, please?
 

Not directly with Verilog/Systemverilog. I think the lack of updates to the file isn't inherent in the system tasks themselves it's more of an OS think of when it writes out to the file during the simulation run. I notice that files I generate update but only after a significant number of KB's of output have been generated.

You could write your own PLI/DPI and have it write directly to the file, without any buffering, it will most likely slow your simulation down considerably.

Another option could be having both the $fdisplay and a $display task to output both to the file and the default display.
 

$fflush should push any internal buffers to a file. You should be able to keep a file open as it updates (I normally do with notepad++). I am a VHDL user though (its been a while since I did SV).
 

$fflush should push any internal buffers to a file. You should be able to keep a file open as it updates (I normally do with notepad++). I am a VHDL user though (its been a while since I did SV).

Nice tip Tricky, I've in the past just waited for the simulation to complete and the $fclose to happen, never looked for a flush command. Though it could have significant detrimental effects on the simulation performance. I would probably use it in a 1us or so while loop in the testbench to occasionally get updates instead of doing it after every $fdisplay.

Most of my simulation testbenches don't generate files, they just report pass/fail status of the tests as they run, which I can pipe or tee to a file since I run from a command line the majority of the time. If a test generates files it's usually for post processing of data from the UUT.
 

Thank you, I will try to use it and let you know if it works!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top