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 6

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 6 Quanticles
 
11 4 Quanticles
                    { size =>   1, writable => 1, name => $scan_reset_name},
12 3 Quanticles
 
13 6 Quanticles
 
14
                    { size =>   1, writable => 1, name => 'memory_load_mode'},
15
 
16
 
17
                    { size =>   9, writable => 1, name => 'addr'},
18
                    { size =>  64, writable => 1, name => 'input_data'},
19
                    { size =>  64, writable => 0, name => 'output_data'},
20
                    { size =>   1, writable => 1, name => 'w1_r0'},
21
 
22
 
23
 
24 3 Quanticles
                    { size =>   1, writable => 1, name => 'write_data_1'},
25
                    { size =>   2, writable => 1, name => 'write_data_2'},
26
                    { size =>   3, writable => 1, name => 'write_data_3'},
27
 
28 5 Quanticles
                    { size =>  16, writable => 1, name => 'write_data_array', addr_bits => 2, data_bits => 4},
29 4 Quanticles
 
30 3 Quanticles
                    # Outputs - chip to outside
31
                    { size =>   1, writable => 0, name => 'read_data_1'},
32
                    { size =>   2, writable => 0, name => 'read_data_2'},
33
                    { size =>   3, writable => 0, name => 'read_data_3'},
34 4 Quanticles
 
35
                    { size =>  16, writable => 0, name => 'read_data_array',  addr_bits => 2, data_bits => 4},
36 3 Quanticles
                    );
37
 
38 4 Quanticles
 
39
 
40
# We're going to calculate the total scan chain length.
41
# We also use this to set some key values and do some error checking, so do not comment out this section.
42 3 Quanticles
my $scan_chain_length = 0;
43 4 Quanticles
my $reset_exists      = 0;
44
my $scan_reset_bit    = -1;
45 3 Quanticles
 
46
for (my $i = 0; $i < scalar @signal_list; $i++) {
47
    $signal_list[$i]{start} = $scan_chain_length;
48 4 Quanticles
 
49
    # Check to see if we have a reset signal
50
    if ($signal_list[$i]{name} eq $scan_reset_name) {
51
        $scan_reset_exists = 1;
52
        $scan_reset_bit    = $scan_chain_length;
53
    }
54
 
55
    # Here we set the default values for the addr_bits and data_bits fields
56
    $signal_list[$i]{addr_bits} = 0 if (!exists $signal_list[$i]{addr_bits});
57
    $signal_list[$i]{data_bits} = 0 if (!exists $signal_list[$i]{data_bits});
58
 
59
    # It's an array if either of these values are set
60
    if ($signal_list[$i]{addr_bits} == 0 && $signal_list[$i]{data_bits} == 0) {
61
 
62
        # Default case is that nothing is set so we just add the size
63
        $scan_chain_length += $signal_list[$i]{size};
64
 
65
    } else {
66
 
67
        # Let's do some error checking while we're at it:  2^addr_bits * data_bits >= size
68
        if ((1 << $signal_list[$i]{addr_bits}) * $signal_list[$i]{data_bits} < $signal_list[$i]{size}) {
69
            print STDERR "SCAN ERROR: addr_bits ($signal_list[$i]{addr_bits}) and data_bits ( $signal_list[$i]{data_bits})";
70
            print STDERR " are not big enough to fit size ($signal_list[$i]{size}) for $signal_list[$i]{name}\n";
71
            die;
72
        }
73
 
74
        # Passed the error checking, we're instead going to have address and data fields
75
        $scan_chain_length += $signal_list[$i]{addr_bits};
76
        $scan_chain_length += $signal_list[$i]{data_bits};
77
 
78
    }
79 3 Quanticles
}

powered by: WebSVN 2.1.0

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