Commit f46cdc30 authored by Stefan Tauner's avatar Stefan Tauner
Browse files

Add version information via a file

The FIJI version string is stored in the root directory on file VERSION.
This is used in the following places:
 - doxygen uses it as PROJECT_NUMBER (passed as an environment
   variable set by the docs/makefile picked up by the doxyfile)
 - FIJI.pm defines and exports a FIJI_VERSION constant
 - FIJIUtils.pm inserts it for all occurrances of $FIJI_VERSION$ in the about text
 - the UG and TRM show it on their cover pages
 - FIJI/VHDL.pm, Constraints.pm, Netlist.pm put it in all generated files
   (additionally also the design ID is printed where it wasn't before)
 - all "executables" report it in the first log message
parent ab15755b
0.9
\ No newline at end of file
......@@ -51,6 +51,23 @@ use constant FIJI_MEDIA_PATH => realpath(
)
);
my $version;
BEGIN {
local $/ = undef;
my $version_file = File::Spec->rel2abs(
File::Spec->catfile(
"..",
"VERSION",
),
$FindBin::Bin
);
open FILE, $version_file or die "Couldn't open VERSION file: $!";
$version = <FILE>;
close FILE;
};
use constant FIJI_VERSION => $version;
my @optimization_settings = qw(ALLOW OPT_OFF FIX_PLACEMENT);
use constant OPTIMIZATION_SETTINGS => \@optimization_settings;
......@@ -1215,6 +1232,7 @@ our @EXPORT = (keys(%designmap),
our @EXPORT_OK = ('FIJI_DOCUMENTATION_PATH',
'FIJI_MEDIA_PATH',
'FIJI_VERSION',
'FIJI_DIR',
'FIJI_LOGO',
keys(%designmap),
......@@ -1247,6 +1265,7 @@ our %EXPORT_TAGS = (
all => \@EXPORT_OK,
default => \@EXPORT,
%EXPORT_TAGS = (
fiji_version => ['FIJI_VERSION'],
fiji_dir => ['FIJI_DIR'],
fiji_documentation_path => ['FIJI_DOCUMENTATION_PATH'],
fiji_media_path => ['FIJI_MEDIA_PATH'],
......
......@@ -26,6 +26,8 @@ use warnings;
use Log::Log4perl qw(get_logger);
use FIJI qw(:fiji_version);
sub _quartus_partitions_logiclock {
my $logger = get_logger("");
my $cfg = shift;
......@@ -39,11 +41,16 @@ sub _quartus_partitions_logiclock {
my $FIJI_COLOR = (sprintf("%d", 0x00FF00));
my $time = localtime;
my $fiji_version = FIJI_VERSION;
my $design_id = sprintf("0x%04x", $cfg->{'id'});
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Physical Placement Constraints File for Quartus II
# Generated: $time
#
# Generated at $time
# by FIJI $fiji_version
# for Design ID $design_id
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
......@@ -96,11 +103,16 @@ sub _synplify_optimizations {
my $FIJI_NAME = $cfg->{'fiji_module'};
my $time = localtime;
my $fiji_version = FIJI_VERSION;
my $design_id = sprintf("0x%04x", $cfg->{'id'});
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Constraints File for Synplify
# Generated: $time
#
# Generated at $time
# by FIJI $fiji_version
# for Design ID $design_id
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
......@@ -135,10 +147,15 @@ sub _vivado_pblocks {
my $time = localtime;
my $fiji_version = FIJI_VERSION;
my $design_id = sprintf("0x%04x", $cfg->{'id'});
my $txt = <<"END_HDR";
# ------------------------------------------------------------------------------
# FIJI Constraints File for Vivado
# Generated: $time
#
# Generated at $time
# by FIJI $fiji_version
# for Design ID $design_id
# ------------------------------------------------------------------------------
END_HDR
my $fin = "# EOF";
......
......@@ -35,7 +35,7 @@ use Verilog::Netlist 99.427;
use Verilog::Language 99.427;
use FIJI::VHDL;
use FIJI qw(:fiji_logo);
use FIJI qw(:fiji_logo :fiji_version);
use constant HIERSEP => "/";
use constant EQUALSEP => "=";
......@@ -1296,8 +1296,9 @@ sub export {
print $fh_nl (FIJI_LOGO =~ s/^/\/\/ /mgr);
print $fh_nl "//\n";
print $fh_nl "//------------------------------------------------------------------------------\n";
print $fh_nl "// Generated " . localtime() . " by " . basename($0) . "\n";
print $fh_nl "// Netlist ID: 0x" . sprintf("%04x", $id) . "\n" if defined $id;
print $fh_nl "// Generated at " . localtime() . "\n";
print $fh_nl "// by FIJI " . FIJI_VERSION . "\n";
print $fh_nl "// for Design ID " . sprintf("0x%04x", $id) . "\n" if defined $id;
print $fh_nl "//------------------------------------------------------------------------------\n\n";
for my $mod ($self->{'nl'}->modules) {
......
......@@ -29,6 +29,7 @@ use strict;
use warnings;
use Log::Log4perl qw(get_logger);
use POSIX qw(ceil);
use FIJI qw(:fiji_version);
use FIJI::Settings;
# FIJI_USERDATA_xxx is intended as key for the port->userdata{} hash
......@@ -124,6 +125,8 @@ END_FIU
my $fiu_configs_string = join(" ,\n", @fiu_configs);
my $vhdl_id = sprintf("X\"%04x\"", $fiji_consts->{'ID'});
my $gentime = localtime;
my $fiji_version = FIJI_VERSION;
my $design_id = sprintf("0x%04x", $fiji_consts->{'ID'});
my $reset_dut_in_duration = ($fiji_consts->{'RST_DUT_IN_EN'} eq 1) ? $fiji_consts->{'RST_DUT_IN_DUR'} : 1;
......@@ -141,7 +144,10 @@ END_FIU
-- --
--------------------------------------------------------------------------------
-- File: $vhdl_filename
-- Generated: $gentime
--
-- Generated at $gentime
-- by FIJI version $fiji_version
-- for Design ID $design_id
--
-- Description:
-- Public config package for $fiji_settings_filename
......@@ -377,6 +383,8 @@ sub generate_wrapper_module {
my $dut_port_maps_vhdl = join(",\n ", @dut_port_maps);
my $gentime = localtime;
my $fiji_version = FIJI_VERSION;
my $design_id = sprintf("0x%04x", $fiji_consts->{'ID'});
# generate VHDL wrapper text
my $vhdl = <<"END_VHDL";
......@@ -392,6 +400,8 @@ sub generate_wrapper_module {
---------------------------------------------------------------------------------
--
-- FIJI Wrapper generated at $gentime
-- by FIJI version $fiji_version
-- for Design ID $design_id
-- Options:
-- toplevel = "$dut_toplevel"
-- inst_name = "$dut_inst_name"
......
......@@ -8,7 +8,7 @@ use Tk::Photo;
use Tk::FIJIModalDialog;
use Log::Log4perl qw(get_logger);
use FIJI qw(:fiji_dir :fiji_documentation_path :fiji_media_path);
use FIJI qw(:fiji_version :fiji_dir :fiji_documentation_path :fiji_media_path);
my $about_file = File::Spec->catdir(FIJI_MEDIA_PATH, "about.txt");
my $about_text;
use constant SCROLL => 5;
......@@ -170,6 +170,7 @@ sub show_about {
}{
local $/;
$about_text = <$about_fh>;
$about_text =~ s/\$FIJI_VERSION\$/${\FIJI_VERSION}/g;
}
close($about_fh);
}
......
......@@ -32,6 +32,7 @@ use Log::Log4perl::Appender::String;
use FIJI::Downloader;
use FIJI::Utils;
use FIJI qw(:fiji_version);
use File::Basename;
use Getopt::Long qw(:config no_ignore_case bundling);
use POSIX qw(strftime);
......@@ -54,7 +55,8 @@ sub main {
my $name = $0;
$name =~ s/\.p[lm]//;
$logger->info("=== Starting new execution of $name ===");
my $fiji_version = FIJI_VERSION;
$logger->info("=== Starting new execution of $name $fiji_version ===");
$logger->info(sprintf("%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : ""));
my ($cfg,$prob,$dur) = @_;
......
......@@ -52,7 +52,7 @@ use Pod::Usage;
# undef => classic+menu GUI
use constant USE_MENU => undef;
use FIJI qw(:default :fiji_dir);
use FIJI qw(:default :fiji_dir :fiji_version);
use FIJI::Tests;
use FIJI::Downloader;
use Tk::FIJITestsViewer;
......@@ -191,7 +191,8 @@ sub main {
my $ret = 0;
my $verbosity_delta = 0;
$name =~ s/\.p[lm]//;
$logger->info("=== Starting new execution of $name ===");
my $fiji_version = FIJI_VERSION;
$logger->info("=== Starting new execution of $name $fiji_version ===");
$logger->info(sprintf("%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : ""));
my ($settings_filename, $tests_filename, $help);
......
......@@ -412,6 +412,7 @@ sub main {
$rv = FIJI::Constraints->generate_constraints(
$settings_ref->{'design'}->{'SYNTHESIS_TOOL'},
$settings_ref->{'design'}->{'IMPL_TOOL'}, {
id => $id,
dut_module => $toplevel_module->name,
fiji_module => $wrapper_name,
dut_inst => $dut_inst_name,
......
......@@ -41,7 +41,7 @@ use Time::HiRes qw(ualarm);
use Pod::Usage;
use Getopt::Long qw(:config bundling);
use FIJI qw(:fiji_dir :fiji_documentation_path);
use FIJI qw(:fiji_dir :fiji_documentation_path :fiji_version);
## @var USE_MENU defines control style of fiji_settings:
# 0 => classic, no menu GUI
......@@ -76,7 +76,8 @@ sub main {
my @ARGV = @_;
my $verbosity_delta = 0;
$name =~ s/\.p[lm]//;
$logger->info("=== Starting new execution of $name ===");
my $fiji_version = FIJI_VERSION;
$logger->info("=== Starting new execution of $name $fiji_version ===");
$logger->info(sprintf("%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : ""));
my ($settings_filename, $netlist_filename, $help);
......
......@@ -24,7 +24,7 @@ UG_OUT := $(UG_MAIN).pdf
TRM_OUT := $(TRM_MAIN).pdf
DOXYGEN_OUT := $(DOXYGEN_DIR)html/index.html
DOXYGEN_PREREQS := $(shell find $(FIJI_BIN_DIR) '(' -iname '*.pm' -o -iname '*.pl' ')') ../media/fiji_logo_56x56.png $(DOXYFILE)
DOXYGEN_PREREQS := $(shell find $(FIJI_BIN_DIR) '(' -iname '*.pm' -o -iname '*.pl' ')') ../media/fiji_logo_56x56.png ../VERSION $(DOXYFILE)
all: ug trm doxygen
......@@ -67,7 +67,7 @@ $(TRM_OUT): $(UG_DIR)$(UG_MAIN).aux
doxygen: $(DOXYGEN_OUT)
$(DOXYGEN_OUT): $(DOXYGEN_PREREQS)
@doxygen $(DOXYFILE)
@FIJI_VERSION=$(shell cat ../VERSION) doxygen $(DOXYFILE)
.PHONY = all view view-ug view-trm view-doxygen clean clean-ug clean-trm ug trm doxygen
......@@ -2,7 +2,7 @@
\externaldocument[UG:]{../user_guide/fiji_user_guide}[fiji_user_guide.pdf]
\def\title{FIJI Technical Reference Manual}
\def\title{Technical Reference Manual for FIJI \input{../../VERSION}}
\begin{document}
\label{first_page}
......
\input{../tex_common/header.tex}
\def\title{FIJI User Guide}
\def\title{User Guide for FIJI \input{../../VERSION}}
\externaldocument[TRM:]{../technical_reference_manual/fiji_trm}[fiji_trm.pdf]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment