Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # ========== Copyright Header Begin ========================================== |
2 | # | |
3 | # OpenSPARC T2 Processor File: rsyn,1.0 | |
4 | # Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | # | |
7 | # The above named program is free software; you can redistribute it and/or | |
8 | # modify it under the terms of the GNU General Public | |
9 | # License version 2 as published by the Free Software Foundation. | |
10 | # | |
11 | # The above named program is distributed in the hope that it will be | |
12 | # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | # General Public License for more details. | |
15 | # | |
16 | # You should have received a copy of the GNU General Public | |
17 | # License along with this work; if not, write to the Free Software | |
18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | # | |
20 | # ========== Copyright Header End ============================================ | |
21 | ||
22 | ####################################################################### | |
23 | # Run Synthesis script | |
24 | # | |
25 | # rsyn -help for help | |
26 | ####################################################################### | |
27 | ||
28 | ||
29 | use warnings; | |
30 | use strict; | |
31 | use Cwd; | |
32 | use Cwd 'chdir'; | |
33 | use Getopt::Long ; | |
34 | ||
35 | $| = 1; | |
36 | ||
37 | $SIG{__DIE__} = \&sighandler ; | |
38 | ||
39 | ####################################################################### | |
40 | # Global variables | |
41 | ####################################################################### | |
42 | ||
43 | my $prg = $0; | |
44 | $prg =~ s/.*\/// ; | |
45 | $prg =~ s/,.*// ; | |
46 | ||
47 | my $all = 0; | |
48 | my $syn_q = "/bin/sh"; | |
49 | my $blk_list = ""; | |
50 | my $run_scr = ""; | |
51 | my $blk_dir; | |
52 | ||
53 | my @blocks = (); | |
54 | my @block_list = (); | |
55 | ||
56 | $blk_list = $ENV{DV_ROOT}; | |
57 | $blk_list .= "/design/sys/synopsys/block.list"; | |
58 | $run_scr = $ENV{DV_ROOT}; | |
59 | $run_scr .= "/design/sys/synopsys/script/run.scr"; | |
60 | ||
61 | ####################################################################### | |
62 | # Check command line options | |
63 | ####################################################################### | |
64 | ||
65 | foreach my $argv (@ARGV) | |
66 | { | |
67 | if ($argv =~ /-all/) | |
68 | { | |
69 | $all = 1; | |
70 | } elsif (($argv =~ /-h/) or ($argv =~ /-help/)) | |
71 | { | |
72 | &usage; | |
73 | exit(0); | |
74 | } elsif ($argv =~ /-syn_q_command/) | |
75 | { | |
76 | $syn_q = $argv; | |
77 | $syn_q =~ s/-syn_q_command=(.*)/$1/ ; | |
78 | } else | |
79 | { | |
80 | push @blocks, $argv; | |
81 | } | |
82 | } | |
83 | ||
84 | my $count = 0; | |
85 | ||
86 | open (BLK_IN, "< $blk_list") or die ("DIE. could not open $blk_list"); | |
87 | if ($all) { | |
88 | while (<BLK_IN>) | |
89 | { | |
90 | my $line = $_ ; | |
91 | $line =~ s/\s+$//; | |
92 | $count++; | |
93 | push @block_list, $line ; | |
94 | } | |
95 | print "$prg: Running synthesis for all $count modules\n"; | |
96 | } else { | |
97 | my @all_blocks = <BLK_IN>; | |
98 | foreach my $block (@blocks) | |
99 | { | |
100 | my (@search) = grep (/$block/, @all_blocks); | |
101 | foreach my $line (@search) | |
102 | { | |
103 | $line =~ s/\s+$//; | |
104 | push @block_list, $line ; | |
105 | $count++; | |
106 | } | |
107 | } | |
108 | if ($count) { | |
109 | print "$prg: Running synthesis for $count modules\n"; | |
110 | } else { | |
111 | print "$prg: No matching modules found.\n"; | |
112 | &usage; | |
113 | } | |
114 | } | |
115 | close(BLK_IN); | |
116 | ||
117 | foreach my $block (@block_list) { | |
118 | print "$prg: Running synthesis for $block\n"; | |
119 | my $cmd = $syn_q; | |
120 | $blk_dir = $ENV{DV_ROOT}; | |
121 | $blk_dir .= "/design/sys/iop/$block/synopsys"; | |
122 | chdir $blk_dir; | |
123 | `rm -rf dc_shell.log`; | |
124 | die ("DIE. Could not remove dc_shell.log file.") if ($?); | |
125 | $cmd .= " $ENV{DV_ROOT}/tools/bin/syn_command"; | |
126 | system($cmd); | |
127 | } | |
128 | ||
129 | ####################################################################### | |
130 | sub usage { | |
131 | print "\n$prg : Run Synthesis for OpenSPARC T2\n\n"; | |
132 | print "Options are :\n"; | |
133 | print " -all \n\tto run synthesis for all blocks\n"; | |
134 | print " -h or -help\n\tto print usage instruction\n"; | |
135 | print " -syn_q_command='Your job Queue command'\n\tto specify submit command for job queue\n"; | |
136 | print " block_list :\n\tspecify list of blocks to synthesize\n\n"; | |
137 | print "Examples:\n\n"; | |
138 | print " $prg db0\n"; | |
139 | print " $prg exu sio\n"; | |
140 | print " $prg -all\n"; | |
141 | print " $prg -syn_q_cmd=drmsubmit db0 exu sio\n\n"; | |
142 | } | |
143 | ####################################################################### |