2018年12月17日 星期一

grep bisection info

CCMPR01840854 Modified: update bisection_info=4 and vector_dump=1 to reflect non_seq_setup/hold rather than rec/rem

The template has non_seq_hold/setup, but the results of bisection_info=4 only list rec/rem
ec1-hw015 CCMPR01840854 3316> grep VAR-405 */cli* | awk '{print $4}' | sed 's/(/ /' | awk '{print $1}' | sort -u
recover_10
recover_12
recover_18
recover_19
recover_20
recover_21
recover_6
recover_7
recover_8
recover_9
removal_11
removal_13
removal_14
removal_15
removal_16
removal_17
removal_2
removal_3
removal_4
removal_5
setup_0
setup_1


vector_dump only shows rec/rem
cat vectors | awk '{print $2}' | sort -u
recovery_falling
recovery_rising
removal_falling
removal_rising
setup_rising

This is similar to CCMPR01621447, but that only updated the Constraint_map.
This is for the output of VAR-405 (bisection_info=4) and vector_dump=1

2018年10月9日 星期二

Histogram by gnuplot

http://gnuplot-surprising.blogspot.com/2011/09/statistic-analysis-and-histogram.html
histogram.gp
reset
n=100 #number of intervals
max=3. #max value
min=-3. #min value
width=(max-min)/n #interval width
#function used to map a value to the intervals
hist(x,width)=width*floor(x/width)+width/2.0
set term png #output terminal and file
set output "histogram.png"
set xrange [min:max]
set yrange [0:]
#to put an empty boundary around the
#data inside an autoscaled graph.
#set offset graph 0.05,0.05,0.05,0.0
set xtics min,(max-min)/5,max
set boxwidth width*0.9
set style fill solid 0.5 #fillstyle
set tics out nomirror
set xlabel "x"
set ylabel "Frequency"
#count and plot
plot "data.dat" u (hist($1,width)):(1.0) smooth freq w boxes lc rgb"green" notitle

data.dat:
-1.8897
0.5272
-1.3683
-1.7219
0.126
-0.1471
.
.
.
Result:


X axis divided to 10 or 5
set xtics min,(max-min)/10,max                           set xtics min,(max-min)/5,max


實際應用:
1.執行grep_data
grep '|ocv_delay |' comparison.txt | grep '|<' > ocv_delay
cat ocv_delay | awk '{FS="|";print $6;}' > ocv_diff
cat ocv_diff | awk -f max_min.awk

2.將max_min.awk找出的最大/最小值填入 histogram.gp 中
reset
n=100 #number of intervals
max=0.143540 #max value
min=-0.189952 #min value

3.執行histogram.gp
gnuplot histogram.gp
4.用看圖軟體看histogram.png

2018年10月2日 星期二

2018年5月23日 星期三

License issues

1) Set License debugging ENV variables
setenv FLEXLM_DIAGNOSTICS 3
setenv ALTOS_LM_DIAGNOSTICS 1
setenv CDS_LIC_QA_TesT `pwd`/CDS_LOG_FILE


The last one creates a detailed license debug logfile that shows tools and activity. This is the key.

2) Run the target tool/flow

3) Search the CDS_LOG_FILE for relevant tools and hits
> egrep "Checking out|Initialization" CDS_LOG_FILE

3a) "Initialization started" lines show the tool name and PID.
- Use this to track subsequent activity for that process

3b) "Checking out" lines only show license checkouts
- Useful for tracking tools and licenses used
- Does not show all of the rest of the license activity (check FeatureExists, FeatureStatus, etc.) which are additional license server hits and add to the DDoS effect.

Kill processes

pgrep : grep processes

pkill :  pgrep + kill 的功能,也就是說,你可以給 pkill 任何一組字串或正規表示式 ( Regular Expression) 當參數,然後,pkill 就會去找出所有符合指定條件的程序名稱,接著,就會送出一個結束程序的訊號 ( SIGTERM ) 給這些符合條件的程序來結束掉這些程序

killall : 用完整名稱來搜尋要刪除的程序

killall 指令只會完整比對程序名稱的前 15 個字元,因此,如果你要刪除的那堆程序的名稱有超過 15 字的話,那就要加個「e」選項來要求 killall 指令做完整比對,否則,還是有機會讓 killall 指令刪錯

killall -e del-very-long-long-name-processes 

2018年5月14日 星期一

印出檔案的第一行及最後一行

grep:
grep -E 'Thread|TIMESTAMP' test.log | head -1

Sed:
sed -e 1b -e '$!d' test.log
or
印出找到的第一個
sed -n '/TIMESTAMP/{p;q;}' test.log

Awk:
awk 'NR==1; END{print}' test.log

Linux:
(head -n1 && tail -n1) < test.log

2018年3月26日 星期一

extract CCST table for gnuplot

#!/usr/bin/perl
$FILE_NAME = $ARGV[0];
$i=1;
$write_out = 0; $curly_brackets=0; $write_next=0; $start=0;

open(TEMCCST, ">temp_ccst.txt") || die "Can not open the file : temp.txt \n";
open(SearchFile, "<$FILE_NAME");

while(<SearchFile>){
               chop $_;
               if (/cell \(/) {$start = 1;}
               if($start == "1") {
                      if (/output_current/) {$write_out =1;}
               if($write_next == "1") {
                     s/"//g;
                     s/\\//g;
                     print TEMCCST "$_\n"; $write_next=0;}
               if ($write_out == "1") {
                     if (/\{/) {$curly_brackets++;}
                     if (/\}/) {$curly_brackets--;}
                     if (/index_3/) {
                             s/index_3 \("//g;
                             s/"\);//g;
                             print TEMCCST "$_\n";}
                     if (/values/) {$write_next = 1;}
                     if ($curly_brackets== "0") {$write_out = 0;}
                     }
              }
}
close(SearchFile);
close(TEMCCST);

$t=0; $rename=0;
open(CCST, "<temp_ccst.txt") || die "Can not open the file : temp_ccst.txt \n";
open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";
while(<CCST>){
               chop $_;
if ($i=="1") {
             @ary1=split(",",$_);}
if ($i=="2") {
             @ary2=split(",",$_);}
              $i++;

if($i > 2) {
          $array_size = $#ary1+1;
          for ($j=0; $j<$array_size; $j++) {
                       print TEMFILE "$ary1[$j] ";
                       print TEMFILE "$ary2[$j]\n ";
                       }
          $i=1; $rename=1;
           }
if ($rename=="1") {
       close(TEMFILE);
       rename("gnuplot_ccst.txt",CCST.".$t");
       print "CCST file number is $t \n";
       $t++;
       open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";
       $rename=0;
}}

close(CCST);
close(TEMFILE);




Version-II:

#!/usr/bin/perl
$FILE_NAME = $ARGV[0];
$i=1;
$write_out = 0; $curly_brackets=0; $write_next=0; $start=0;

open(TEMCCST, ">temp_ccst.txt") || die "Can not open the file : temp.txt \n";
open(SearchFile, "<$FILE_NAME");

while(<SearchFile>){
               chop $_;
               if (/cell \(/) {$start = 1;}
               if($start == "1") {
                      if (/output_current/) {$write_out =1;}
               if($write_next == "1") {
                     s/"//g;
                     s/\\//g;
                     print TEMCCST "$_\n"; $write_next=0;}
               if ($write_out == "1") {
                     if (/\{/) {$curly_brackets++;}
                     if (/\}/) {$curly_brackets--;}
                     if (/index_3/) {
                             s/index_3 \("//g;
                             s/"\);//g;
                             print TEMCCST "$_\n";}
                     if (/values/) {$write_next = 1;}
                     if ($curly_brackets== "0") {$write_out = 0;}
                     }
              }
}
close(SearchFile);
close(TEMCCST);

use List::Util qw/max min/;
$t=0; $rename=0;
open(CCST, "<temp_ccst.txt") || die "Can not open the file : temp_ccst.txt \n";
open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";
while(<CCST>){
               chop $_;
if ($i=="1") {
             @ary1=split(",",$_);
              $max_index_3 = max @ary1;
              $min_index_3 = min @ary1;
               push (@accumulated_max_index_3, $max_index_3);
               push (@accumulated_min_index_3, $min_index_3);
               print "The index_3 size is " ; print scalar @ary1; print "\n";
               print "The max number of index_3 is $max_index_3 , The min is $min_index_3 \n";}
if ($i=="2") {
             @ary2=split(",",$_);
              $max_value = max @ary2;
              $min_value = min @ary2;
               push (@accumulated_max_value, $max_value);
               push (@accumulated_min_value, $min_value);
               print "The value size is " ; print scalar @ary2; print "\n";
               print "The max number of value is $max_value , The min is $min_value \n";}
              $i++;

if($i > 2) {
          $array_size = $#ary1+1;
          for ($j=0; $j<$array_size; $j++) {
                       print TEMFILE "$ary1[$j] ";
                       print TEMFILE "$ary2[$j]\n ";
                       }
          $i=1; $rename=1;
           }
if ($rename=="1") {
       close(TEMFILE);
       rename("gnuplot_ccst.txt",CCST.".$t");
       print "CCST file number is $t \n";
       $t++;
       open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";
       $rename=0;
}}

$accumulated_max_index_3 = max @accumulated_max_index_3;
$accumulated_min_index_3 = min @accumulated_min_index_3;
$accumulated_max_value = max @accumulated_max_value;
$accumulated_min_value = min @accumulated_min_value;

print "\n";
print "#######################\n";
print "print out max/min index_3/value \n";
print "#######################\n";
print "The whole max/min index_3 are $accumulated_max_index_3/$accumulated_min_index_3 \n";
print "The whole max/min value are $accumulated_max_value/$accumulated_min_value \n";

my $max = max @array;
my $min = min @array;

## Print out size of index_3 and value of CCST
#$array_size = $#ary1+1;
#print "$array_size \n";
#print scalar @ary1;
#print scalar @ary2;

close(CCST);
close(TEMFILE);

Version-III:

#!/usr/bin/perl
$FILE_NAME = $ARGV[0];
$i=1;
$write_out = 0; $curly_brackets=0; $write_next=0; $start=0;

open(TEMCCST, ">temp_ccst.txt") || die "Can not open the file : temp.txt \n";
open(SearchFile, "<$FILE_NAME");

while(<SearchFile>){
               chop $_;
               if (/voltage/) {
                              if (/VDD/) {
                                     s/\);//g;
                                     @rail_voltage=split(",",$_);
                                     $rail_voltage=$rail_voltage[1];
                                                 }} 
               if (/cell \(/) {$start = 1;}
               if($start == "1") {
                      if (/output_current/) {$write_out =1;}
               if($write_next == "1") {
                     s/"//g;
                     s/\\//g;
                     print TEMCCST "$_\n"; $write_next=0;}
               if ($write_out == "1") {
                     if (/\{/) {$curly_brackets++;}
                     if (/\}/) {$curly_brackets--;}
                     if (/index_3/) {
                             s/index_3 \("//g;
                             s/"\);//g;
                             print TEMCCST "$_\n";}
                     if (/reference_time/) {
                             s/reference_time//g;
                             s/://g;
                             s/;//g;
                             print TEMCCST "$_\n";}
                     if (/index_1/) {
                             s/index_1 \("//g;
                             s/"\);//g;
                             print TEMCCST "$_\n";}
                     if (/index_2/) {
                             s/index_2 \("//g;
                             s/"\);//g;
                             print TEMCCST "$_\n";}
                     if (/values/) {$write_next = 1;}
                     if ($curly_brackets== "0") {$write_out = 0;}
                     }
              }
}
close(SearchFile);
close(TEMCCST);

use List::Util qw/max min/;
$t=0; $rename=0;
open(CCST, "<temp_ccst.txt") || die "Can not open the file : temp_ccst.txt \n";
open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";


open(VOLTAGE, ">gnuplot_voltage.txt") || die "Can not open the file : temp.txt \n";
while(<CCST>){
               chop $_;
if ($i=="1") {$ref_time = $_;} ## reference_time
if ($i=="2") {$slew= $_;}        ## slew
if ($i=="3") {$load = $_;}       ## load
if ($i=="4") {                           ## time steps
             @ary1=split(",",$_);
              $max_index_3 = max @ary1;
              $min_index_3 = min @ary1;
               push (@accumulated_max_index_3, $max_index_3);
               push (@accumulated_min_index_3, $min_index_3);
               print "The index_3 size is " ; print scalar @ary1; print "\n";
               print "The max number of index_3 is $max_index_3 , The min is $min_index_3 \n";}
if ($i=="5") {                            ## current steps
             @ary2=split(",",$_);
              $max_value = max @ary2;
              $min_value = min @ary2;
               push (@accumulated_max_value, $max_value);
               push (@accumulated_min_value, $min_value);
               print "The value size is " ; print scalar @ary2; print "\n";
               print "The max number of value is $max_value , The min is $min_value \n";}
              $i++;

if($i > 5) {
          $array_size = $#ary1+1;
          for ($j=0; $j<$array_size; $j++) {
                       print TEMFILE "$ary1[$j] ";
                       print TEMFILE "$ary2[$j]\n ";
                       }
          for ($j=0; $j<$array_size; $j++) {
                       print VOLTAGE "$ary1[$j] ";
                              if ($j == "0") {$voltage=$rail_voltage;}
                              if ($j > 0) {
                                                  $avg_current=($ary2[$j]+$ary2[$j-1])/2;
                                                  $time_step=$ary1[$j]-$ary1[$j-1];
                                                  $voltage_step=($avg_current*$time_step)/$load;
                                                  $voltage=$v_init+$voltage_step;}
                       $v_init=$voltage;
                       print VOLTAGE "$voltage\n ";
                       }
          $i=1; $rename=1;
           }
if ($rename=="1") {
       close(TEMFILE);  close(VOLTAGE);
       rename("gnuplot_ccst.txt",CCST.".$t");  rename("gnuplot_voltage.txt",VOLTAGE.".$t");
       print "CCST/VOLTAGE file number is $t \n";
       $t++;
       open(TEMFILE, ">gnuplot_ccst.txt") || die "Can not open the file : temp.txt \n";


       open(VOLTAGE, ">gnuplot_voltage.txt") || die "Can not open the file : temp.txt \n";
       $rename=0;
}}

$accumulated_max_index_3 = max @accumulated_max_index_3;
$accumulated_min_index_3 = min @accumulated_min_index_3;
$accumulated_max_value = max @accumulated_max_value;
$accumulated_min_value = min @accumulated_min_value;

print "\n";
print "#######################\n";
print "print out max/min index_3/value \n";
print "#######################\n";
print "The whole max/min index_3 are $accumulated_max_index_3/$accumulated_min_index_3 \n";
print "The whole max/min value are $accumulated_max_value/$accumulated_min_value \n";

my $max = max @array;
my $min = min @array;

## Print out size of index_3 and value of CCST
#$array_size = $#ary1+1;
#print "$array_size \n";
#print scalar @ary1;
#print scalar @ary2;

close(CCST);
close(TEMFILE);
close(VOLTAGE);

2018年3月25日 星期日

gnuplot plot example for sim.print and CCST

1.
#!/usr/bin/gnuplot

set ylabel "voltage"
set xlabel "time"
plot "sim.print" using 1:2 with linespoints title "v(ZN)"

set ylabel "current"
plot "sim.print" using 1:3 with linespoints title "i(VZN)"

set ylabel "voltage+current"
plot "sim.print" using 1:2 with linespoints title "v+i", "sim.print" using 1:3 with linespoints title "i(VZN)"

plot "sim.print" using 1:2:3 title "v+i"

2.
set xrange [-2:52]
set yrange [0:0.12]

3.
plot 'battery.dat' using 1:($2*1000):($3*1000)

標籤