imicman的个人空间 https://blog.eetop.cn/1518355 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

sva_rpt_sum.pl

已有 318 次阅读| 2017-2-5 11:28 |个人分类:验证杂谈|系统分类:硬件设计


sva_rpt_sum.pl

use strict;
use Cmd;
use Getopt::log;
use Data::Dumper;

sub get_database;
sub print_log;

my %all_ast_summary;
my %all_property;
my @all_colunms;
my @all_properties;
my $cur_dir = getcwd();

my $self_name = $0;

my $ast_summray_dir = $cur_dir;
my $ast_sum_log = "sva_rpt_sum.log";

&get_database;

&print_log;

sub get_database{
   if(-e $ast_sum_log){
     unlink $ast_sum_log;
   }
   opendir (ASTD, "$ast_summary_dir") or die "$!\n";
   my @all_fiels_in_ast_log = readdir ASTD;
   for my $file_name (@all_files_in_ast_log){
     next if ( $fiel_name eq "." or $file_name eq "..");
     next if ( -d $file_name);
     open(ASTF, "<$ast_summary_dir") or die "$!\n";
     while (my $line = <ASTF> ) {
       chomp $line;
       next if ($line = ~/at time/);
       next if ($line = ~/Summary/);
       if ($line = ~/Assertion Name/){
         my $columns = $line;
         $line = ~s/^\s+(.*)\s+Assertion Name/$1 Assertion_name/g;
         @all_columns = split /\s+/.$line;
         $all_sat_summary{$file_name}{total}{uncheked} = 0;
       } else if ($line = ~/Total Assertion/) {
         $all_ast_summr{$filename}{total}{string} = $line;
       } else {
         $line = ~s/never/0/g;        
         $line = ~s/^\s+)off(\s+)(\d)+/$1$3$2$3/g;
         $line = ~s/^\s+(.*)/$1/g;
         my @tmp_column = split /\s+/,$line;
         my $property_name = pop @tmp_column;
         for my $i(0.. $#tmp_column){
           if (exists $all_property{$property_name}) {
           } else {
             push @all_properties, $property_name;
           }
           if (exists $all_property{$property_name}{$all_coumns[$i]}) {
             $all_property{$property_name}{$all_coumns[$i]} += $tmp_column[$i];
           } else {
             $all_property{$property_name}{$all_coumns[$i]} = $tmp_column[$i];
           }
         }
         if ($tmp_column[1] == 0 && $tmp_column[2] == 0){
           $all_ast_summary{$file_name}{total}{unchecked} += 1;
         }
         for my $i(0..$#tmp_column){
           $all_ast_summry{$file_name}{$property_name}{$all_columns[$i]} = $tem_column[$i];
         }
       }
   }
   close ASTF;
  }
  closedir ASTD;
}

sub print_log{
  my $self_start_time = local_time;
  my $ast_no_cnt =0;
  my $uncheck_no_cnt =0;
  my $failed_no_cnt =0;
  open(OUTF, ">$ast_sum_log" or die "$!\n");
  printf(OUTF "SVA Log Merged Time : %s\n\n", $self_start_time;
  for my $property_name(@all_properties) {
   if($all_property{$property_name}{$all_columns[1]} == 0) {
     if($all_property{$property_name}{$all_columns[2]} == 0) { 
       $uncheck_no_cunt +=1;
     }
   }
   if($all_property{$property_name}{$all_columns[2]} > 0) { 
     $failed_no_cnt +=1;
   }
   $ast_no_cnt += 1;
  }
  printf OUTF "\n*1.SUMMARY\n";
  printf OUTF "SVA ALL Num:$ast_no_cnt \n";
  printf OUTF "SVA ALL Uncheck Num:$uncheck_no_cunt  \n";
  printf OUTF "SVA ALL Failed Num:$failed_no_cnt \n";
  printf OUTF "\n*2. PER AST DETAIL \n";
  my @print_columns = ("DIsable", "Finish", "Failed"){
  print OUTF "%10s%10s%10s, Assertion Name \n", $print_column[0],$print_column[1],$print_column[2];   
  for my $property_name(@all_propertys){
   for my $i(0..$#property_columns){
     print OUTF "%10s, $all_property{$property_name}{$all_columns[$i]}";
     }
  print OUTF "%s\n", $perperty_name;
  }
  printf OUTF "\n*3. Sum Case Ast Info:\n";
  for my $ast_sum_name( sort \<eq>, %all_ast_summary){
   my $total_line = $all_ast_summary{$ast_sum_name}{total}{slog};
   my $cur_unchecked = $all_ast_summary{$ast_sum_name}{total}{unchecked};
   if ($cur_unchecked == 0) {
     print OUTF "%-108s:%s\n", $ast_sum_name,$total_line;
   } else {
     $total_line =~s/Unchecked Assertions = 0/Unchecked Assertion = $cur_unchecked/s;
     print OUTF "%-108s:%s\n", $ast_sun_name, $total_line;
   }
  }
  clost OUTF;
  print "Done, please check $ast_sum_log\n";
}
 

  



点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 8

    获赞
  • 34

    评论
  • 访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-8 18:35 , Processed in 0.015444 second(s), 12 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部