Man kann Quartus (durch eine Zeile im .qsf-File) dazu bringen, bei jedem
Syntheselauf automatisch ein .tcl-Script auszuführen:
1 | set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:make_datetime.tcl"
|
Bei mir läuft da das hier:
1 | # Make datetime.vhd package from Tcl script
|
2 |
|
3 | # Current date, time, and seconds since epoch
|
4 | # Array index 0 1 2 3 4 5 6
|
5 | set datetime_arr [clock format [clock seconds] -format {%Y %m %d %H %M %S %s}]
|
6 |
|
7 | # Write VHDL package
|
8 | set filename datetime.vhd
|
9 | set file [open $filename w]
|
10 | puts $file "library ieee;"
|
11 | puts $file "use ieee.std_logic_1164.all;"
|
12 | puts $file ""
|
13 | puts $file "package datetime is"
|
14 | puts $file " -- Date information"
|
15 | puts $file " constant YEAR_INT : integer := [lindex $datetime_arr 0];"
|
16 | puts $file " constant YEAR_HEX : std_ulogic_vector(15 downto 0) := X\"[lindex $datetime_arr 0]\";"
|
17 | puts $file " constant MONTH_INT : integer := [lindex $datetime_arr 1];"
|
18 | puts $file " constant MONTH_HEX : std_ulogic_vector(7 downto 0) := X\"[lindex $datetime_arr 1]\";"
|
19 | puts $file " constant DAY_INT : integer := [lindex $datetime_arr 2];"
|
20 | puts $file " constant DAY_HEX : std_ulogic_vector(7 downto 0) := X\"[lindex $datetime_arr 2]\";"
|
21 | puts $file " constant DATE_HEX : std_ulogic_vector(31 downto 0) := YEAR_HEX & MONTH_HEX & DAY_HEX;"
|
22 | puts $file " -- Time information"
|
23 | puts $file " constant HOUR_INT : integer := [lindex $datetime_arr 3];"
|
24 | puts $file " constant HOUR_HEX : std_ulogic_vector(7 downto 0) := X\"[lindex $datetime_arr 3]\";"
|
25 | puts $file " constant MINUTE_INT : integer := [lindex $datetime_arr 4];"
|
26 | puts $file " constant MINUTE_HEX : std_ulogic_vector(7 downto 0) := X\"[lindex $datetime_arr 4]\";"
|
27 | puts $file " constant SECOND_INT : integer := [lindex $datetime_arr 5];"
|
28 | puts $file " constant SECOND_HEX : std_ulogic_vector(7 downto 0) := X\"[lindex $datetime_arr 5]\";"
|
29 | puts $file " constant TIME_HEX : std_ulogic_vector(31 downto 0) := X\"00\" & HOUR_HEX & MINUTE_HEX & SECOND_HEX;"
|
30 | puts $file " -- Miscellaneous information"
|
31 | puts $file " constant EPOCH_INT : integer := [lindex $datetime_arr 6]; -- Seconds since 1970-01-01_00:00:00"
|
32 | puts $file "end package;"
|
33 | close $file
|
Das .tcl-Script erzeugt ein .vhdl package, das Datum und Uhrzeit der
Synthese zur Verfügung stellt.