2021年4月22日 星期四

Plot CCS waveform with analyze_ccs command

Builds earlier than 19.12-294_148:
command: analyze_ccs -verbose -comp_nldm 2 -gui 0

Builds latter than 19.12-294_148:
command: analyze_ccs  -comp_nldm 2 -report_log

### command: gnuplot -p gnuplot.cmd
### load waveform data from files ###

waveform0 = 'slew_0.002825_load_0.000183/waveform_simulation.txt'
waveform1 = 'slew_0.002825_load_0.000183/waveform_CCS.txt'
set multiplot layout 2,1 rowsfirst

### --- sub-figure 1: current

set xlabel 'time'
set ylabel 'current'
set grid
# set xrange [0:2e-10]
set datafile missing "NaN"
plot waveform0 using 1:2 with lp lc 3 pt 4 t "curr-simulation", \
       waveform1 using 1:2 with lp lc 4 pt 5 t "curr-CCS"

### --- sub-figure 2: voltage
set xlabel 'time'
set ylabel 'voltage'
set grid
# set xrange [0:2e-10]
set datafile missing "NaN"
plot waveform0 using 3:4 with lp lc 5 pt 6 t "volt-simulation", \
       waveform1 using 3:4 with lp lc 6 pt 7 t "volt-CCS"
unset multiplot


2021年3月7日 星期日

Fix LBDB-889/LBDB-885

 #! /usr/local/bin/perl 

$dir = "RESULT_DC_LIB_w_normalize_waveform";
mkdir $dir if (!-d $dir); 

open (AA, "ls *.lib |") or die;
while (<AA>){
    chomp;
    push @libs, $_;
}
close AA; 

foreach $lib (@libs){
    chomp ($base_lib = `basename $lib`);
    $out = $dir."/".$base_lib; 

    ($libname = $base_lib) =~ s/\.lib//;
    open (AA, $lib) or die;
    open (BB, ">$out") or die;
    while (<AA>){
        if (/^library \(/){
            print BB "library ($libname) {\n";
        } elsif (/nom_temperature \: (\S+)\;/){
            $p_temp = $1;
            print BB;
        } elsif (/nom_voltage \: (\S+)\;/){
            $p_vol = $1;
            print BB;
        } elsif (/^  cell \((\S+)\)/){
            $p cell = $1;
            if ($p_cell =~ /DCAP/ or $p_cell =~ /ANTENNA/ or $p_cell =~/BHD/ or $p_cel1=~/BOUNDARY/ or $p_cell =~/FILL/ or $p_cell =~/TAPCELL/){
                $arc=1;
                while (<AA>){
                    if (/\{/) { $arc +=1; }
                    if (/\}/) { $arc -=1; }
                    last if ($arc==0);
                    }
                } else {
                        print BB;
                }
        } elsif (/^\s*operating_conditions/) {
                print BB "  library_features (report_delay_calculation);\n";
                print BB $_;
                while (<AA>){
                    if (/^(\s*temperature)/){
                        $attr = $1;
                        print BB "$attr : $p_temp;\n";
                    } elsif (/^(\s*voltage)/){
                        $attr = $1;
                        print BB "$attr : $p_vol;\n";
                    } elsif (/\}/){
                        print BB;
                        last
                    } elsif (/process\s+\:\s+1/){
                        if ($libname=~/ssgnp/){
                            print BB "    process : 1; /* SSGNPGlobalCorner_LocalMC_MOS_MOSCAP */\n";
                        } elsif ($libname=~/ffgnp/){
                            print BB "    process : 1; /* FFGNPGlobalCorner_LocalMC_MOS_MOSCAP */\n";
                        } else {
                            print BB;
                            print "[Warning] Cannot judge process corner by judging library file name ($libname)\n";
                        }
                        } else {
                            print BB;
                        
                }
            } elsif (/^\s*cell_footprint/){
            #} elsif (/^\s*area \:/){
                print BB $_;
                if ($p_cell =~ /MB4LVLSRAN2LHCWWRD2BWP360H10P66PDLVT/){
                    print BB "pg_pin (VBB) {\n";
                    print BB "  pg_type : pwell;\n";
                    print BB "  voltage_name : VBB;\n";
                    print BB " physical_connection : device_layer;\n";
                    print BB "}\n";
                    print BB "pg_pin (VDD) {\n";
                    print BB "  pg_type : primary_power;\n";
                    print BB "  voltage_name : VDD;\n";
                    print BB "  related_bias_pin : VPP;\n";
                    print BB "}\n";
                    print BB "pg_pin (VDDO) {\n";
                    print BB "  pg_type : primary_power;\n";
                    print BB "  voltage_name : VDDO;\n";
                    #print BB " related_bias_pin : VPP;\n";
                    print BB "}\n";
                    print BB "pg_pin (VPP) {\n";
                    print BB "  pg_type : nwell;\n";
                    print BB "  voltage_name : VPP;\n";
                    print BB "  physical_connection : device_layer;\n";
                    print BB "}\n";
                    print BB "pg_pin (VSS) {\n";
                    print BB "  pg_type : primary_ground;\n";
                    print BB "  voltage_name : VSS;\n";
                    print BB "  related_bias_pin : VBB;\n";
                    print BB "}\n"; 
                } else {
                    print BB "pg_pin (VBB) {\n";
                    print BB "  pg_type : pwell;\n";
                    print BB "  voltage_name : VBB;\n";
                    print BB "  physical_connection : device_layer;\n";
                    print BB "}\n";
                    print BB "pg_pin (VDD) {\n";
                    print BB "  pg_type : primary_power;\n";
                    print BB "  voltage_name : VDD;\n";
                    print BB "  related_bias_pin : VPP;\n";
                    print BB "}\n";
                    #print BB "pg_pin (VDDI) {\n";
                    #print BB "  pg_type : primary_power;\n";
                    #print BB "  voltage_name : VDDI;\n";
                    #print BB "  related_bias_pin : VPP;\n";
                    #print BB "}\n";
                    print BB "pg_pin (VPP) {\n";
                    print BB "  pg_type : nwell;\n";
                    print BB "  voltage_name : VPP;\n";
                    print BB "  physical_connection : device_layer;\n";
                    print BB "}\n";
                    print BB "pg_pin (VSS) {\n";
                    print BB "  pg_type : primary_ground;\n";
                    print BB "  voltage_name : VSS;\n";
                    print BB "  related_bias_pin : VBB;\n";
                    print BB "}\n";
                }
            } elsif (/^\s*pg_pin/){
                while (<AA>){
                    last if (/\}/);
                }
            } else {
                    print BB;
            
        }
        close AA;
        close BB;

}

2021年1月28日 星期四

check non-monotonic in dc_current

 #!/usr/bin/perl
use Term::ANSIColor;
my $input_library = $ARGV[0];

# $index --> 29 dc_current
$dc_current_flag=0; $index=0; $line=0; $increase=0; $decrease=0;

open(LIB,"<input_library");
while(<LIB>){
    $line++;
    if ($dc_current_flag=="4") {
        $original=$_; $increase=0; $decrease=0;
        $_ =~ s/"//g; $_ =~ s/,//g; $_ =~ s/\\//g;
        @aryl=split(" ",$_); $array_size = $#ary1+1;
        for ($i=0; $i<$array_size-1;$i++) {
            if ($aryl[$i] > $aryl[$i+1]) {$increase=1;} # detect increment
            if ($aryl[$i] < $aryl[$i+1]) {$decrease=1;} # detect decrement
        }
        if ($increase=="1" && $decrease=="1") {
            ## Values are non-monotonic when increment and decrement in same line
            print "LINE $line is non-monotonic, the VALUE is \n";
            for ($i=0; $i<$array_size-1; $i++) {
                    if ($ary1[$i] > 
$ary1[$i+1]) {print color("blue")."$ary1[$i] ";} # detect increment
                    if ($ary1[$i] < $ary1[$i+1]) {print color("red")."$ary1[$i] ";} # detect decrement
            }
            print "\n"; print color ('reset');
            #print "$original";
        } 

        ++$index;
        if ($index=="29") {$dc_current_flag=0; $index=0;}
    

    if (/dc_current \(/) {$dc_current_flag=1;}
    if ($dc_current_flag>0) { if (/index_1 \(/) {$dc_current_flag=2;}}
    if ($dc_current_flag>0) { if (/index_2 \(/) {$dc_current_flag=3;}}
    if ($dc_current_flag>0) { if (/values \(/) {$dc_current_flag=4;}}
}
close (LIB);

2021年1月26日 星期二

病毒英文


疫苗一詞「vaccine」源自於愛德華·金納所使用的牛痘。「vacca」為拉丁文,意即牛。

 pandemic (from Greek πᾶνpan, "all" and δῆμοςdemos, "people" the 'crowd') is an epidemic of an infectious disease that has spread across a large region, for instance multiple continents or worldwide, affecting a substantial number of people. 

novel coronavirus (n.) 新冠病毒(武漢肺炎)novel 當名詞為小說,當形容詞為新型的

outbreak (n.) 病毒爆發

droplet infection (n.) 飛沫傳染

quarantine (n.) 檢疫隔離 home isolation (n.) 居家隔離 / hospital quarantine (n.) 住院隔離
The word "quarantine" originates from quarantena, the Venetian language form, meaning "forty days".[15][3] This is due to the 40-day isolation of ships and people practised as a measure of disease prevention related to the plague

stockpile 囤貨
incubation period 潛伏期Incubate 是動詞,指「(細菌或病毒在體內)潛伏」
contract / catch / be infected with 感染、患上
Contract 是動詞「感染、患上」的意思,這是比較正式的用詞,一般也可以用 catch 來表示相同意思,後面直接加上疾病名稱。
precaution 預防、預防措施

mix and match 混打、booster shot 追加劑、疫苗混打(mixing vaccines)

一劑疫苗可以用dose (n),名詞「劑量」即為dosage

immune system 免疫系統、immune response (免疫反應)

2020年12月21日 星期一

Extract CCST and integrate current to Voltage with new formula

 #!/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 (/nom_voltage /) {
            s/;//;
            @rail_voltage=split(":",$_);
            $rail_voltage=$rall_voltage[1];
            print "Rail Voltage is $rall_voltage\n";
            print "95% of Rail Voltage is ".$rall_voltage*0.95."\n";
            }}
    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/ref erence_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; $starting_v=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 : gnuplot_ccst.txt \n"; 
open(VOLTAGE, "gnuplot_voltage.txt") || die "Can not open the file : gnuplot_voltage.txt \n"; while(<CCST>){
    chop $_;
    $_ =~ s/^\s+|\s+$//g ;          ## remove space
if ($i=="1") {$ref_time=$_;} ## reference_time
if (Si=="2") {$slew=$_;}       ## slew
if (Si=="3") {$load=$_;}       ## load
if (Si=="4") {                          ## time steps
    @aryl=split(",",$_);
    $max_index_3 = max @aryl;
    $min_index_3 = min @aryl;
    push (@accumulated_max_index_3, $max_index_3);
    push (@accumulated_min_index_3, $min_index_3);
    #print "The index_3 size is " ; print scalar @aryl; 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 = $#aryl+1;
    for ($j=0; $j<$array_size; $j++) {
        print TEMFILE "$aryl[$j] ";
        print TEMFILE "$ary2[$j]\n";
        }
    for ($j=0; $j<$array_size; $j++) {
        print VOLTAGE "$aryl[$j] ";
            if ($j == "0") {$voltage=$starting_v;}
            if ($j > 0) { 
                $avg_current=$ary2[$j];
                $time_step=$aryl[$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;

## To check if final voltage reached 95% of VDD
    #print "Rail voltage: Srail_voltage Final voltage: $voltage 95% of Rail voltage:
    if (abs($voltage) < ($rail_voltage*0.95)) {print "last voltage point $voltage doesn't reach 95% of VDD at CCST#$t\n";}
        }
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 : gnuplot_ccst.txt \n";
    open(VOLTAGE, ">gnuplot_voltage.txt") || die "Can not open the file : gnuplot_voltage.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 = $#aryl+1;
##print "$array_size \n";
##print scalar @aryl;
##print scalar @ary2; 
close(CCST);
close(TEMFILE);
close(VOLTAGE); 

2020年9月8日 星期二

用英文禮貌回應對方的感謝

 https://buzzorange.com/vidaorange/2019/12/09/16-responses-to-thank-you/

非正式、口語

1. You’re welcome.

這大概是最常聽到、英文學習者使用率最高的一句了,不過我們如果再延伸一點,加上 very 的話,可以用來強調自己是誠心誠意地在回覆對方的感謝,寫成 You are very welcome! 像 Lucy 舉的這個例子:

A: Thank you so much for packing my shopping for me.(謝謝你幫我裝好我買的東西。)

B: Oh, you’re very welcome.(喔,完全不需要客氣。)

Lucy 在影片中有提到,這是很英式的說法,如果你哪天剛好要去英國,不妨試試這樣的說法喔!

2. No problem!

這是比較偏美式的用法,老一輩似乎比較不喜歡這樣的回答方式,要小心。

A: Thanks for the help today.(謝謝你今天的幫忙。)

B: No problem. I enjoyed helping you.(不客氣。我很樂意幫忙。)

3. Thank you.

看到這樣的回應方式,你可能覺得有些奇怪,怎麼在說「謝謝你」?記得,這種回應方式的重點完全在「語氣的強調」,也就是說,如果有人感謝你,但你覺得應該是對方要被感謝才對,你就可以這樣說。

A: Thanks for accepting the invitation.(謝謝你接受我的邀請。)

B: Thank YOU!(我才要謝謝你!)

像這樣就是在強調「我其實才該感謝對方,因為他們大方邀請我。」

4. The pleasure is mine!

這句話如果像這樣完整說,其實會顯得比較正式,但我們可以簡短表示,像 My pleasure!「我的榮幸!」或是 Pleasure!「別客氣!」。

A: Thanks for taking the parcel in for me.(謝謝你幫我把包裹拿進來。)

B: Pleasure!(別客氣!)

5. I know you’d do the same for me!

這是一種相當友善的用法喔,適合用在熟人身上,完整寫出來的話會是 I know you would do the same for me. 例如:

A: I’d like to thank you for looking after my cat so well.(我想謝謝你把我的貓照顧得那麼好。)

B: I know you’d do the same for me.(我知道你也會為了我這麼做。)

意思就是說「我知道如果換成是你,你也會照顧我的貓,我們互相啦。」

6. That’s all right!

這個說法相對隨興,甚至有時候如果語調稍微一變,會顯得你不太在乎,所以「語氣」很重要喔!像是以下這個情境:

Thank you for picking me up from the station.(謝謝你把我從車站接回來。)

如果你很樂意去接人家,語氣可能就會是:That’s all right!(沒什麼啦!)

如果是心不甘情不願去接,又藏不住情緒,可能就會說:That’s all right.(沒什麼。)

7. No worries!

接下來這句也相當隨興,例如:

A: Thanks for letting me know that my car alarm was going off.(謝謝告訴我車子的防盜警報器響了。)

B: No worries. I thought I’d better tell you.(不會。我想說最好跟你說一聲。)

8. Don’t mention it!

這種說法也很英式,而且很自謙,舉個例子:

A: Thank you so much for bringing the dessert.(謝謝你帶甜點來。)

B: Oh! Don’t mention it!(不用謝啦!)

這種意思就像在表達「雖然帶著甜點來可能很麻煩,我們可能也想要聽到你的感謝,但還是會說『不用謝啦!』」。

9. It was the least I could do!

講出這樣的話,可以讓人感到你的真心誠意,是非常誠懇的說法喔,它一樣很英式,例如:

A: Thank you for visiting me in hospital.(謝謝你到醫院探望我。)

B: Oh, it was the least I could do.(喔,這點事根本算不了什麼。)

10. Anytime!

這句也是相當的口語,而且很大方,例如:

A: Thank you for stopping by.(謝謝你順道過來。)

B: Oh, anytime!(噢,不會啦!)

11. Sure!

這個用法非常美式、非常隨興,常常會跟 No problem! 一起用,講成 Sure, no problem!

A: Thank you for thinking of me.(謝謝你想到我。)

B: Sure!(不會!)或是 Sure, no problem!(不會啦。不客氣。)

12. It was nothing!

以這種方式回應感謝可以讓對方感受到,你覺得他們感謝你的事情其實一點都不麻煩。

A: Thank you for picking my kids up from school.(謝謝你們到學校接我小孩下課。)

B: It was nothing. My kids already needed picking up. No extra effort here.(那沒什麼啦。我也需要載我小孩啊。一點都不麻煩的。)

正式、適合商業或是店面經營

13. Much obliged!

這是一種很英式的說法,而且相當老派,它的完整版是:I’m very much obliged to you.「我不勝感激。」

Thank you so much, doctor. I’m very much obliged to you.(醫生,很謝謝你。感激不盡。)

14. You’re most welcome!

一般來說,只有在很正式場合才會這樣來回應對方的感謝,像影片中 Lucy 提到,她的律師是個嚴謹的人,那前幾天他們講完有關法律的事情,在跟她的律師說謝謝的時候,得到的就是這個回應:You’re most welcome!「無須客氣!」

15. We appreciate your business!

如果是商業方面的對象就很適合這種說法,舉個例子:

A: Thank you for sending the sample so promptly.(感謝您如此快速寄送樣品。)

B: We appreciate your business.(我們很感謝貴公司的合作。)

16. I’m happy to help!

最後這句絕對適合在職場使用,哪天在辦公室或上班的地方遇到類似情境,可以試著運用這句到你們的對話中喔!

A: Thank you for helping me carry the coffees to the office.(謝謝你幫我把咖啡拿到辦公室。)

B: Oh, I’m happy to help.(喔,我很樂意幫忙。)

複習完這麼多可以說「不客氣」的用法,也要記得找機會真正運用,才會進步喔!

2020年7月8日 星期三

untar all files

#!/bin/csh
    foreach filename (`ls *.tgz | sed -r "s/\x1B\[[0-9;]*[mK]//g"`)
    tar -zxvf $filename
end

標籤