一个很急的问题
一个很急的问题
#!/usr/local/bin/perl
# -*- perl -*- Forces EMacs to use perl-mode
use Getopt::Std;
&getopts('s:o:');
if(!$opt_s || !$opt_o) {
die "
pt_postprocessor.pl -s <input SDF file>
-o <output SFD file>
$IN_FILE = $opt_s;
$OUT_FILE = $opt_o;
open(INPUT, $IN_FILE) ||
die printf("Sorry, Could not open file %s\n",$IN_FILE);
open(OUTPUT, ">" . $OUT_FILE) ||
die printf("Sorry, Could not open file %s\n",$OUT_FILE);
# this list describes the valid IOPATHS for each cell that has conditional
# path delays. All COND IOPATHS are not modified.
while (<INPUT>) {
chop;
@var = split;
#
# The following code strips out the unnecessary IOPATHS that are created by
# PrimeTime for cells with conditional path delays
#
.....
.....
.....
#....表示省略的内容
elsif ( ((@var[0] eq "(SETUP") || (@var[0] eq "(HOLD")) &&
((@var[2] eq "(posedge") || (@var[2] eq "(negedge")) ){
@var[1]=~s/\\\[/\[/g;
@var[1]=~s/\\\]/\]/g;
printf OUTPUT " %s (posedge %s) %s %s %s\n",@var[0],@var[1],@var
[2],@var[3],@var[4];
printf OUTPUT " %s (negedge %s) %s %s %s\n",@var[0],@var[1],@var
[2],@var[3],@var[4];
}
#added by DDC group for transfering DC SDF file successful
#
elsif(($_ ~= /Qx.x/) || ($_ ~= /Qx..x/) ||
($_ ~= /Ax.x/) || ($_ ~= /Ax..x/) ||
($_ ~= /Dx.x/) || ($_ ~= /Dx..x/))
{ $_ ~= s/xx/\[\]/g;
printf OUTPUT "%s ", $_;
}
else{
$_=~s/\\\[/\[/g;
$_=~s/\\\]/\]/g;
printf OUTPUT "%s\n",$_;
}
}
以上是perl程序的部分代码,而下面是我添加的,想表达的意思是把形如:Qx.x或者Qx..x等形式(如:Qx11x)的字符串变为Q[.](如:Q[11]),编译报错。
elsif(($_ ~= /Qx.x/) || ($_ ~= /Qx..x/) ||
($_ ~= /Ax.x/) || ($_ ~= /Ax..x/) ||
($_ ~= /Dx.x/) || ($_ ~= /Dx..x/))
{ $_ ~= s/xx/\[\]/g;
printf OUTPUT "%s ", $_;
}
很急,有没有达人能帮忙看看。