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.perl.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 Quanticles
 
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
 
5
module scan (
6
 
7
              // Inputs & outputs to the chip
8
             PERL begin
9
             /*
10
              DEPERLIFY_INCLUDE(scan_signal_list.pl);
11
 
12
              for (my $i = 0; $i < scalar @signal_list; $i++) {
13
                 print "              $signal_list[$i]{name},\n";
14
              }
15
 
16
              */
17
             end
18
 
19
              // To the pads
20
              scan_phi,
21
              scan_phi_bar,
22
              scan_data_in,
23
              scan_data_out,
24
              scan_load_chip,
25
              scan_load_chain
26
 
27
              );
28
 
29
 
30
   // /////////////////////////////////////////////////////////////////////
31
   // Ports
32
 
33
   // Scans
34
   input   scan_phi;
35
   input   scan_phi_bar;
36
   input   scan_data_in;
37
   output  scan_data_out;
38
   input   scan_load_chain;
39
   input   scan_load_chip;
40
 
41
 
42
   PERL begin
43
      /*
44
       DEPERLIFY_INCLUDE(scan_signal_list.pl);
45
 
46
       for (my $i = 0; $i < scalar @signal_list; $i++) {
47
           if ($signal_list[$i]{writable} == 1) {
48
                print "    output reg ";
49
           } else {
50
                print "    input      ";
51
           }
52
 
53
            print "[$signal_list[$i]{size}-1:0]  $signal_list[$i]{name};\n";
54
       }
55
 
56
       */
57
   end
58
 
59
 
60
   // /////////////////////////////////////////////////////////////////////
61
   // Implementation
62
 
63
   // The scan chain is comprised of two sets of latches: scan_master and scan_slave.
64
 
65
   PERL begin
66
      /*
67
 
68
       ##############################################################
69
       # Modify scan_signal_list.pl in order to change the signals. #
70
       ##############################################################
71
 
72
       DEPERLIFY_INCLUDE(scan_signal_list.pl);
73
 
74
       # Print scan chain latches
75
       print "   reg [$scan_chain_length-1:0] scan_master;\n";
76
       print "   reg [$scan_chain_length-1:0] scan_slave;\n\n";
77
 
78
       # Print scan_load and scan_next logic
79
       print "   wire [$scan_chain_length-1:0] scan_load;\n";
80
       print "   wire [$scan_chain_length-1:0] scan_next;\n\n";
81
 
82
       for (my $i = 0; $i < scalar @signal_list; $i++) {
83
 
84
          my $begin = $signal_list[$i]{start};
85
          my $end   = $signal_list[$i]{start} + $signal_list[$i]{size} - 1;
86
 
87
          print "   assign scan_load[$end:$begin] = " . $signal_list[$i]{name} . ";\n";
88
       }
89
 
90
       print "\n   assign scan_next = scan_load_chain ? scan_load : {scan_data_in, scan_slave[$'$scan_chain_length-1:1]};\n\n";
91
 
92
       # Print latches
93
       print "   //synopsys one_hot \"scan_phi, scan_phi_bar\"\n";
94
       print "   always @ (*) begin\n";
95
       print "       if (scan_phi)\n";
96
       print "          scan_master = scan_next;\n";
97
       print "       if (scan_phi_bar)\n";
98
       print "          scan_slave  = scan_master;\n";
99
       print "   end\n\n";
100
 
101
       # Print input latches
102
       for (my $i = 0; $i < scalar @signal_list; $i++) {
103
          if ($signal_list[$i]{writable} == 1) {
104
             my $begin = $signal_list[$i]{start};
105
             my $end   = $signal_list[$i]{start} + $signal_list[$i]{size} - 1;
106
             my $name  = $signal_list[$i]{name};
107
             print " always @ (*) if (scan_load_chip) $name = scan_slave[$end:$begin];\n";
108
          }
109
       }
110
 
111
       # Print data_out
112
       print "   assign scan_data_out = scan_slave[0];\n";
113
 
114
       */
115
   end
116
 
117
 
118
   // /////////////////////////////////////////////////////////////////////
119
 
120
endmodule

powered by: WebSVN 2.1.0

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