FIJI.pm 2.6 KB
Newer Older
1
## @file
2

3
## @class FIJI
4
5
6
7
#
# Various constants used in the FIJI packages.
package FIJI;

8
9
10
use strict;
use warnings;

11
12
13
# Architecture from http://www.perlmonks.org/?node_id=1072731

# Fields:
14
#   ini_name = key name in FIJI Settings file
15
16
#   is_numeric = (optional) enables conversion of oct, hex, binary
#                strings and checking that the value is really a number.
17
#   values = (optional) an array reference listing all valid values (emulates an enum)
18
#   default = (optional) default value if not given in file and not determinable otherwise
19
my %designmap;
20
BEGIN {
21
    %designmap = (
22
        ID => {
23
24
            ini_name => "ID",
            is_numeric => 1,
25
26
        },
        FIU_NUM => {
27
28
29
            ini_name => "FIU_NUM",
            default => undef, # optional in .ini, is set to number of FIU blocks
            is_numeric => 1,
30
31
        },
        BAUDRATE => {
32
            ini_name => "BAUDRATE",
33
            default => 115200,
34
            is_numeric => 1,
35
36
        },
        FIU_CFG_BITS => {
37
            ini_name => "FIU_CFG_BITS",
38
            default => 3,
39
            is_numeric => 1,
40
41
        },
        TIMER_WIDTH => {
42
            ini_name => "TIMER_WIDTH",
43
            default => 32,
44
            is_numeric => 1,
45
46
        },
        ARM_DURATION_WIDTH => {
47
48
            ini_name => "ARM_DUR_WIDTH",
            is_numeric => 1,
49
50
        },
        INJECT_DURATION_WIDTH => {
51
52
            ini_name => "INJECT_DUR_WIDTH",
            is_numeric => 1,
53
54
55
56
        },
    );
}

57
58
59
60
61
62
63
64
65
66
67
68
use constant \%designmap;
use constant DESIGNMAP => \%designmap;

my %fiumap;
BEGIN {
    %fiumap = (
        FIU_NET_NAME => {
            ini_name => "NET_NAME",
        },
        FIU_MODEL => {
            ini_name => "FAULT_MODEL",
            default => "RUNTIME",
69
            values => [qw(RUNTIME STUCK_AT_0 STUCK_AT_1 DELAY SEU STUCK_OPEN PASS_THRU)],
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
        },
        FIU_LFSR_EN => {
            ini_name => "ENABLED_BY_LFSR",
            default => 0,
        },
        FIU_LFSR_MASK => {
            ini_name => "LFSR_MASK",
            default => 0,
            is_numeric => 1,
        },
        FIU_LFSR_STUCK_OPEN_BIT => {
            ini_name => "LFSR_BIT_FOR_STUCK_OPEN",
            default => 0,
            is_numeric => 1,
        },
    );
}

use constant \%fiumap;
use constant FIUMAP => \%fiumap;
90
91
92
93

use base 'Exporter';

# our @EXPORT      = ();
94
95
our @EXPORT      = (keys(%designmap), keys(%fiumap));
our @EXPORT_OK   = (keys(%designmap), 'DESIGNMAP', keys(%fiumap), 'FIUMAP');
96
97
98
99
100
101
102
our %EXPORT_TAGS = (
   all     => \@EXPORT_OK,
   default => \@EXPORT,
   # log     => [ grep /^LOG_/, @EXPORT_OK ], # all constants beginning with "LOG_"
);

1;