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

Subversion Repositories scct

[/] [scct/] [trunk/] [mkch.pl] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 fkluge
#!/usr/bin/perl
2
# $Id: mkch.pl 2 2015-06-15 13:52:02Z fkluge $
3
# Create channel declarations
4
 
5
use strict;
6
use warnings;
7
 
8
 
9
my ($nChannels) = @ARGV;
10
 
11
if (not defined $nChannels) {
12
    die "Need number of channels to create!\n";
13
}
14
 
15
if (!($nChannels =~ /^\d+$/)) {
16
    die "Script needs a positive integer\n";
17
}
18
 
19
print "   // Channel definitions were created with $0\n";
20
 
21
my @channel = <DATA>;
22
 
23
for (my $i = 0; $i < $nChannels; $i++) {
24
    print "\n   // Channel $i\n";
25
    my $N = $i;
26
    my $TN = $i * 2;
27
    my $TNPO = $TN + 1;
28
    foreach my $line (@channel) {
29
        my $out = $line;
30
        $out =~ s/(\$\w+(?:::\w+)*)/"defined $1 ? $1 : ''"/gee;
31
        print $out;
32
    }
33
}
34
 
35
 
36
__DATA__
37
   scct_channel channel$N(
38
                    .clk(clk),
39
                    .rst(rst),
40
                    .counter(counter),
41
                    .counter_changed(ctr_counter_changed),
42
                    .icoc_select_i(ch_icoc_select_i[$N]),
43
                    .icoc_select_i_wen(ch_icoc_select_i_wen),
44
                    .icoc_action_i(ch_icoc_action_i[$TNPO:$TN]),
45
                    .icoc_action_i_wen(ch_icoc_action_i_wen),
46
                    .i_cc_reg(ch_i_cc_reg[$N]),
47
                    .i_cc_reg_wen(ch_i_cc_reg_wen[$N]),
48
                    .irq_enable_i(ch_irq_enable_i[$N]),
49
                    .irq_enable_i_wen(ch_irq_enable_i_wen),
50
                    .irq_status_i(ch_irq_status_i[$N]),
51
                    .irq_status_i_wen(ch_irq_status_i_wen),
52
                    .force_oc_i(ch_force_oc_i[$N]),
53
                    .force_oc_i_wen(ch_force_oc_i_wen),
54
                    .icoc_select_o(ch_icoc_select_o[$N]),
55
                    .icoc_action_o(ch_icoc_action_o[$TNPO:$TN]),
56
                    .cc_reg_o(ch_cc_reg_o[$N]),
57
                    .irq_enable_o(ch_irq_enable_o[$N]),
58
                    .irq_status_o(ch_irq_status_o[$N]),
59
                    .pin_i(pins_i[$N]),
60
                    .pin_o(pins_o[$N])
61
                    );

powered by: WebSVN 2.1.0

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