forked from rmanohar/layout
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mag.pl
executable file
·78 lines (68 loc) · 1.4 KB
/
mag.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
#!/usr/bin/perl
if ($ARGV[0] eq "-prboundary") {
$prboundary = 1;
shift;
}
else {
$prboundary = 0;
}
foreach $i (@ARGV) {
&process_rect ($i);
}
&std_defs ();
exit 0;
sub std_defs {
print 'proc lcell { x } { load "_0_0cell_0_0g${x}x0" }' . "\n";
}
sub process_rect {
my $name = $_[0];
my $base;
die "Could not open file $name\n" unless open(FILE,"<$name");
$base = $name;
$base =~ s/.rect$//;
print "xload $base\n";
while (<FILE>) {
next if /^#/;
chop;
($rect,$node,$mat,$llx,$lly,$urx,$ury) = split;
if ($rect eq "bbox" || $rect eq "sbox") {
if ($prboundary) {
print "box $node $mat $llx $lly\n";
print "label prboundary\n";
}
next;
}
if ($llx > $urx) {
$tmp = $llx;
$llx = $urx;
$urx = $tmp;
}
if ($lly > $ury) {
$tmp = $lly;
$lly = $ury;
$ury = $tmp;
}
next if ($rect ne "rect") && ($rect ne "inrect") && ($rect ne "outrect");
print "box $llx $lly $urx $ury\n";
print "paint $mat\n";
if ($node ne "#") {
$llx++;
$lly++;
print "box $llx $lly $llx $lly\n";
$node =~ s/\[/\(/g;
$node =~ s/\]/\)/g;
print "label \"$node\" right $mat\n";
$llx--;
$lly--;
if ($rect eq "inrect") {
print "port class input\n";
print "port make\n";
}
elsif ($rect eq "outrect") {
print "port class output\n";
print "port make\n";
}
}
}
close (FILE);
}