-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_drv_ffix_1.pl
106 lines (73 loc) · 1.92 KB
/
create_drv_ffix_1.pl
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
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/perl
use strict;
use warnings;
#use Data::Dumper qw(Dumper);
#print Dumper \@ARGV;
my $drv_rcv = $ARGV[0];
my $delay_energy_match = $ARGV[1];
my $drv_Cin = $ARGV[2];
my $drv = $ARGV[3];
print "drv_rcv: $drv_rcv\n";
#print "drv_Cin: $drv_Cin\n";
#print "drv: $drv\n";
my $ratio = 1;
if ($delay_energy_match%2==0) {
$ratio = 4;
}
else{
$ratio =8;
}
print "ratio: $ratio\n";
my $sp_file;
if ($drv_rcv==0) {
open($sp_file, ">./drv_ffix.sp");
printf $sp_file "\n";
printf $sp_file ".subckt drv_ffix a vdd vss y\n";
}
else {
open($sp_file, ">./rcv_ffix.sp");
printf $sp_file "\n";
printf $sp_file ".subckt rcv_ffix a vdd vss y\n";
}
my $len_drv = 0;
my $temp_drv = $drv;
my @drv_set = ();
while ($temp_drv >= $drv_Cin){
$drv_set[$len_drv] = $temp_drv;
$temp_drv = int($temp_drv / $ratio+0.5);
$len_drv = $len_drv +1;
}
if ($drv_set[$len_drv-1]!=$drv_Cin){
$drv_set[$len_drv] = $drv_Cin;
$len_drv = $len_drv +1;
}
if ($len_drv%2 != 0) {
$drv_set[$len_drv] = $drv_Cin;
$len_drv = $len_drv + 1;
}
print "Sizes of inv: @drv_set\n";
if ($drv_rcv == 0){
@drv_set = reverse(@drv_set);
}
my $count = 0;
my $temp_count;
my $temp_i;
foreach my $i (@drv_set) {
$temp_count = $count - 1;
if ($count == 0){
printf $sp_file "MN${count} net${count} a vss vss NMOS_VTH l=50e-9 w='90e-9' m=${i}\n";
printf $sp_file "MP${count} net${count} a vdd vdd PMOS_VTH l=50e-9 w='350e-9' m=${i}\n";
}
elsif ($count == $#drv_set){
printf $sp_file "MN${count} y net${temp_count} vss vss NMOS_VTH l=50e-9 w='90e-9' m=${i}\n";
printf $sp_file "MP${count} y net${temp_count} vdd vdd PMOS_VTH l=50e-9 w='350e-9' m=${i}\n";
}
else {
printf $sp_file "MN${count} net${count} net${temp_count} vss vss NMOS_VTH l=50e-9 w='90e-9' m=${i}\n";
printf $sp_file "MP${count} net${count} net${temp_count} vdd vdd PMOS_VTH l=50e-9 w='350e-9' m=${i}\n";
}
$temp_i = $i - 1;
$count = $count +1;
}
printf $sp_file ".ends\n";
close($sp_file);