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.

Information about saving the time in a file in Verilog.

Status
Not open for further replies.

always84

Member level 1
Member level 1
Joined
Feb 24, 2010
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
italy
Activity points
1,567
Hy I have to save some metrics about my design. I want to save the istant of a particular event on a file, my code is write in Verilog and I'm using modelsim. I was thinking to use the istruction $time to capture a particular istant of time, and if it's possible to save it on a file. How can I do this? is it possible? Could I use $time and $writmemb (or $writememh) to solve my problem.

Thx for helping me.
 

Yes it is possible and it's not hard to do.

You can get the simulation time using this:
reg time;
$monitor($time,,"set=%b",time);

And then save it in a file using this:
integer file_ptr; // file pointer

file_ptr <= $fopen("C:\\...whatever...\\your_file.txt", "wb");
$fwrite(file_ptr,"%d \n",time);

I don't recomend using $writememh or $writememb because they only store data as hex or binary. Verilog as other functions such as $fwrite and $fread which are very similar to C programming and easier to use.

Hope it helped.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top