Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - writing current date to a 32 bit register

 
Thread Tools Search this Thread
Old 03-04-2009, 11:39 AM   #1
Default writing current date to a 32 bit register


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
  Reply With Quote
Old 03-04-2009, 03:40 PM   #2
Ken Cecka
 
Posts: n/a
Default Re: writing current date to a 32 bit register
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


Ken Cecka
  Reply With Quote
Old 03-05-2009, 09:07 AM   #3
oktem@su.sabanciuniv.edu
 
Posts: n/a
Default Re: writing current date to a 32 bit register
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



oktem@su.sabanciuniv.edu
  Reply With Quote
Old 03-05-2009, 10:22 AM   #4
oktem@su.sabanciuniv.edu
 
Posts: n/a
Default Re: writing current date to a 32 bit register
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.


oktem@su.sabanciuniv.edu
  Reply With Quote
Old 03-05-2009, 10:55 AM   #5
oktem@su.sabanciuniv.edu
 
Posts: n/a
Default Re: writing current date to a 32 bit register
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
  Reply With Quote
Old 03-05-2009, 02:01 PM   #6
oktem@su.sabanciuniv.edu
 
Posts: n/a
Default Re: writing current date to a 32 bit register
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


oktem@su.sabanciuniv.edu
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Register code in vhdl amirster Hardware 2 06-11-2007 03:22 PM
Cannot erase DVD-RW Terry Pinnell DVD Video 54 10-09-2005 10:14 PM
As growth slows, Hollywood faces a DVD standoff. Allan DVD Video 0 07-11-2005 02:10 PM
DVD Register Beta Testers Needed Tom Orlofsky DVD Video 1 12-22-2003 02:21 AM
Re: Nero - Writing to cache frustration John Tsalikes DVD Video 3 08-09-2003 09:01 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46