-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest3.pl
More file actions
94 lines (78 loc) · 2.01 KB
/
test3.pl
File metadata and controls
94 lines (78 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/local/bin/perl
use warnings; use strict;
my $delay_energy_match = $ARGV[0];
open (my $cfile, 'alldata.txt');
my @final = map { chomp; [split /,/] } <$cfile>;
close($cfile);
#print "@final\n";
my $x = 0;
my $flag = 0;
my $flat_max=0;
my $flat_min=1;
my @sorted = ();
my @no_reflect = ();
if ($delay_energy_match < 2){
if ($delay_energy_match == 0){
@sorted = sort { $a->[2] <=> $b->[2] } @final;
}
elsif ($delay_energy_match == 1) {
@sorted = sort { abs($a->[3]) <=> abs($b->[3]) } @final;
}
while ($flag == 0){
if ( @{$sorted[$x]}[4] > 0.9*0.9){
#print @{$sorted[$x]}[2];
$flag = 1;
$x = $x - 1;
}
$x = $x + 1;
}
}
else {
# print "num_final: $#final\n";
# for (my $i=0;$i<$#final+1;$i++){
# #print "A\n";
# if ($flat_max < @{$final[$i]}[5] && @{$final[$i]}[4]>0.9){
# $flat_max = @{$final[$i]}[5];
# }
# if ($flat_min > @{$final[$i]}[5] && @{$final[$i]}[4]>0.9){
# $flat_min = @{$final[$i]}[5];
# }
# }
# print "flat_max: $flat_max\n";
# print "flat_min: $flat_min\n";
#
# for (my $i=0;$i<$#final+1;$i++){
# if ((@{$final[$i]}[5]-$flat_min) < ($flat_max-@{$final[$i]}[5])){
# push (@no_reflect,[@{$final[$i]}]);
# print "drv: @{$final[$i]}[5]\n";
# }
# }
for (my $i=0;$i<$#final+1;$i++){
if (@{$final[$i]}[5]<0.1){
push (@no_reflect,[@{$final[$i]}]);
print "drv: @{$final[$i]}[5]\n";
}
}
if ($delay_energy_match == 2){
@sorted = sort { $a->[2] <=> $b->[2] } @no_reflect;
}
else {
@sorted = sort { abs($a->[3]) <=> abs($b->[3]) } @no_reflect;
}
}
# print "fullswing: $#full_swing\n";
# @sorted = sort { $a->[5] <=> $b->[5] } @full_swing;
# print "sorted: @{$sorted[0]}[0]\n";
# $flat_max=$sorted[-1][5];
# $flat_min=$sorted[0][5];
# print "sorted: $#sorted\n";
# print "flat_max: $flat_max\n";
# print "flat_min: $flat_min\n";
#}
#print "@{$sorted[1]}\n";
#print "@{$sorted[1]}\n";
#@{$sorted[$x]}[5] > 0.9*$vdd
open(my $out, '>', 'alldata2.txt') || die("Unable to open somefile.txt: $!");
#print $out join(",", @{$sorted[0]});
print $out join(",", @{$sorted[$x]});
close($out);