Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perlmod / rsyn,1.0
# ========== Copyright Header Begin ==========================================
#
# OpenSPARC T2 Processor File: rsyn,1.0
# Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
#
# The above named program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation.
#
# The above named program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this work; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ========== Copyright Header End ============================================
#######################################################################
# Run Synthesis script
#
# rsyn -help for help
#######################################################################
use warnings;
use strict;
use Cwd;
use Cwd 'chdir';
use Getopt::Long ;
$| = 1;
$SIG{__DIE__} = \&sighandler ;
#######################################################################
# Global variables
#######################################################################
my $prg = $0;
$prg =~ s/.*\/// ;
$prg =~ s/,.*// ;
my $all = 0;
my $syn_q = "/bin/sh";
my $blk_list = "";
my $run_scr = "";
my $blk_dir;
my @blocks = ();
my @block_list = ();
$blk_list = $ENV{DV_ROOT};
$blk_list .= "/design/sys/synopsys/block.list";
$run_scr = $ENV{DV_ROOT};
$run_scr .= "/design/sys/synopsys/script/run.scr";
#######################################################################
# Check command line options
#######################################################################
foreach my $argv (@ARGV)
{
if ($argv =~ /-all/)
{
$all = 1;
} elsif (($argv =~ /-h/) or ($argv =~ /-help/))
{
&usage;
exit(0);
} elsif ($argv =~ /-syn_q_command/)
{
$syn_q = $argv;
$syn_q =~ s/-syn_q_command=(.*)/$1/ ;
} else
{
push @blocks, $argv;
}
}
my $count = 0;
open (BLK_IN, "< $blk_list") or die ("DIE. could not open $blk_list");
if ($all) {
while (<BLK_IN>)
{
my $line = $_ ;
$line =~ s/\s+$//;
$count++;
push @block_list, $line ;
}
print "$prg: Running synthesis for all $count modules\n";
} else {
my @all_blocks = <BLK_IN>;
foreach my $block (@blocks)
{
my (@search) = grep (/$block/, @all_blocks);
foreach my $line (@search)
{
$line =~ s/\s+$//;
push @block_list, $line ;
$count++;
}
}
if ($count) {
print "$prg: Running synthesis for $count modules\n";
} else {
print "$prg: No matching modules found.\n";
&usage;
}
}
close(BLK_IN);
foreach my $block (@block_list) {
print "$prg: Running synthesis for $block\n";
my $cmd = $syn_q;
$blk_dir = $ENV{DV_ROOT};
$blk_dir .= "/design/sys/iop/$block/synopsys";
chdir $blk_dir;
`rm -rf dc_shell.log`;
die ("DIE. Could not remove dc_shell.log file.") if ($?);
$cmd .= " $ENV{DV_ROOT}/tools/bin/syn_command";
system($cmd);
}
#######################################################################
sub usage {
print "\n$prg : Run Synthesis for OpenSPARC T2\n\n";
print "Options are :\n";
print " -all \n\tto run synthesis for all blocks\n";
print " -h or -help\n\tto print usage instruction\n";
print " -syn_q_command='Your job Queue command'\n\tto specify submit command for job queue\n";
print " block_list :\n\tspecify list of blocks to synthesize\n\n";
print "Examples:\n\n";
print " $prg db0\n";
print " $prg exu sio\n";
print " $prg -all\n";
print " $prg -syn_q_cmd=drmsubmit db0 exu sio\n\n";
}
#######################################################################