writing current date to a 32 bit register

Discussion in 'VHDL' started by oktem@su.sabanciuniv.edu, Mar 4, 2009.

  1. 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?
     
    , Mar 4, 2009
    #1
    1. Advertising

  2. Ken Cecka Guest

    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, Mar 4, 2009
    #2
    1. Advertising

  3. Guest

    On Mar 4, 5:40 pm, Ken Cecka <> wrote:
    > 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
     
    , Mar 5, 2009
    #3
  4. Guest

    On Mar 5, 11:26 am, Alan Fitch <> wrote:
    > wrote:
    > > On Mar 4, 5:40 pm, Ken Cecka <> wrote:
    > >> 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.
     
    , Mar 5, 2009
    #4
  5. Guest

    On Mar 5, 12:22 pm, wrote:
    > On Mar 5, 11:26 am, Alan Fitch <> wrote:
    >
    >
    >
    > > wrote:
    > > > On Mar 4, 5:40 pm, Ken Cecka <> wrote:
    > > >> 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)
     
    , Mar 5, 2009
    #5
  6. Guest

    On Mar 5, 3:54 pm, Alan Fitch <> wrote:
    > wrote:
    > > On Mar 5, 12:22 pm, 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
     
    , Mar 5, 2009
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,362
    Michael Borgwardt
    May 30, 2004
  2. Christian Vallant

    8 bit into 256 bit shift register

    Christian Vallant, May 23, 2006, in forum: VHDL
    Replies:
    8
    Views:
    4,064
    Mike Treseler
    May 24, 2006
  3. Replies:
    3
    Views:
    1,850
    Timothy Bendfelt
    Jan 19, 2007
  4. Replies:
    9
    Views:
    1,048
    Juha Nieminen
    Aug 22, 2007
  5. lokesh kumar
    Replies:
    1
    Views:
    428
Loading...

Share This Page