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.

How to make Modelsim dump the data immediately?

Status
Not open for further replies.

machael

Member level 2
Joined
Nov 4, 2004
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
513
Hi, guys!
I'm using Modelsim to run a sdf timing simulation. In the testbench, I make several important signals to output the values into some text files using $fdisplay system task function. So I can compare the output file with an "ideal output" file made by Matlab simulation to evaluate whether the design is correct. Because the simulation is rather slow, I want to firstly run the simulation for several microseconds and break it and compare the outputs first, if the output has became wrong, I don't need to keep going and will stop to find the bugs in my design. If the output is correct, I can resume the simulation for longer time.

Now I meet a problem: Modelsim does not output the result of the signal immediately, otherwise, it keep the data in memory. Until the data is "enough" or the simulation is stopped, the simulator will not dump it into the text files. So I found I can't preview the simulation rusult just as I wish, it really bother me. Can anyone tell me how to dump "the data to fdisplay" immediately or whenever I want to? Maybe it need a command or some special code in testbench? I will be very thankful!
 

echo47

Advanced Member level 5
Joined
Apr 7, 2002
Messages
3,942
Helped
638
Reputation
1,274
Reaction score
89
Trophy points
1,328
Location
USA
Activity points
33,176
I don't see this Verilog command in ModelSim's Commad Reference manual, but it works!

According to IEEE Std 1364-2001:

17.2.6 Flushing output
$fflush ( mcd );
$fflush ( fd );
$fflush ( );
Writes any buffered output to the file(s) specified by mcd, the file specified by fd or if $fflush is invoked with no arguments, writes any buffered output to all open files.
 

machael

Member level 2
Joined
Nov 4, 2004
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
513
echo47, Thank you very much for your great resolve method!

In fact, I have thought another method to solve this problem yesterday. It is that every time when the data has been wrote into the file by $fdisplay, the file is close by $fclose, and when the next time it should be written again, the file is open by $fopen with append option, e.g.

file = $fopen("test.txt","a");

so, the file will be wroten each time and closed, when the file is closed , the data is flushed into it.
This method has another problem: to avoid the file become bigger and bigger with the repeated simulation. It should be open by a "w" option in the initial process of simulation and closed immediately, so it will be cleared.

Of course, my method is more trivial and your method is more effective. So I want to say thank you again!

Regards!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top