How to open a document whose name is generated based on the

W

Weng Tianxiang

Guest
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
 
Weng Tianxiang wrote:
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

--
David Ashley http://www.xdr.com/dash
Embedded linux, device drivers, system architecture
 
David Ashley wrote:
Weng Tianxiang wrote:
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

--
David Ashley http://www.xdr.com/dash
Embedded linux, device drivers, system architecture
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 Tianxiang wrote:
David Ashley wrote:

Weng Tianxiang wrote:

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

--
David Ashley http://www.xdr.com/dash
Embedded linux, device drivers, system architecture


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


--
David Ashley http://www.xdr.com/dash
Embedded linux, device drivers, system architecture
 
On 25 Sep 2006 10:12:27 -0700, "Weng Tianxiang" <wtxwtx@gmail.com>
wrote:

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
 
Brian Drummond wrote:
On 25 Sep 2006 10:12:27 -0700, "Weng Tianxiang" <wtxwtx@gmail.com
wrote:

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
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
 
On 26 Sep 2006 10:55:58 -0700, "Weng Tianxiang"
<wtxwtx@gmail.com> wrote:

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
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
Jonathan Bromley wrote:
On 26 Sep 2006 10:55:58 -0700, "Weng Tianxiang"
wtxwtx@gmail.com> wrote:

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
jonathan.bromley@MYCOMPANY.com
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
 

Welcome to EDABoard.com

Sponsor

Back
Top