2013年9月22日 星期日

Split cell - RC put in another subckt

#!/usr/bin/perl


        open(tempfile,"<u055lsclpmvbbr.cir");
        open(h2,">temp.cir");
 $add_header = 0;
 $first_cell = 1;
 $cell_counter=0;
               
 while(<tempfile>){


                chop $_;
  @ary=split(" ",$_);
  @rc_subckt=split("_",$_);
                if (($ary[0] eq ".subckt") && (@rc_subckt[0] ne ".subckt PM") && ($first_cell == 0))
   {
   print "$cell_name \n";
           close(h2);
                        rename("temp.cir",$cell_name.".cir");
                        open(h2,">temp.cir");
                        $end_of_file=0;
                        $add_header=0;
   }


                if ($add_header==0){
                print h2 ".option scale = 0.9 \n";
                print h2 ".param mismatch=1 sigma=3 \n";
                $add_header=1;}



                print h2 $_;
                print h2 "\n";


                if (($ary[0] eq ".subckt") && (@rc_subckt[0] ne ".subckt PM"))
                        {
     $cell_counter++ ;
                          $cell_name= $ary[1];
                        if ($cell_counter>0)
                                {$first_cell=0;}}
}
        close (tempfile);
        close (h2);


標籤