Quartus: Datum der Synthese ins FPGA (Verilog)

OP #5423500
Lesenswert?

In Xilinx Vivado Zynq gehts so:
1
wire [31:0] TimeAndDate ;
2
USR_ACCESSE2 mUsrAccess ( .DATA ( TimeAndDate ), .CFGCLK (), .DATAVALID () );
3

4
//Nicht vergessen: im XDC file:
5
// set_property BITSTREAM.CONFIG.USR_ACCESS TIMESTAMP [current_design]

Mir wärs lieb, wenn  ich ohne "externe" Scripten auskommen würde.
Das Datum/Uhrzeit sollte am besten einfach als Bitvektor verfügbar sein.
#5423914
Lesenswert?

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.
Gast #5424220
Lesenswert?

Es reicht nicht, dass "VHDL das kann". Es muss ein Mechanismus her, der 
die Compilezeit in den CODE bringt und zwar an eine Stelle, die vom user 
her auslesbar ist.

Wir verwenden SUBVERSION, um einen Sting in einem RAM ab zulegen. Der 
ist vom user auslesbar. Das wird in VHDL sicher auch irgendwie gehen.
Gast #5424243
Lesenswert?

Hier wird auch per Skript bzw. Makefile eine entsprechende VHDL-Datei 
erstellt:
1
package version is
2

3
    constant version_time : string( 1 to 21) := "Dec  6 2017  11:51:33";
4
    constant svnrevision  : string( 1 to 21) := "7151                 ";
5

6
end package version;

Duke

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren