How to open a document whose name is generated based on the current date and time

W

Weng Tianxiang

Hi,
I would like to copy several segments of code in VHDL:
1. Open a document whose name is generated based on the current date
and time;
2. Write data array into it;
3. Close it.

If you know, please give a tip.

Thank you.

Weng
 
D

David Ashley

Weng said:
Hi,
I would like to copy several segments of code in VHDL:
1. Open a document whose name is generated based on the current date
and time;
2. Write data array into it;
3. Close it.

If you know, please give a tip.

Thank you.

Weng

Perhaps have a where script you run the simulator,
output the file to a known fixed name, then in the
script rename the file to the data-based filename
you'd like?

Pass the output filename in as an argument to
the simulator? Not that I know how to do this...

-Dave
 
W

Weng Tianxiang

David said:
Perhaps have a where script you run the simulator,
output the file to a known fixed name, then in the
script rename the file to the data-based filename
you'd like?

Pass the output filename in as an argument to
the simulator? Not that I know how to do this...

-Dave

Hi David,
Good advice!

I am using Window XP system and run ModelSim simulator.

Please let me know what script software can be used and your
recommendation.

I would like to learn to write scripts under ModelSim simulation
environment.

Can you give some examples to let me start easier.

Weng
 
D

David Ashley

Weng said:
Hi David,
Good advice!

I am using Window XP system and run ModelSim simulator.

Please let me know what script software can be used and your
recommendation.

I would like to learn to write scripts under ModelSim simulation
environment.

Can you give some examples to let me start easier.

Weng

Weng,

I use linux, it's inherently script friendly. However I think
you can use DOS .bat files and use '%' syntax. Perhaps
this page might help somehow:

http://www.ericphelps.com/batch/samples/justtime.bat.txt

-Dave
 
B

Brian Drummond

I am using Window XP system and run ModelSim simulator.

Please let me know what script software can be used and your
recommendation.

I would like to learn to write scripts under ModelSim simulation
environment.


Under ModelSim, it is probably easiest to use TCL.

One option is to generate the filename (or even just the date/time) in
TCL, and pass it into the "Run" command as the value of a generic of
type String.

- Brian
 
W

Weng Tianxiang

Brian said:
Under ModelSim, it is probably easiest to use TCL.

One option is to generate the filename (or even just the date/time) in
TCL, and pass it into the "Run" command as the value of a generic of
type String.

- Brian

Hi Brian and David,
Could you please give some examples on the coding or the reference to
the manual on how to do it?

Thank you.

Weng
 
J

Jonathan Bromley

Could you please give some examples on the coding or the reference to
the manual on how to do it?

hi Weng

What do you want to do? (Sorry, I missed the first
part of this thread somehow.) If you want to create
an output file, something like this...

# Put this into a .do file and source it into ModelSim
proc filename_from_date {prefix} {
set t [clock seconds]
append prefix [clock format $t -format "%Y-%m-%d_%H-%M"]
return $prefix
}
########################################

Now, when you type the command

filename_from_date Report_File_

you will get a result like

Report_File_2006-09-21_21-45

And you can use this result as the name of a file to open in Tcl...

set file_handle [open [filename_from_date Report_File_] w]
puts $file_handle "This is line 1 of the file"
puts $file_handle "This is line 2"
close $file_handle

Is this anything like what you need?????
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
W

Weng Tianxiang

Jonathan said:
Could you please give some examples on the coding or the reference to
the manual on how to do it?

hi Weng

What do you want to do? (Sorry, I missed the first
part of this thread somehow.) If you want to create
an output file, something like this...

# Put this into a .do file and source it into ModelSim
proc filename_from_date {prefix} {
set t [clock seconds]
append prefix [clock format $t -format "%Y-%m-%d_%H-%M"]
return $prefix
}
########################################

Now, when you type the command

filename_from_date Report_File_

you will get a result like

Report_File_2006-09-21_21-45

And you can use this result as the name of a file to open in Tcl...

set file_handle [open [filename_from_date Report_File_] w]
puts $file_handle "This is line 1 of the file"
puts $file_handle "This is line 2"
close $file_handle

Is this anything like what you need?????
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
(e-mail address removed)
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.

Hi Jonathan,
What I want to do is:
During ModelSim simulations, I want to generate two files:
Each time when I start running the simulations, it will do:
1. Put input data into an input file named after date and time;
2. Put output data into an output file named with input data file
appended with
a string "-out".

Input and output data are known to the vhdl file or to the wave.do
file.

My working operating system is Window XP.

I don't know Tcl language and I would like to learn it if necessary;

I am familiar with C and C++.

This is my plan to do it:
1. Transfer input and output data into ASCII string using VHDL
language;
2. Using vhdl procedures ieee.TEXTIO.all to write ASCII strings into a
created file
3. Using C language to do other things with the two files and generate
report.

Any advices?

Thank you.

Weng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top