- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'd like some automatic way of putting a build or release or version number into my design so that I can check what version a given PCB is programmed with. Can anyone suggest how to do this?
I've done this in 'C' by running a batch file as part of a build before doing the compile. The batch file generates a header file that I can# include and consists of a# define statement for the revision number. My first proble is that I don't know how to add a pre-build operation in Quartus. My second problem is that I don't know how to do a# include in VHDL. I guess I could write the whole VHDL in my batch file.Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have PRE_FLOW_SCRIPT_FILE and POST_FLOW_SCRIPT_FILE in Quartus, see examples in Quartus Software Handbook. Writing VHDL text (a package) in tcl seems to be the best way to place the information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
http://www.alteraforum.com/forum/showthread.php?t=1925&highlight=timestamp
That one is verilog, but I believe others have done VHDL.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use a generic or parameter in your top-level design, and then set the generic via a Tcl script;
# Build timestamp# - Tcl returns the same as
set timestamp
puts " - Build timestamp ($timestamp 0x)"
# Generics
set_parameter -name TIMESTAMP $timestamp
Cheers, Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks guys, the timestamp script looks to be my best way forward. I'd rather go with my Subversion revision number, but a timestamp is a reasonable substitute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- Thanks guys, the timestamp script looks to be my best way forward. I'd rather go with my Subversion revision number, but a timestamp is a reasonable substitute. --- Quote End --- In CVS you can use a tag in the Tcl, e.g., I think something like the following set revision_string "$$Revision : $$" which gets re-written during CVS checkin as set revision_string "$$Revision : 1.23 $$" After CVS checkin of the script, you could then parse the string to extract a version number, and then convert that into your register values. You could probably do the same for SVN too. However, the pain with this approach is that specific file never really changes, so the string never updates. I personally use a design version register with a value I manually update, and a build time register. Cheers, Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It doesn't really work with SVN because the SVN revision number is the file's revision, not the tree's. So if you don't modify the tcl script itself, it will keep an old revision number. Most SVN installations have a utility that can be used to get the highest SVN revision number in a whole tree though, and it should be possible to call it from the tcl script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My other suggestion is to write a script that places day, month, year, and version into RAM and then these RAM contents are read via USB/Serial interface. While many have suggested using TCL, my preference is to use Python and automatically generate the entire VHDL (or Verilog) code for this portion of the design.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page