OpenCores
URL https://opencores.org/ocsvn/scan_based_serial_communication/scan_based_serial_communication/trunk

Subversion Repositories scan_based_serial_communication

[/] [scan_based_serial_communication/] [trunk/] [scan_signal_list.pl] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 Quanticles
 
2
# The list at the beginning defines the scan lists. Defining an input name or output
3
#                                    name determines what type of scan signal it is.
4
 
5 4 Quanticles
# This must be defined, whether or not it's used
6
my $scan_reset_name = 'scan_reset';
7
 
8 3 Quanticles
# Values are always readable (the buffering latch is what is read if writable)
9 4 Quanticles
my @signal_list = ( # Inputs - outside to chip
10
                    { size =>   1, writable => 1, name => $scan_reset_name},
11 3 Quanticles
 
12
                    { size =>   1, writable => 1, name => 'write_data_1'},
13
                    { size =>   2, writable => 1, name => 'write_data_2'},
14
                    { size =>   3, writable => 1, name => 'write_data_3'},
15
 
16 5 Quanticles
                    { size =>  16, writable => 1, name => 'write_data_array', addr_bits => 2, data_bits => 4},
17 4 Quanticles
 
18 3 Quanticles
                    # Outputs - chip to outside
19
                    { size =>   1, writable => 0, name => 'read_data_1'},
20
                    { size =>   2, writable => 0, name => 'read_data_2'},
21
                    { size =>   3, writable => 0, name => 'read_data_3'},
22 4 Quanticles
 
23
                    { size =>  16, writable => 0, name => 'read_data_array',  addr_bits => 2, data_bits => 4},
24 3 Quanticles
                    );
25
 
26 4 Quanticles
 
27
 
28
# We're going to calculate the total scan chain length.
29
# We also use this to set some key values and do some error checking, so do not comment out this section.
30 3 Quanticles
my $scan_chain_length = 0;
31 4 Quanticles
my $reset_exists      = 0;
32
my $scan_reset_bit    = -1;
33 3 Quanticles
 
34
for (my $i = 0; $i < scalar @signal_list; $i++) {
35
    $signal_list[$i]{start} = $scan_chain_length;
36 4 Quanticles
 
37
    # Check to see if we have a reset signal
38
    if ($signal_list[$i]{name} eq $scan_reset_name) {
39
        $scan_reset_exists = 1;
40
        $scan_reset_bit    = $scan_chain_length;
41
    }
42
 
43
    # Here we set the default values for the addr_bits and data_bits fields
44
    $signal_list[$i]{addr_bits} = 0 if (!exists $signal_list[$i]{addr_bits});
45
    $signal_list[$i]{data_bits} = 0 if (!exists $signal_list[$i]{data_bits});
46
 
47
    # It's an array if either of these values are set
48
    if ($signal_list[$i]{addr_bits} == 0 && $signal_list[$i]{data_bits} == 0) {
49
 
50
        # Default case is that nothing is set so we just add the size
51
        $scan_chain_length += $signal_list[$i]{size};
52
 
53
    } else {
54
 
55
        # Let's do some error checking while we're at it:  2^addr_bits * data_bits >= size
56
        if ((1 << $signal_list[$i]{addr_bits}) * $signal_list[$i]{data_bits} < $signal_list[$i]{size}) {
57
            print STDERR "SCAN ERROR: addr_bits ($signal_list[$i]{addr_bits}) and data_bits ( $signal_list[$i]{data_bits})";
58
            print STDERR " are not big enough to fit size ($signal_list[$i]{size}) for $signal_list[$i]{name}\n";
59
            die;
60
        }
61
 
62
        # Passed the error checking, we're instead going to have address and data fields
63
        $scan_chain_length += $signal_list[$i]{addr_bits};
64
        $scan_chain_length += $signal_list[$i]{data_bits};
65
 
66
    }
67 3 Quanticles
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.