FPGARelated.com
Forums

Re: writing current date to a register

Started by Andreas Ehliar March 4, 2009
On 2009-03-04, oktem@su.sabanciuniv.edu <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 don't think there is an easy way to do this from inside ISE (although perhaps some TCL hacking could solve this?). What I do is that I use a Makefile based approach for synthesis and simulation. In this case it is fairly easy to automatically generate a file with the current date (or revision number in my case) in it which is then included at an appropriate place in the design. Otherwise you may be able to postprocess either the NCD file or the bitstream. For example, if it is enough to put the current date into a blockram you can do this using a script which uses data2mem to modify the content of the blockram. /Andreas
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?
On Mar 4, 3:42=A0am, 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?
In many of my designs, I create a parameter in an include file like parameter BUILD_EPOCH =3D 32'd0; I have Perl script I can then run then modifies the parameter line to have the current Unix style epoch value. In my design, I have a rd-only status register that returns BUILD_EPOCH to the host processor. There are lots of routines in the standard C libraries to convert the epoch value in month/day/year. I hope this helps. John Providenza
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 don't think there is a way to do this. Perhaps someone should create a plugin for Eclipsen that generates a makefile for use with the Xilinx tools. That would make these sort of things much easier since Eclipse offers support for running pre and post programs/batch files (whatever can be run). The editor would also be less crappy. -- Failure does not prove something is impossible, failure simply indicates you are not using the right tools... "If it doesn't fit, use a bigger hammer!" --------------------------------------------------------------
oktem@su.sabanciuniv.edu writes:

> 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?
Another thought - you can pass an extra param to bitgen to put the date into the USERCODE field where it can be read over JTAG by, for example, Impact. As with the others, not sure if you can do this through ISE, but I use a scripted PAR flow which makes it easy to add in. Does ISE allow "user scripts" to run during, before, or after any of its processes? C-based IDEs have had pre and post build scripts for years! Cheers, Martin -- martin.j.thompson@trw.com TRW Conekt - Consultancy in Engineering, Knowledge and Technology http://www.conekt.net/electronics.html
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 wrote:

> Actually I was not able to do it with the makefile approach since it > seems harder for me. I need a little more explanation.
Sometimes just editing a file n times is quicker than automating the process. Date and time information is already attached to the source files. This is really a job for a version control system like svn. Production is more likely concerned with release numbers, and these do not change nearly as often as builds do. -- Mike Treseler
Mike Treseler wrote:

> oktem@su.sabanciuniv.edu wrote:
>>Actually I was not able to do it with the makefile approach since it >>seems harder for me. I need a little more explanation.
> Sometimes just editing a file n times > is quicker than automating the process.
It would seem that one would want the date/time of the last make, or at least the last change to be checked in. With a manual process it is too easy to forget.
> Date and time information is already attached > to the source files. This is really a job > for a version control system like svn.
I think with make it is possible to have it remake a file each time, but I don't remember how to do it. Is there a way to have cvs or svn update the date/time on one file when any in the project is checked in? Interestingly, pretty much the same question came up yesterday on comp.lang.fortran.
> Production is more likely concerned with > release numbers, and these do not change > nearly as often as builds do.
-- glen
Glen Herrmannsfeldt wrote:

> It would seem that one would want the date/time of > the last make, or at least the last change to be > checked in.
That is what version control does. That is why I use it.
> With a manual process it is too > easy to forget.
Maybe for the OP it is better than nothing.
> Interestingly, pretty much the same question came > up yesterday on comp.lang.fortran.
Guess I've lost interest. It comes up here regularly. -- Mike Treseler
Mike Treseler wrote:

> Glen Herrmannsfeldt wrote:
>>It would seem that one would want the date/time of >>the last make, or at least the last change to be >>checked in.
> That is what version control does. > That is why I use it.
I suppose I will have to look in the CVS or SVN manual. I know it updates each file as it is checked in, but in this case one wants one file/module to contain the time/date of the last change to any other file/module. Last time I used SVN or CVS we didn't need that. -- glen