writing current date to a 32 bit register

Guest
I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.

Can someone explain me is there an easy way to implement?
 
oktem@su.sabanciuniv.edu wrote:

I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.

Can someone explain me is there an easy way to implement?
I add a timestamp like this to my builds by generating a package in the makefile I drive the build with. Here's an excerpt:

version.vhd: Makefile
@echo "generating $@"
@rm -f $@
@echo "PACKAGE version IS" > $@
@echo " CONSTANT C_VER_DESIGN : INTEGER := $(VER_DESIGN);" >> $@
@echo " CONSTANT C_VER_MAJOR : INTEGER := $(VER_MAJOR);" >> $@
@echo " CONSTANT C_VER_MINOR : INTEGER := $(VER_MINOR);" >> $@
@echo " CONSTANT C_VER_REV : INTEGER := $(VER_REV);" >> $@
@echo " CONSTANT C_VER_TIMESTAMP : INTEGER := $(shell date +%s);">> $@
@echo "END version;" >> $@

The C_VER_TIMESTAMP is a constant containing the number of seconds since the epoch (1970-01-01 00:00:00 GMT).

This only guarantees an up-to-date timestamp if I build with make. When I'm building from an ISE project, all bets are off.

Ken
 
oktem@su.sabanciuniv.edu wrote:
On Mar 4, 5:40 pm, Ken Cecka <cec...@alumni.washington.edu> wrote:
ok...@su.sabanciuniv.edu wrote:
I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.
Can someone explain me is there an easy way to implement?
I add a timestamp like this to my builds by generating a package in the makefile I drive the build with. Here's an excerpt:

version.vhd: Makefile
@echo "generating $@"
@rm -f $@
@echo "PACKAGE version IS" > $@
@echo " CONSTANT C_VER_DESIGN : INTEGER := $(VER_DESIGN);" >> $@
@echo " CONSTANT C_VER_MAJOR : INTEGER := $(VER_MAJOR);" >> $@
@echo " CONSTANT C_VER_MINOR : INTEGER := $(VER_MINOR);" >> $@
@echo " CONSTANT C_VER_REV : INTEGER := $(VER_REV);" >> $@
@echo " CONSTANT C_VER_TIMESTAMP : INTEGER := $(shell date +%s);">> $@
@echo "END version;" >> $@

The C_VER_TIMESTAMP is a constant containing the number of seconds since the epoch (1970-01-01 00:00:00 GMT).

This only guarantees an up-to-date timestamp if I build with make. When I'm building from an ISE project, all bets are off.

Ken

Now i have a tcl script which takes current date and convert it to a
binary
I can run this tcl script from the tcl shell menu of xilinx project
navigator
I added a generic current_date variable on my top module
I added this varible to generics, parameters part of Synthesis Options
menu of Xilinx.

So everythime i want to synthesize, I need to run the tcl script, get
the output of the function, copy and paste it to the current_date at
the generics tab of synthesis options and run.
Actually I was not able to do it with the makefile approach since it
seems harder for me. I need a little more explanation.

best regards
You can set the generics within ISE using the Xilinx specific Tcl command

project set "Generics, Parameters" "Max=10" -process "Synthesize - XST"

where Max is an integer generic with the value 10.

If your generic is a string, you'll need to work out the quoting syntax.
If you want to see how Xilinx has stored your generic, export your
project settings using the ISE menu

Project > Generate Tcl Script...

You can then put your own Tcl script at the front to generate the time
value, and then run it using the command

xtclsh script.tcl

xtclsh is the Xilinx Tcl interpreter, which understands the Xilinx Tcl
extensions, as well as plain Tcl.

regards
Alan




--
Alan Fitch
Doulos
http://www.doulos.com
 
On Mar 4, 5:40 pm, Ken Cecka <cec...@alumni.washington.edu> wrote:
ok...@su.sabanciuniv.edu wrote:
I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.

Can someone explain me is there an easy way to implement?

I add a timestamp like this to my builds by generating a package in the makefile I drive the build with.  Here's an excerpt:

version.vhd: Makefile
        @echo "generating $@"
        @rm -f $@
        @echo "PACKAGE version IS" > $@
        @echo "  CONSTANT C_VER_DESIGN    : INTEGER := $(VER_DESIGN);" >> $@
        @echo "  CONSTANT C_VER_MAJOR     : INTEGER := $(VER_MAJOR);" >> $@
        @echo "  CONSTANT C_VER_MINOR     : INTEGER := $(VER_MINOR);" >> $@
        @echo "  CONSTANT C_VER_REV       : INTEGER := $(VER_REV);" >> $@
        @echo "  CONSTANT C_VER_TIMESTAMP : INTEGER := $(shell date +%s);">> $@
        @echo "END version;" >> $@

The C_VER_TIMESTAMP is a constant containing the number of seconds since the epoch (1970-01-01 00:00:00 GMT).

This only guarantees an up-to-date timestamp if I build with make.  When I'm building from an ISE project, all bets are off.

Ken
Now i have a tcl script which takes current date and convert it to a
binary
I can run this tcl script from the tcl shell menu of xilinx project
navigator
I added a generic current_date variable on my top module
I added this varible to generics, parameters part of Synthesis Options
menu of Xilinx.

So everythime i want to synthesize, I need to run the tcl script, get
the output of the function, copy and paste it to the current_date at
the generics tab of synthesis options and run.
Actually I was not able to do it with the makefile approach since it
seems harder for me. I need a little more explanation.

best regards
 
On Mar 5, 11:26 am, Alan Fitch <alan.fi...@spamtrap.com> wrote:
ok...@su.sabanciuniv.edu wrote:
On Mar 4, 5:40 pm, Ken Cecka <cec...@alumni.washington.edu> wrote:
ok...@su.sabanciuniv.edu wrote:
I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.
Can someone explain me is there an easy way to implement?
I add a timestamp like this to my builds by generating a package in the makefile I drive the build with.  Here's an excerpt:

version.vhd: Makefile
        @echo "generating $@"
        @rm -f $@
        @echo "PACKAGE version IS" > $@
        @echo "  CONSTANT C_VER_DESIGN    : INTEGER := $(VER_DESIGN);" >> $@
        @echo "  CONSTANT C_VER_MAJOR     : INTEGER := $(VER_MAJOR);" >> $@
        @echo "  CONSTANT C_VER_MINOR     : INTEGER := $(VER_MINOR);" >> $@
        @echo "  CONSTANT C_VER_REV       : INTEGER := $(VER_REV);" >> $@
        @echo "  CONSTANT C_VER_TIMESTAMP : INTEGER := $(shell date +%s);">> $@
        @echo "END version;" >> $@

The C_VER_TIMESTAMP is a constant containing the number of seconds since the epoch (1970-01-01 00:00:00 GMT).

This only guarantees an up-to-date timestamp if I build with make.  When I'm building from an ISE project, all bets are off.

Ken

Now i have a tcl script which takes current date and convert it to a
binary
I can run this tcl script from the tcl shell menu of xilinx project
navigator
I added a generic current_date variable on my top module
I added this varible to generics, parameters part of Synthesis Options
menu of Xilinx.

So everythime i want to synthesize, I need to run the tcl script, get
the output of the function, copy and paste it to the current_date at
the generics tab of synthesis options and run.
Actually I was not able to do it with the makefile approach since it
seems harder for me. I need a little more explanation.

best regards

You can set the generics within ISE using the Xilinx specific Tcl command

project set "Generics, Parameters" "Max=10" -process "Synthesize - XST"

where Max is an integer generic with the value 10.

If your generic is a string, you'll need to work out the quoting syntax.
If you want to see how Xilinx has stored your generic, export your
project settings using the ISE menu

Project > Generate Tcl Script...

You can then put your own Tcl script at the front to generate the time
value, and then run it using the command

xtclsh script.tcl

xtclsh is the Xilinx Tcl interpreter, which understands the Xilinx Tcl
extensions, as well as plain Tcl.

regards
Alan

--
Alan Fitch
Douloshttp://www.doulos.com

Project > Generate Tcl Script...
You can then put your own Tcl script at the front to generate the
time value, and then run it using the command

Regarding this statement I have some newbie questions

so when go to ISE menu > project > create a Tcl script to regenerate
the project file
1- Do i have to exclude anything from the export list. There is a vhd
file,my tcl script,there is a ncd file and lastly a timesim_vhw file.
2- What difference does it make if I add output files and add report
files.
3- After I finish exporting I noticed an import.tcl and an export tcl
file in my project directory. Should I run these from the tcl shell
menu of project navigator. What do I do with these files. If I run
these files is it posible to not copy paste the date for each
synthesis


I started using tcl yesterday so sorry for the foolish questions.
 
On Mar 5, 12:22 pm, ok...@su.sabanciuniv.edu wrote:
On Mar 5, 11:26 am, Alan Fitch <alan.fi...@spamtrap.com> wrote:



ok...@su.sabanciuniv.edu wrote:
On Mar 4, 5:40 pm, Ken Cecka <cec...@alumni.washington.edu> wrote:
ok...@su.sabanciuniv.edu wrote:
I want to automatically put the current date (year,month,day maybe
hour) in a 32 bit register during the synthesis stage. I am using
Modelsim as a simulator and Xilinx Xst as a synthesis tool. My target
fpga is Spartan 3.
Can someone explain me is there an easy way to implement?
I add a timestamp like this to my builds by generating a package in the makefile I drive the build with.  Here's an excerpt:

version.vhd: Makefile
        @echo "generating $@"
        @rm -f $@
        @echo "PACKAGE version IS" > $@
        @echo "  CONSTANT C_VER_DESIGN    : INTEGER := $(VER_DESIGN);" >> $@
        @echo "  CONSTANT C_VER_MAJOR     : INTEGER := $(VER_MAJOR);" >> $@
        @echo "  CONSTANT C_VER_MINOR     : INTEGER := $(VER_MINOR);" >> $@
        @echo "  CONSTANT C_VER_REV       : INTEGER := $(VER_REV);" >> $@
        @echo "  CONSTANT C_VER_TIMESTAMP : INTEGER := $(shell date +%s);">> $@
        @echo "END version;" >> $@

The C_VER_TIMESTAMP is a constant containing the number of seconds since the epoch (1970-01-01 00:00:00 GMT).

This only guarantees an up-to-date timestamp if I build with make.  When I'm building from an ISE project, all bets are off.

Ken

Now i have a tcl script which takes current date and convert it to a
binary
I can run this tcl script from the tcl shell menu of xilinx project
navigator
I added a generic current_date variable on my top module
I added this varible to generics, parameters part of Synthesis Options
menu of Xilinx.

So everythime i want to synthesize, I need to run the tcl script, get
the output of the function, copy and paste it to the current_date at
the generics tab of synthesis options and run.
Actually I was not able to do it with the makefile approach since it
seems harder for me. I need a little more explanation.

best regards

You can set the generics within ISE using the Xilinx specific Tcl command

project set "Generics, Parameters" "Max=10" -process "Synthesize - XST"

where Max is an integer generic with the value 10.

If your generic is a string, you'll need to work out the quoting syntax..
If you want to see how Xilinx has stored your generic, export your
project settings using the ISE menu

Project > Generate Tcl Script...

You can then put your own Tcl script at the front to generate the time
value, and then run it using the command

xtclsh script.tcl

xtclsh is the Xilinx Tcl interpreter, which understands the Xilinx Tcl
extensions, as well as plain Tcl.

regards
Alan

--
Alan Fitch
Douloshttp://www.doulos.com

 Project > Generate Tcl Script...
 You can then put your own Tcl script at the front to generate the
time value, and then run it using the command

 Regarding this statement I have some newbie questions

 so when go to ISE menu > project > create a Tcl script to regenerate
the project file
1- Do i have to  exclude anything from the export list. There is a vhd
file,my tcl script,there is a ncd file and lastly a timesim_vhw file.
2- What difference does it make if I add output files and add report
files.
3- After I finish exporting I noticed an import.tcl and an export tcl
file in my project directory. Should I run these from the tcl shell
menu of project navigator. What do I do with these files. If I run
these files is it posible to not copy paste the date for each
synthesis

I started using tcl yesterday so sorry for the foolish questions.

I put this line
project set "Generics, Parameters" "ID=my_date" -process "Synthesize -
XST"
at the end of my tcl script so that i do not have to copy and paste it
everytime.

so now i need to undertand these import.tcl and export.tcl files.

Also im having problem with integer to binary conversion. Is there a
tcl function that I can determine the width of the output. if I
convert 3 to binary can I get an output of exactly 4 bits like this
(0011) not 2 bits (11) or 8 bits (00000011) or 32 bits
(00000000000000000000000000000011)
 
oktem@su.sabanciuniv.edu wrote:
You can set the generics within ISE using the Xilinx specific Tcl command

project set "Generics, Parameters" "Max=10" -process "Synthesize - XST"

where Max is an integer generic with the value 10.

If your generic is a string, you'll need to work out the quoting syntax.
If you want to see how Xilinx has stored your generic, export your
project settings using the ISE menu

Project > Generate Tcl Script...

You can then put your own Tcl script at the front to generate the time
value, and then run it using the command

xtclsh script.tcl

xtclsh is the Xilinx Tcl interpreter, which understands the Xilinx Tcl
extensions, as well as plain Tcl.


Project > Generate Tcl Script...
You can then put your own Tcl script at the front to generate the
time value, and then run it using the command

Regarding this statement I have some newbie questions

so when go to ISE menu > project > create a Tcl script to regenerate
the project file
1- Do i have to exclude anything from the export list. There is a vhd
file,my tcl script,there is a ncd file and lastly a timesim_vhw file.
I don't know - I don't seem to see those options. I'm running 10.1 SP3
though.

2- What difference does it make if I add output files and add report
files.
Sorry I don't know.

3- After I finish exporting I noticed an import.tcl and an export tcl
file in my project directory. Should I run these from the tcl shell
menu of project navigator. What do I do with these files. If I run
these files is it posible to not copy paste the date for each
synthesis

That just sounds different - which version of Xilinx are you using?

You might just have to look in the help - I found the Generate Tcl
Script option was not available in the pdf help, I had to look in the
help from the Xilinx GUI i.e. use menu Help > Help Topics
then follow the struction

Getting Started
Using Project Navigator
Working with Projects
Generating a Tcl script

regards
Alan




--
Alan Fitch
Doulos
http://www.doulos.com
 
oktem@su.sabanciuniv.edu wrote:
On Mar 5, 12:22 pm, ok...@su.sabanciuniv.edu wrote:


I put this line
project set "Generics, Parameters" "ID=my_date" -process "Synthesize -
XST"
at the end of my tcl script so that i do not have to copy and paste it
everytime.

so now i need to undertand these import.tcl and export.tcl files.

Also im having problem with integer to binary conversion. Is there a
tcl function that I can determine the width of the output. if I
convert 3 to binary can I get an output of exactly 4 bits like this
(0011) not 2 bits (11) or 8 bits (00000011) or 32 bits
(00000000000000000000000000000011)
You need format - see this page

http://tmml.sourceforge.net/doc/tcl/format.html

regards
Alan

P.S. I am not a Tcl expert - just to warn you...


--
Alan Fitch
Doulos
http://www.doulos.com
 
On Mar 5, 3:54 pm, Alan Fitch <alan.fi...@spamtrap.com> wrote:
ok...@su.sabanciuniv.edu wrote:
On Mar 5, 12:22 pm, ok...@su.sabanciuniv.edu wrote:

I put this line
project set "Generics, Parameters" "ID=my_date" -process "Synthesize -
XST"
at the end of my tcl script so that i do not have to copy and paste it
everytime.

so now i need to undertand these import.tcl and export.tcl files.

Also im having problem with integer to binary conversion. Is there a
tcl function that I can determine the width of the output. if I
convert 3 to binary can I get an output of exactly 4 bits like this
(0011) not 2 bits (11) or 8 bits (00000011) or 32 bits
(00000000000000000000000000000011)

You need format - see this page

http://tmml.sourceforge.net/doc/tcl/format.html

regards
Alan

P.S. I am not a Tcl expert - just to warn you...

--
Alan Fitch
Douloshttp://www.doulos.com
Thank you Alan. It is very much appreciated.


Serkan
 

Welcome to EDABoard.com

Sponsor

Back
Top