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/] [emulator.pm] - Blame information for rev 38

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

Line No. Rev Author Line
1 25 alirezamon
#!/usr/bin/perl -w -I ..
2
###############################################################################
3
#
4
# File:         emulator.pm
5
# 
6
#
7
###############################################################################
8
use warnings;
9
use strict;
10
 
11
 
12
 
13
package emulator;
14
 
15
 
16
 
17
sub emulator_new {
18
    # be backwards compatible with non-OO call
19
    my $class = ("ARRAY" eq ref $_[0]) ? "mpsoc" : shift;
20
    my $self;
21
 
22
 
23
    $self = {};
24
    $self->{file_name}        = (); # information on each file
25 38 alirezamon
    $self->{samples} = ();
26 25 alirezamon
    emulator_initial_setting($self);
27
 
28
 
29
    bless($self,$class);
30
 
31
 
32
    return $self;
33
}
34
 
35
sub emulator_initial_setting{
36
        my $self=shift;
37
        $self->{status}="ideal";
38
        $self->{setting}{show_noc_setting}=1;
39
        $self->{setting}{show_adv_setting}=0;
40
        $self->{setting}{show_tile_setting}=0;
41
        $self->{setting}{soc_path}="lib/soc";
42
 
43
}
44
 
45
 
46
 
47
 
48
 
49
 
50
 
51
 
52
sub object_add_attribute{
53
        my ($self,$attribute1,$attribute2,$value)=@_;
54
        if(!defined $attribute2){$self->{$attribute1}=$value;}
55
        else {$self->{$attribute1}{$attribute2}=$value;}
56
 
57
}
58
 
59
sub object_get_attribute{
60
        my ($self,$attribute1,$attribute2)=@_;
61
        if(!defined $attribute2) {return $self->{$attribute1};}
62
        return $self->{$attribute1}{$attribute2};
63
 
64
 
65
}
66
 
67
sub object_add_attribute_order{
68
        my ($self,$attribute,@param)=@_;
69
        $self->{'parameters_order'}{$attribute}=[] if (!defined $self->{parameters_order}{$attribute});
70
        foreach my $p (@param){
71
                push (@{$self->{parameters_order}{$attribute}},$p);
72
 
73
        }
74
}
75
 
76
sub object_get_attribute_order{
77
        my ($self,$attribute)=@_;
78 38 alirezamon
        my @array;
79
        @array =  @{$self->{parameters_order}{$attribute}} if (defined $self->{parameters_order}{$attribute});
80
        return @array;
81 25 alirezamon
}
82
 
83
 
84 38 alirezamon
sub object_delete_attribute_order{
85
        my ($self,$attribute,@param)=@_;
86
        my @array=object_get_attribute_order($self,$attribute);
87
        foreach my $p (@param){
88
                @array=remove_scolar_from_array(\@array,$p);
89 25 alirezamon
 
90 38 alirezamon
        }
91
        $self->{'parameters_order'}{$attribute}=[];
92
        object_add_attribute_order($self,$attribute,@array);
93
}
94 25 alirezamon
 
95 38 alirezamon
sub object_remove_attribute{
96
        my ($self,$attribute1,$attribute2)=@_;
97
        if(!defined $attribute2){
98
                delete $self->{$attribute1} if ( exists( $self->{$attribute1}));
99
        }
100
        else {
101
                delete $self->{$attribute1}{$attribute2} if ( exists( $self->{$attribute1}{$attribute2})); ;
102
 
103
        }
104
 
105
}
106
 
107
sub remove_scolar_from_array{
108
        my ($array_ref,$item)=@_;
109
        my @array=@{$array_ref};
110
        my @new;
111
        foreach my $p (@array){
112
                if($p ne $item ){
113
                        push(@new,$p);
114
                }
115
        }
116
        return @new;
117
}
118
 
119
 
120
 
121 25 alirezamon
1

powered by: WebSVN 2.1.0

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