Date2HDL

Simple utility to add a Date String to a VHDL or Verilog file

 

Date2HDL is a very simple find & replace utility which adds the current date to a Verilog 'define or VHDL std_logic_vector statement. The utility is written in TCL and can be executed using tclsh or wish.

Usage

tclsh Date2HDL <input_filename> <output_filename> or
wish Date2HDL <input_filename> <output_filename>

Windows only (executable version)
Date2HDL <input_filename> <output_filename> 

How does it work?

For VHDL (extention .vhd for the first argument) the utility will look for the string : "constant DATE_VECTOR_C".  It will then replace the constant value with the boolean representation of the current date. The date format is 5 bits for the day, 4 bits for the Month and another 4 bits for the year. Thus the vector is 13 bits long.

12...............8

7...............4

3..............0

Day

Month

Year

 

Example: Date 31/12/03

<input_filename.vhd> contains the line
constant DATE_VECTOR_C : std_logic_vector(12 downto 0):= "0000000000000";
<output_filename.vhd> will contain after running Date2HDL:
constant DATE_VECTOR_C : std_logic_vector(12 downto 0):= "1111111000011";

Similar operation for a Verilog file (extention .v for the first argument) except that the string "`define DATE_VECTOR_C" will be searched for.

<input_filename.v> contains the line
`define  DATE_VECTOR_C   13'b0000000000000
<output_filename.v> will contain after running Date2HDL:
`define  DATE_VECTOR_C   13'b1111111000011

Note `define and constant strings are free format, the utility will keep the same formatting (number of leading spaces) as in the original source file.

Download Utility

You can download a free TCL interpreter from the TCL Developers Exchange. I have also added an executable version of this utility incase you don't want to install the interpreter.  The executable was created with freeWrap. Make sure you run your virus scanner on this file before executing it!!