Commit e7c32869 authored by Christian Fibich's avatar Christian Fibich Committed by Stefan Tauner
Browse files

Added Documentation

Reapplied Beautify script
parent 467b2b51
This diff is collapsed.
......@@ -18,10 +18,11 @@
#-------------------------------------------------------------------------------
## @file FIJI.pm
# @brief Contains class \ref FIJI
## @class FIJI
#
# Various constants used in the FIJI packages.
# @brief Various constants used in the FIJI packages.
package FIJI;
use Cwd;
......@@ -35,7 +36,6 @@ use constant DEFAULT_TIMER_VALUE => 1000000;
# Architecture from http://www.perlmonks.org/?node_id=1072731
#
# Fields:
#
# - ini_name key name in FIJI Settings file
# - unit (optional) physical unit
# - type (optional) enables type-specific conversions and tests:
......@@ -151,7 +151,7 @@ BEGIN {
unit => 'bytes',
values => sub {
my $val = shift;
return ( $val > 0 && $val <= 16 );
return ($val > 0 && $val <= 16);
},
group => 'general_control',
order => 20,
......@@ -177,8 +177,8 @@ BEGIN {
default => 0x2D,
type => 'hexadecimal',
values => sub {
my $val = shift; # FIXME: depends on LFSR_WIDTH
return $val > 0 && $val <= ( 2**64 - 1 );
my $val = shift; # @FIXME: depends on LFSR_WIDTH
return $val > 0 && $val <= (2**64 - 1);
},
group => 'lfsr',
order => 20,
......@@ -190,8 +190,8 @@ BEGIN {
default => 0xCAFE,
type => 'hexadecimal',
values => sub {
my $val = shift; # FIXME: depends on LFSR_WIDTH
return $val >= 0 && $val <= ( 2**64 - 1 );
my $val = shift; # @FIXME: depends on LFSR_WIDTH
return $val >= 0 && $val <= (2**64 - 1);
},
group => 'lfsr',
order => 30,
......@@ -451,7 +451,13 @@ BEGIN {
use constant \%designmap;
use constant DESIGNMAP => \%designmap;
#** @var public %displaygroups Hash containing groups for displaying \ref designmap
##
# Fields:
# -title Just a short title
# -subtitle ...
# -description Longer description
# -order The sorting order to display this group
my %displaygroups;
BEGIN {
......@@ -509,6 +515,24 @@ BEGIN {
use constant \%displaygroups;
use constant DISPLAYGROUPS => \%displaygroups;
## @var public %fiumap Hash containing all FIJI::Settings for FIUs
#
# Fields:
# - ini_name key name in FIJI Settings file
# - unit (optional) physical unit
# - type (optional) enables type-specific conversions and tests:
# - natural: values must be oct, hex, binary strings looking like a real number.
# - hexadecimal: values must be hexadecimal numbers.
# - boolean: will be convert to a truth value by Perl semantics
# - net: name of a net from the input netlist
# - values (optional) used to restrict valid values. Can be...
# - an array reference listing all valid values (emulates an enum)
# - a code reference to a function that gets the new and old values and
# returns true if the new value is allowed, or false otherwise.
# - phases_opt (optional) list of phases (subset of "setup", "instrument", "download")
# where no value must be present in input (e.g. ID is only necessary while downloading).
# - group (optional) specifies how to group this value in output. Value will not be displayed if undef
# - default (optional) default value if not given in file and not determinable otherwise
my %fiumap;
BEGIN {
......@@ -547,6 +571,34 @@ BEGIN {
use constant \%fiumap;
use constant FIUMAP => \%fiumap;
#** @var public %testconstmap Hash containing all global values of FIJI::Tests
#
# Fields:
# - ini_name key name in FIJI Tests file
# - unit (optional) physical unit
# - type (optional) enables type-specific conversions and tests:
# - natural: values must be oct, hex, binary strings looking like a real number.
# - hexadecimal: values must be hexadecimal numbers.
# - boolean: will be convert to a truth value by Perl semantics
# - net: name of a net from the input netlist
# - values (optional) used to restrict valid values. Can be...
# - an array reference listing all valid values (emulates an enum)
# - a code reference to a function that gets the new and old values and
# returns true if the new value is allowed, or false otherwise.
# - phases_opt (optional) list of phases (subset of "setup", "instrument", "download")
# where no value must be present in input (e.g. ID is only necessary while downloading).
# - gui_modes (optional) specifies in which mode of {manual,auto,random} this key will be displayed in the GUI
# - depends_on (optional) specifies the key of another constant.
# The respective constant is only relevant (and thuse required as input)
# if the value of the referenced constant is true.
# - group (optional) specifies how to group this value in output. Value will not be displayed if undef
# - order (optional) specifies how to sort this value in output group
# - noedit (optional) display value, but don't allow to alter
# - default (optional) default value if not given in file and not determinable otherwise
# - help (optional) short help text, e.g. to be displayed via Tk:Balloon
# - forbidden_by (optional) specifies the key of another constant
# The respective constant may not be enabled if the value
# of the referenced constant is true
my %testconstmap;
BEGIN {
......@@ -726,6 +778,12 @@ BEGIN {
use constant \%testconstmap;
use constant TESTCONSTMAP => \%testconstmap;
## @var public %testguimodes Hash containing modes for displaying \ref testconstmap
#
# Fields:
#
# -title Just a short title
# -description Longer description
my %testguimodes;
BEGIN {
......@@ -747,6 +805,15 @@ BEGIN {
use constant \%testguimodes;
use constant TESTGUIMODES => \%testguimodes;
## @var public %testpatmap Base values for each test in FIJI::Tests
#
# Fields:
# - ini_name key name in FIJI Settings file
# - values (optional) used to restrict valid values. Can be...
# - an array reference listing all valid values (emulates an enum)
# - a code reference to a function that gets the new and old values and
# returns true if the new value is allowed, or false otherwise.
# - default (optional) default value if not given in file and not determinable otherwise
my %testpatmap;
BEGIN {
......@@ -767,6 +834,8 @@ BEGIN {
use constant \%testpatmap;
use constant TESTPATMAP => \%testpatmap;
## @var public %fiuenum Assigns integer fault ID to textual ID
#
my %fiuenum;
BEGIN {
......@@ -783,28 +852,37 @@ BEGIN {
use constant \%fiuenum;
use constant FIUENUM => \%fiuenum;
## @function public REVERSE_FIU_ENUM ($val)
# @brief Assigns textual names to integer fault IDs
# makes use of \ref fiuenum
#
# @param val the textual ID of the Fault
sub REVERSE_FIU_ENUM {
my ($val) = @_;
for my $k ( keys(%fiuenum) ) {
if ( $fiuenum{$k} == $val ) {
for my $k (keys(%fiuenum)) {
if ($fiuenum{$k} == $val) {
return $k;
}
}
return "NONE";
}
use constant { HOST_TO_FIC_LATENCY => 1.0e-3 }; # 1 ms minimum latency
use constant {HOST_TO_FIC_LATENCY => 1.0e-3}; # 1 ms minimum latency
## @function ini2constkey ($ini_name, %$map_ref)
#
# Allows to retrieve the reversal of the mapping established by the
# ini_name fields, i.e. get the FIJI Settings name from (the external
# representation, that is) the name used in the .ini file.
#
# @param ini_name The name of the ini key to retrieve
# @param map_ref Reference to the map (\ref designmap etc. to use)
sub ini2constkey {
my ( $ini_name, $map_ref ) = @_;
my ($ini_name, $map_ref) = @_;
$map_ref = DESIGNMAP if !defined($map_ref);
foreach my $k ( keys %{$map_ref} ) {
if ( $ini_name eq $map_ref->{$k}->{'ini_name'} ) {
foreach my $k (keys %{$map_ref}) {
if ($ini_name eq $map_ref->{$k}->{'ini_name'}) {
return $k;
}
}
......@@ -813,8 +891,8 @@ sub ini2constkey {
use base 'Exporter';
our @EXPORT = ( keys(%designmap), keys(%fiumap), keys(%testpatmap), keys(%testconstmap), keys(%fiuenum), keys(%displaygroups), keys(%testguimodes) );
our @EXPORT_OK = ( keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIUMAP', keys(%testpatmap), 'TESTPATMAP', keys(%testconstmap), 'TESTCONSTMAP', keys(%fiuenum), 'FIUENUM', 'REVERSE_FIU_ENUM', 'DISPLAYGROUPS', keys(%displaygroups), 'TESTGUIMODES', keys(%testguimodes), 'HOST_TO_FIC_LATENCY', 'DEFAULT_TIMER_VALUE' );
our @EXPORT = (keys(%designmap), keys(%fiumap), keys(%testpatmap), keys(%testconstmap), keys(%fiuenum), keys(%displaygroups), keys(%testguimodes));
our @EXPORT_OK = (keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIUMAP', keys(%testpatmap), 'TESTPATMAP', keys(%testconstmap), 'TESTCONSTMAP', keys(%fiuenum), 'FIUENUM', 'REVERSE_FIU_ENUM', 'DISPLAYGROUPS', keys(%displaygroups), 'TESTGUIMODES', keys(%testguimodes), 'HOST_TO_FIC_LATENCY', 'DEFAULT_TIMER_VALUE');
## @var @EXPORT_TAGS Export Tags
#
......
......@@ -22,7 +22,7 @@ BEGIN {
my $oldNew;
my $onWindows = 0;
if ( $^O eq 'MSWin32' ) # running on Win32
if ($^O eq 'MSWin32') # running on Win32
{
$onWindows = 1;
eval "use Win32::SerialPort";
......@@ -57,18 +57,18 @@ BEGIN {
*main::Device::SerialPort::new = sub {
my $class = shift;
my $portName = shift;
if ( $onWindows != ( $class eq 'Win32::SerialPort' ) ) {
if ($onWindows != ($class eq 'Win32::SerialPort')) {
$portName = $portMap{$portName} || $portName;
$class = $onWindows ? 'Win32::SerialPort' : 'Device::SerialPort';
}
$oldNew->( $class, $portName, @_ );
$oldNew->($class, $portName, @_);
};
# Gets and/or modifies the port mapping
# Returns a hash
sub Device::SerialPort::mapPorts {
my $self = shift;
%portMap = ( %portMap, @_ );
%portMap = (%portMap, @_);
}
}
......
This diff is collapsed.
......@@ -18,6 +18,12 @@
#
#-------------------------------------------------------------------------------
## @file Constraints.pm
# @brief Contains class \ref FIJI::Constraints
## @class FIJI::Constraints
# @brief Contains functions to generate Constraints for Synthesis/P&R Tools
package FIJI::Constraints;
use strict;
......@@ -34,8 +40,8 @@ sub _quartus_direct_partitions_logiclock {
my $DUT_PART_NAME = "PARTITION_" . $cfg->{'dut_module'};
my $FIJI_PART_NAME = "PARTITION_" . $cfg->{'fiji_module'};
my $DUT_COLOR = ( sprintf( "%d", 0xFF0000 ) );
my $FIJI_COLOR = ( sprintf( "%d", 0x00FF00 ) );
my $DUT_COLOR = (sprintf("%d", 0xFF0000));
my $FIJI_COLOR = (sprintf("%d", 0x00FF00));
my $time = localtime;
......@@ -76,9 +82,9 @@ set_global_assignment -name LL_ORIGIN X1_Y1 -section_id $FIJI_PART_NAME
set_instance_assignment -name LL_MEMBER_OF $FIJI_PART_NAME -to $FIJI_TO -section_id $FIJI_PART_NAME
END_LOCK
if ( $cfg->{'mode'} eq "NO_OPTIMIZATION" ) {
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ( $cfg->{'mode'} eq "FIX_PLACEMENT" ) {
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning . $area;
}
return $txt . $fin;
......@@ -110,9 +116,9 @@ define_attribute {v:$DUT_NAME} altera_logiclock_location {floating}
define_attribute {v:$FIJI_NAME} altera_logiclock_location {floating}
END_LOCK
if ( $cfg->{'mode'} eq "NO_OPTIMIZATION" ) {
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ( $cfg->{'mode'} eq "FIX_PLACEMENT" ) {
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning . $area;
}
return $txt . $fin;
......@@ -128,12 +134,12 @@ sub _synplify_xise_partitions_placement {
my $area_dut = "";
my $area_fiji = "";
if ( $cfg->{'family'} =~ /^[Ss]partan/ ) {
if ($cfg->{'family'} =~ /^[Ss]partan/) {
# AREA specified in CLBs
$area_dut = "CLB_R1C1:CLB_R1C1";
$area_fiji = "CLB_R2C2:CLB_R2C2";
} elsif ( $cfg->{'family'} =~ /^[Vv]irtex/ || $cfg->{'family'} =~ /^[Zz]ync/ ) {
} elsif ($cfg->{'family'} =~ /^[Vv]irtex/ || $cfg->{'family'} =~ /^[Zz]ync/) {
# AREA specified in LUTs
$area_dut = "LUT_X1Y1:LUT_X1Y1";
......@@ -158,14 +164,15 @@ define_attribute {v:$DUT_NAME} xc_area_group {$area_dut}
define_attribute {v:$FIJI_NAME} xc_area_group {$area_fiji}
END_LOCK
if ( $cfg->{'mode'} eq "NO_OPTIMIZATION" ) {
if ($cfg->{'mode'} eq "NO_OPTIMIZATION") {
$txt .= $partitioning;
} elsif ( $cfg->{'mode'} eq "FIX_PLACEMENT" ) {
} elsif ($cfg->{'mode'} eq "FIX_PLACEMENT") {
$txt .= $partitioning . $area;
}
return $txt . $fin;
}
## @var %$toolhash stores which sub to execute for which tool
my $toolhash = {
synplify_pro => {
quartus => \&_synplify_quartus_partitions_logiclock,
......@@ -177,24 +184,24 @@ my $toolhash = {
};
sub placement_partition_constraints {
my ( $class, $synthesis_tool, $pr_tool, $cfg, $out_file ) = @_;
my ($class, $synthesis_tool, $pr_tool, $cfg, $out_file) = @_;
my $synhash = $toolhash->{$synthesis_tool};
if ( !defined $synhash ) {
if (!defined $synhash) {
return "No entries for synthesis tool found";
}
my $sub = $synhash->{$pr_tool};
if ( !defined $sub ) {
if (!defined $sub) {
print Dumper($toolhash);
return "No entries for P&R tool found";
}
my $txt = &{$sub}($cfg);
open( my $file, ">", $out_file ) or return "Cannot open file $out_file: $!";
open(my $file, ">", $out_file) or return "Cannot open file $out_file: $!";
print $file $txt;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -19,9 +19,15 @@
#
#-------------------------------------------------------------------------------
## @file
## @file VHDL.pm
# @brief Contains class \ref FIJI::VHDL
## @class FIJI::VHDL
# @brief Functions generating VHDL code
## @class FIJI::VHDL
# Contains functions to generate VHDL package and wrapper files for FIJI
# Contains enum values for marking Verilog-Perl netlist ports with userdata:
package FIJI::VHDL;
use strict;
......@@ -48,7 +54,7 @@ use enum qw(FIJI_USERDATA_PORTTYPE FIJI_USERDATA_FIU_INDEX FIJI_USERDATA_FD_INDE
use enum qw(FIJI_PORTTYPE_CLOCK FIJI_PORTTYPE_MODIFIED FIJI_PORTTYPE_ORIGINAL FIJI_PORTTYPE_FAULT_DETECTION FIJI_PORTTYPE_TRIGGER_FROM_DUT FIJI_PORTTYPE_RESET_FROM_DUT FIJI_PORTTYPE_RESET_TO_DUT);
# Default values hash for signal and instantiation names, and the trigger and reset values
my %FIJI_DEFAULTS = (
use constant FIJI_DEFAULTS => {
TX_OUT_NAME => "s_fiji_tx_o",
RX_IN_NAME => "s_fiji_rx_i",
DUT_INST_NAME => "i_DUT",
......@@ -71,9 +77,7 @@ my %FIJI_DEFAULTS = (
FIJI_FAULT_INJECTION_GEN_LABEL => "gen_fault_injection",
FIJI_NO_FAULT_INJECTION_GEN_LABEL => "gen_no_fault_injection",
);
use constant FIJI_DEFAULTS => \%FIJI_DEFAULTS;
};
## @function generate_config_package ($fiji_settings_filename, $vhdl_filename)
# @brief Generate a public_config_pkg VHDL package file for FIJI
......@@ -82,29 +86,29 @@ use constant FIJI_DEFAULTS => \%FIJI_DEFAULTS;
# \param vhdl_filename the name of the VHDL file to be generated
#
# \returns 0 if VHDL file was generated successfully.
sub generate_config_package ($$) {
my ( $class, $fiji_settings_filename, $vhdl_filename ) = @_;
sub generate_config_package {
my ($class, $fiji_settings_filename, $vhdl_filename) = @_;
my $logger = get_logger("");
my $name = $0;
$name =~ s/\.p[lm]//;
$logger->debug("=== generate_config_package ===");
$logger->debug( sprintf( "%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : "" ) );
$logger->debug(sprintf("%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : ""));
my $fiji_settings = FIJI::Settings->new( 'download', $fiji_settings_filename );
if ( !ref($fiji_settings) ) {
my $fiji_settings = FIJI::Settings->new('download', $fiji_settings_filename);
if (!ref($fiji_settings)) {
return $fiji_settings . " Aborting.\n";
}
my $fiji_consts = $fiji_settings->{'design'};
my $fius = $fiji_settings->{'fius'};
# LFSR initial value is given as a 0-padded hex number
my $lfsr_fmt = sprintf( "X\"%%0%dx\"", $fiji_consts->{'LFSR_WIDTH'} / 4 );
my $lfsr_fmt = sprintf("X\"%%0%dx\"", $fiji_consts->{'LFSR_WIDTH'} / 4);
my @fiu_configs = ();
# generate the fiu_config record contents
for ( my $i = 0 ; $i < $fiji_consts->{'FIU_NUM'} ; $i++ ) {
my $lfsr_mask = sprintf( "$lfsr_fmt", @{$fius}[$i]->{'FIU_LFSR_MASK'} );
for (my $i = 0 ; $i < $fiji_consts->{'FIU_NUM'} ; $i++) {
my $lfsr_mask = sprintf("$lfsr_fmt", @{$fius}[$i]->{'FIU_LFSR_MASK'});
my $str = <<"END_FIU";
$i => (
fault_model => @{$fius}[$i]->{'FIU_MODEL'},
......@@ -113,22 +117,22 @@ sub generate_config_package ($$) {
END_FIU
push @fiu_configs, $str;
}
my $lfsr_poly_string = sprintf( $lfsr_fmt, $fiji_consts->{'LFSR_POLY'} );
my $lfsr_seed_string = sprintf( $lfsr_fmt, $fiji_consts->{'LFSR_SEED'} );
my $lfsr_poly_string = sprintf($lfsr_fmt, $fiji_consts->{'LFSR_POLY'});
my $lfsr_seed_string = sprintf($lfsr_fmt, $fiji_consts->{'LFSR_SEED'});
# invert is given as 2-bit binary mask
# need to do this because fault detection invert can be specified even if channel is not enabled
my $invert1 = ( $fiji_consts->{'FAULT_DETECT_1_EN'} ) ? $fiji_consts->{'FAULT_DETECT_1_INVERT'} : 0;
my $invert2 = ( $fiji_consts->{'FAULT_DETECT_2_EN'} ) ? $fiji_consts->{'FAULT_DETECT_2_INVERT'} : 0;
my $fault_detect_string = sprintf( "%01d%01d", $invert2, $invert1 );
my $invert1 = ($fiji_consts->{'FAULT_DETECT_1_EN'}) ? $fiji_consts->{'FAULT_DETECT_1_INVERT'} : 0;
my $invert2 = ($fiji_consts->{'FAULT_DETECT_2_EN'}) ? $fiji_consts->{'FAULT_DETECT_2_INVERT'} : 0;
my $fault_detect_string = sprintf("%01d%01d", $invert2, $invert1);
my $fiu_configs_string = join( " ,\n", @fiu_configs );
my $vhdl_id = sprintf( "X\"%04x\"", $fiji_consts->{'ID'} );
my $fiu_configs_string = join(" ,\n", @fiu_configs);
my $vhdl_id = sprintf("X\"%04x\"", $fiji_consts->{'ID'});
my $gentime = localtime;
my $reset_dut_in_duration = ( $fiji_consts->{'RESET_DUT_IN_EN'} eq 1 ) ? $fiji_consts->{'RESET_DUT_IN_DURATION'} : 1;
my $reset_dut_in_duration = ($fiji_consts->{'RESET_DUT_IN_EN'} eq 1) ? $fiji_consts->{'RESET_DUT_IN_DURATION'} : 1;
$logger->debug( sprintf("Generating VHDL text.\n") );
$logger->debug(sprintf("Generating VHDL text.\n"));
my $vhdl = <<"END_VHDL";
--------------------------------------------------------------------------------
......@@ -223,33 +227,33 @@ $fiu_configs_string
end package public_config_pkg;
END_VHDL
$logger->debug( sprintf("Writing public config package to $vhdl_filename.\n") );
$logger->debug(sprintf("Writing public config package to $vhdl_filename.\n"));
if ( open( my $fh, ">", $vhdl_filename ) ) {
if (open(my $fh, ">", $vhdl_filename)) {
print $fh $vhdl;
close $fh;
} else {
return "Could not open file '$vhdl_filename' for writing: $!";
}
$logger->info( sprintf("Successfully generated public config package for $fiji_settings_filename in $vhdl_filename.\n") );
$logger->info(sprintf("Successfully generated public config package for $fiji_settings_filename in $vhdl_filename.\n"));
$logger->trace("=== Stopping execution ===");
return undef;
}
## @function generate_wrapper_module ($wrapper_config)
## @function generate_wrapper_module (%$wrapper_config)
# @brief Generate a VHDL wrapper module instantiating FIJI logic and the DUT
#
# \param $wrapper_config a configuration hash ref.
# \param wrapper_config a configuration hash ref.
# -> {'netlist'} the Verilog-Perl netlist file
# -> {'dut_toplevel_module_name'} the toplevel module in the vqm netlist
# -> {'fiji_settings_filename'} the path to the fiji.cfg file
# -> {'vhdl_filename'} the VHDL file to be generated
#
# \returns 0 if VHDL file was generated successfully.
sub generate_wrapper_module ($) {
my ( $class, $wrapper_config ) = @_;
sub generate_wrapper_module {
my ($class, $wrapper_config) = @_;
my $vqm_netlist = $wrapper_config->{'netlist'};
my $dut_toplevel = $wrapper_config->{'dut_toplevel_module_name'};
......@@ -260,10 +264,10 @@ sub generate_wrapper_module ($) {
my $name = $0;
$name =~ s/\.p[lm]//;
$logger->debug("=== generate_wrapper_module ===");
$logger->debug( sprintf( "%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : "" ) );
$logger->debug(sprintf("%d argument(s)%s", scalar(@_), scalar(@_) > 0 ? ": @_" : ""));
my $fiji_settings = FIJI::Settings->new( 'download', $fiji_settings_filename );
if ( !ref($fiji_settings) ) {
my $fiji_settings = FIJI::Settings->new('download', $fiji_settings_filename);
if (!ref($fiji_settings)) {
return $fiji_settings . " Aborting.";
}
my $fiji_consts = $fiji_settings->{'design'};
......@@ -271,25 +275,25 @@ sub generate_wrapper_module ($) {
$logger->debug("=== Assigning values ===");
my $tx_name = ( defined $fiji_consts->{'TX_OUT_NAME'} ) ? $fiji_consts->{'TX_OUT_NAME'} : $FIJI_DEFAULTS{'TX_OUT_NAME'};
my $rx_name = ( defined $fiji_consts->{'RX_IN_NAME'} ) ? $fiji_consts->{'RX_IN_NAME'} : $FIJI_DEFAULTS{'RX_IN_NAME'};
my $tx_name = (defined $fiji_consts->{'TX_OUT_NAME'}) ? $fiji_consts->{'TX_OUT_NAME'} : FIJI_DEFAULTS->{'TX_OUT_NAME'};
my $rx_name = (defined $fiji_consts->{'RX_IN_NAME'}) ? $fiji_consts->{'RX_IN_NAME'} : FIJI_DEFAULTS->{'RX_IN_NAME'};
my $dut_inst_name = ( defined $fiji_consts->{'DUT_INST_NAME'} ) ? $fiji_consts->{'DUT_INST_NAME'} : $FIJI_DEFAULTS{'DUT_INST_NAME'};
my $fiji_inst_name = ( defined $fiji_consts->{'FIJI_INST_NAME'} ) ? $fiji_consts->{'FIJI_INST_NAME'} : $FIJI_DEFAULTS{'FIJI_INST_NAME'};
my $wrapper_name = ( defined $fiji_consts->{'FIJI_WRAPPER_NAME'} ) ? $fiji_consts->{'FIJI_WRAPPER_NAME'} : $FIJI_DEFAULTS{'FIJI_WRAPPER_NAME'};
my $dut_inst_name = (defined $fiji_consts->{'DUT_INST_NAME'}) ? $fiji_consts->{'DUT_INST_NAME'} : FIJI_DEFAULTS->{'DUT_INST_NAME'};
my $fiji_inst_name = (defined $fiji_consts->{'FIJI_INST_NAME'}) ? $fiji_consts->{'FIJI_INST_NAME'} : FIJI_DEFAULTS->{'FIJI_INST_NAME'};
my $wrapper_name = (defined $fiji_consts->{'FIJI_WRAPPER_NAME'}) ? $fiji_consts->{'FIJI_WRAPPER_NAME'} : FIJI_DEFAULTS->{'FIJI_WRAPPER_NAME'};
# assign some defaults
my $fiji_clock_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_CLOCK_SIGNAL_NAME'};
my $fiji_original_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_ORIGINAL_SIGNAL_NAME'};
my $fiji_modified_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_MODIFIED_SIGNAL_NAME'};
my $fiji_fault_detection_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_FAULT_SIGNAL_NAME'};
my $fiji_trigger_from_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_TRIGGER_DUT_SIGNAL_NAME'};
my $fiji_trigger_ext_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_TRIGGER_EXT_SIGNAL_NAME'};
my $fiji_reset_from_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME'};
my $fiji_reset_to_dut_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME'};
my $fiji_reset_ext_signal_name = $FIJI_DEFAULTS{'FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME'};
my $gen_fault_injection_label = $FIJI_DEFAULTS{'FIJI_FAULT_INJECTION_GEN_LABEL'};
my $gen_no_fault_injection_label = $FIJI_DEFAULTS{'FIJI_NO_FAULT_INJECTION_GEN_LABEL'};
my $fiji_clock_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_CLOCK_SIGNAL_NAME'};
my $fiji_original_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_ORIGINAL_SIGNAL_NAME'};
my $fiji_modified_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_MODIFIED_SIGNAL_NAME'};
my $fiji_fault_detection_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_FAULT_SIGNAL_NAME'};
my $fiji_trigger_from_dut_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_TRIGGER_DUT_SIGNAL_NAME'};
my $fiji_trigger_ext_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_TRIGGER_EXT_SIGNAL_NAME'};
my $fiji_reset_from_dut_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_RESET_FROM_DUT_SIGNAL_NAME'};
my $fiji_reset_to_dut_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_RESET_TO_DUT_SIGNAL_NAME'};
my $fiji_reset_ext_signal_name = FIJI_DEFAULTS->{'FIJI_WRAPPER_RESET_EXT_SIGNAL_NAME'};
my $gen_fault_injection_label = FIJI_DEFAULTS->{'FIJI_FAULT_INJECTION_GEN_LABEL'};
my $gen_no_fault_injection_label = FIJI_DEFAULTS->{'FIJI_NO_FAULT_INJECTION_GEN_LABEL'};
my $trigger_ext_assignment = "not(c_trigger_ext_active)";
my $reset_ext_assignment = "not(c_reset_ext_active)";
......@@ -297,8 +301,8 @@ sub generate_wrapper_module ($) {
my $vqm_toplevel_module = $vqm_netlist->find_module($dut_toplevel);
# check inputs
return "Toplevel module $dut_toplevel not found.\n" if ( !defined $vqm_toplevel_module );
return "Module $dut_toplevel is not at the top level.\n" unless ( $vqm_toplevel_module->is_top );
return "Toplevel module $dut_toplevel not found.\n" if (!defined $vqm_toplevel_module);
return "Module $dut_toplevel is not at the top level.\n" unless ($vqm_toplevel_module->is_top);
# create lists for vhdl declarations and maps
my @ext_ports = ();
......@@ -311,15 +315,15 @@ sub generate_wrapper_module ($) {
push @ext_ports, $tx_name . ": out std_logic";
push @ext_ports, $rx_name . ": in std_logic";
if ( $fiji_consts->{'RESET_EXT_EN'} ) {
my $re_base = ( defined $fiji_consts->{'RESET_EXT_IN_NAME'} ) ? $fiji_consts->{'RESET_EXT_IN_NAME'} : $FIJI_DEFAULTS{'RESET_EXT_IN_NAME'};
my $re_suffix = ( $fiji_consts->{'RESET_EXT_ACTIVE'} == 0 ) ? "_n" : "";
if ($fiji_consts->{'RESET_EXT_EN'}) {
my $re_base = (defined $fiji_consts->{'RESET_EXT_IN_NAME'}) ? $fiji_consts->{'RESET_EXT_IN_NAME'} : FIJI_DEFAULTS->{'RESET_EXT_IN_NAME'};
my $re_suffix = ($fiji_consts->{'RESET_EXT_ACTIVE'} == 0) ? "_n" : "";
push @ext_ports, $re_base . $re_suffix . "_i : in std_logic";
$reset_ext_assignment = $re_base . $re_suffix . "_i";
}
if ( $fiji_consts->{'TRIGGER_EXT_EN'} ) {
my $te_base = ( defined $fiji_consts->{'TRIGGER_EXT_IN_NAME'} ) ? $fiji_consts->{'TRIGGER_EXT_IN_NAME'} : $FIJI_DEFAULTS{'TRIGGER_EXT_IN_NAME'};
my $te_suffix = ( $fiji_consts->{'TRIGGER_EXT_ACTIVE'} == 0 ) ? "n" : "";
if ($fiji_consts->{'TRIGGER_EXT_EN'}) {
my $te_base = (defined $fiji_consts->{'TRIGGER_EXT_IN_NAME'}) ? $fiji_consts->{'TRIGGER_EXT_IN_NAME'} : FIJI_DEFAULTS->{'TRIGGER_EXT_IN_NAME'};
my $te_suffix = ($fiji_consts->{'TRIGGER_EXT_ACTIVE'} == 0) ? "n" : "";
push @ext_ports, $te_base . $te_suffix . "_i : in std_logic";
$trigger_ext_assignment = $te_base . $te_suffix . "_i";
}
......@@ -327,10 +331,10 @@ sub generate_wrapper_module ($) {
# add divider
push @ext_ports, "--", "-- DUT ports", "--";
# FIXME: Verilog-Perl bug
# @FIXME: Verilog-Perl bug
# using ->ports_sorted instead of ->ports_ordered here because verilog-perl only
# updates ports_sorted when using ->new_port.
foreach my $port ( $vqm_toplevel_module->ports_sorted ) {
foreach my $port ($vqm_toplevel_module->ports_sorted) {
# retrieve userdata from netlist
my $fiji_porttype = $port->userdata(FIJI_USERDATA_PORTTYPE);
......@@ -338,44 +342,44 @@ sub generate_wrapper_module ($) {
my $fd_idx = $port->userdata(FIJI_USERDATA_FD_INDEX);
# add to ports of vhdl component definition
push @dut_comp_ports, ( ( $port->name ) . " : " . ( $port->direction ) . " " . ( port2vhdtype($port) ) );
push @dut_comp_ports, (($port->name) . " : " . ($port->direction) . " " . (port2vhdtype($port)));