OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [perl/] [mpsoc.pm] - Blame information for rev 25

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

Line No. Rev Author Line
1 16 alirezamon
#! /usr/bin/perl -w
2
use strict;
3
 
4
 
5
package mpsoc;
6
 
7
use ip_gen;
8
 
9
 
10
#use Clone 'clone';
11
 
12
 
13
 
14
sub mpsoc_new {
15
    # be backwards compatible with non-OO call
16
    my $class = ("ARRAY" eq ref $_[0]) ? "mpsoc" : shift;
17
    my $self;
18
 
19
 
20
    $self = {};
21
    $self->{file_name}        = (); # information on each file
22
    $self->{noc_param}=   {};
23
    $self->{noc_indept_param}={};
24 25 alirezamon
   # $self->{parameters_order}=[];
25
 
26 16 alirezamon
    $self->{setting}={};
27
        $self->{socs}={};
28
        mpsoc_initial_setting($self);
29
 
30
 
31
    bless($self,$class);
32
 
33
 
34
    return $self;
35
}
36
 
37
sub mpsoc_initial_setting{
38
        my $self=shift;
39
        $self->{setting}{show_noc_setting}=1;
40
        $self->{setting}{show_adv_setting}=0;
41
        $self->{setting}{show_tile_setting}=1;
42
        $self->{setting}{soc_path}="lib/soc";
43
}
44
 
45
 
46
 
47
 
48
sub mpsoc_get_instance_info{
49
        my ($self,$ip_num)=@_;
50
        return $self->{ips}{$ip_num}{name}
51
}
52
 
53
sub mpsoc_set_ip_inst_name{
54
        my ($self,$ip_num,$new_instance)=@_;
55
        $self->{ips}{$ip_num}{name}=$new_instance;
56
 
57
}
58
 
59
sub mpsoc_get_soc_list{
60
        my $self=shift;
61
        my @list;
62
        foreach my $p (sort keys %{$self->{socs}}){
63
                push(@list,$p);
64
        }
65
        return @list;
66
}
67
 
68
 
69
 
70
 
71
 
72
sub mpsoc_add_soc{
73
        my ($self,$name,$soc)=@_;
74
        $self->{socs}{$name}{top}=$soc;
75
 
76
}
77
 
78
 
79
 
80
 
81
sub mpsoc_get_soc{
82
        my ($self,$name)=@_;
83
        return $self->{socs}{$name}{top};
84
 
85
}
86
 
87
 
88
sub mpsoc_remove_soc{
89
        my ($self,$name)=@_;
90
        delete $self->{socs}{$name};
91
}
92
 
93
sub mpsoc_remove_all_soc{
94
        my ($self)=@_;
95
        delete $self->{socs};
96
}
97
 
98
 
99
 
100
sub mpsoc_add_soc_tiles_num{
101
        my ($self,$name,$nums) =@_;
102
        if(defined $nums){
103
                my @f=sort { $a <=> $b } @{$nums};
104
                if( exists $self->{socs}{$name}){
105
                        $self->{socs}{$name}{tile_nums}=\@f;
106
 
107
                }
108
        }else {
109
                $self->{socs}{$name}{tile_nums}=undef;
110
 
111
        }
112
}
113
 
114
sub mpsoc_get_soc_tiles_num{
115
        my ($self,$name) =@_;
116
        my @nums;
117
        if( defined $self->{socs}{$name}{tile_nums}){
118
                @nums = @{$self->{socs}{$name}{tile_nums}};
119
 
120
        }
121
        return @ nums;
122
}
123
 
124
sub mpsoc_get_scolar_pos{
125
        my ($item,@list)=@_;
126
        my $pos;
127
        my $i=0;
128
        foreach my $c (@list)
129
        {
130
                if(  $c eq $item) {$pos=$i}
131
                $i++;
132
        }
133
        return $pos;
134
}
135
 
136
sub mpsoc_get_tile_soc_name{
137
        my ($self,$tile)=@_;
138
        my @all_socs=mpsoc_get_soc_list($self);
139
        my $soc_num=0;
140
        my $p;
141
        foreach $p( @all_socs){
142
                my @tiles=mpsoc_get_soc_tiles_num ($self,$p);
143
                if ( grep( /^$tile$/, @tiles ) ){
144
                            my $num =mpsoc_get_scolar_pos($tile,@tiles);
145
 
146
                                return ($p,$soc_num,$num);
147
                }
148
                $soc_num++;
149
 
150
        }
151
        return ($p,$soc_num,undef);
152
 
153
}
154
 
155
sub mpsoc_remove_scolar_from_array{
156
        my ($array_ref,$item)=@_;
157
        my @array=@{$array_ref};
158
        my @new;
159
        foreach my $p (@array){
160
                if($p ne $item ){
161
                        push(@new,$p);
162
                }
163
        }
164
        return @new;
165
}
166
 
167
sub mpsoc_set_tile_free{
168
        my ($self,$tile)=@_;
169
        #
170
        mpsoc_set_tile_param_setting($self, $tile, 'Default');
171
        my @all_socs=mpsoc_get_soc_list($self);
172
        my $soc_num=0;
173
        my $p;
174
        foreach $p( @all_socs){
175
                my @tiles=mpsoc_get_soc_tiles_num ($self,$p);
176
                my @n=mpsoc_remove_scolar_from_array(\@tiles,$tile);
177
                mpsoc_add_soc_tiles_num($self,$p,\@n);
178
 
179
        }
180
 
181
}
182
 
183
sub mpsoc_set_tile_soc_name{
184
        my ($self,$tile,$new_soc)=@_;
185
        mpsoc_set_tile_free($self,$tile);
186
        my @tiles=mpsoc_get_soc_tiles_num ($self,$new_soc);
187
        push(@tiles,$tile);
188
        mpsoc_add_soc_tiles_num($self,$new_soc,\@tiles);
189
 
190
 
191
}
192
 
193
sub mpsoc_set_tile_param_setting{
194
        my ($self,$tile,$setting)=@_;
195
        $self->{tile}{$tile}{param_setting}=$setting;
196
 
197
}
198
 
199
sub mpsoc_get_tile_param_setting{
200
        my ($self,$tile)=@_;
201
        my $setting='Default';
202
        if(exists $self->{tile}{$tile}{param_setting}){
203
                $setting=$self->{tile}{$tile}{param_setting};
204
 
205
        }
206
        return $setting;
207
}
208
 
209
 
210 25 alirezamon
 
211
sub object_add_attribute{
212
        my ($self,$attribute1,$attribute2,$value)=@_;
213
        if(!defined $attribute2){$self->{$attribute1}=$value;}
214
        else {$self->{$attribute1}{$attribute2}=$value;}
215
 
216
}
217
 
218
 
219
 
220
sub object_get_attribute{
221
        my ($self,$attribute1,$attribute2)=@_;
222
        if(!defined $attribute2) {return $self->{$attribute1};}
223
        return $self->{$attribute1}{$attribute2};
224
 
225
 
226
}
227
 
228
 
229
sub object_add_attribute_order{
230
        my ($self,$attribute,@param)=@_;
231
        $self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute});
232
        foreach my $p (@param){
233
                push (@{$self->{parameters_order}{$attribute}},$p);
234
 
235
        }
236
}
237
sub object_get_attribute_order{
238
        my ($self,$attribute)=@_;
239
        return @{$self->{parameters_order}{$attribute}};
240
}
241
 
242
 
243
 
244 16 alirezamon
1
245
 

powered by: WebSVN 2.1.0

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