Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > writing current date to a 32 bit register

Reply
Thread Tools

writing current date to a 32 bit register

 
 
oktem@su.sabanciuniv.edu
Guest
Posts: n/a
 
      03-04-2009
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?


 
Reply With Quote
 
 
 
 
Ken Cecka
Guest
Posts: n/a
 
      03-04-2009
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
 
Reply With Quote
 
 
 
 
oktem@su.sabanciuniv.edu
Guest
Posts: n/a
 
      03-05-2009
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

 
Reply With Quote
 
oktem@su.sabanciuniv.edu
Guest
Posts: n/a
 
      03-05-2009
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.
 
Reply With Quote
 
oktem@su.sabanciuniv.edu
Guest
Posts: n/a
 
      03-05-2009
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)
 
Reply With Quote
 
oktem@su.sabanciuniv.edu
Guest
Posts: n/a
 
      03-05-2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
8 bit into 256 bit shift register Christian Vallant VHDL 8 05-23-2006 11:02 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments
 



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 47 48 49 50 51 52 53 54 55 56 57