2018年3月30日 星期五

[IC] Flow


spec -> design -> layout -> foundry -> package/test


IC分成Analog IC以及Digital IC,

AIC
spec -> circuit design -> fully layout -> gds

DIC
spec -> HDL design -> APR -> gds



EDA 在 frond-end 的工作簡單來說就是負責把 HDL 轉成電路圖(這邊的專有名詞是叫 net-list),轉的過程中當然也就包含叫對轉出來的電路圖做最佳化,最佳化的內容可以簡單的區分成兩個:對面積做最佳化、對時間做最佳化。當然,合成完後必定會測試合成後的電路有沒有 bug,所以也就會有 simulation tool 來模擬電路的行為、verification tool 做更完整的驗證、以及各種用來輔助計算電路各項特性的軟體。





ref:
http://learningonlykals.blogspot.tw/2016/04/whats-apr.html
https://shininglionking.blogspot.tw/2013/05/2-ic.html

2018年3月29日 星期四

[SD] speed of version update


匯流排介面SD標誌匯流排標誌匯流排速度版本
Normal SpeedSD SDHC SDXC12.5MB/s1.01
High Speed25MB/s2.00
UHS-ISDHC SDXCI50MB/s(SDR50, DDR50)
104MB/s(SDR104)
3.01
UHS-IIII156MB/s(FD156)
312MB/s(HD312)
4.00/4.10[3]
UHS-IIIIII312 MByte/s (FD312)
624 MByte/s (FD624)
6.0[4]



最低寫入速度Speed ClassUHS Speed ClassVideo Speed Class應用
MB/sSDHC Speed Class 2.svg Class 2 (C2)--標準畫質拍攝
4 MB/sSDHC Speed Class 4.svg Class 4 (C4)--高畫質拍攝
6 MB/sSDHC Speed Class 6.svg Class 6 (C6)-Video Speed Class 6.png Class 6 (V6)
10 MB/sSDHC Speed Class 10.svg Class 10 (C10)UHS Class 1.png Class 1 (U1)Video Speed Class 10.png Class 10 (V10)全高畫質拍攝 (HS), 實時廣播及高畫質影片 (UHS)
30 MB/s-UHS Class 3.png Class 3 (U3)Video Speed Class 30.png Class 30 (V30)4K影片 60/120 fps (UHS)
60 MB/s--Video Speed Class 60.png Class 60 (V60)8K影片 60/120 fps (UHS)
90 MB/s--Video Speed Class 90.png Class 90 (V90)
Application Performance ClassMinimum sustained sequential writing speedMinimum random readMinimum random write
Application Performance Class 1.png Class 1 (A1)10 MB/s1500 IOPS500 IOPS
Application Performance Class 2.png Class 2 (A2)4000 IOPS2000 IOPS





SMI Micro SD Controller





AS Micro SD Controller

ref:
http://www.asolid-tek.com/products.php?lang=2&cat=1
http://www.siliconmotion.com/A3.2_Partnumber_Detail.php?sn=6
https://zh.wikipedia.org/wiki/SDXC

[SSD] SMI, PCIE Family








SMI Product

ProductHost StandardsFlash InterfaceECC SupportVoltage SupportDRAMTCG/AESPackage
SM2262PCIe Gen3 x4 NVMe 1.38-CHConfigurable LDPC ECC3.3VYesYesTFBGA472
SM2263PCIe Gen3 x4 NVMe 1.34-CHConfigurable LDPC ECC3.3VYesYesTFBGA288
SM2263XTPCIe Gen3 x4 NVMe 1.34-CHConfigurable LDPC ECC3.3VNo DRAMYesTFBGA288
SM2260PCIe Gen3 x4 NVMe 1.28-CHConfigurable LDPC ECC3.3VYesYesTFBGA472
SM2259SATA 6Gb/s
(Revision 3.1)
4-CHConfigurable LDPC ECC3.3VYesYesTFBGA336
SM2258SATA 6Gb/s (Revision 3.1)4-CHConfigurable LDPC ECC3.3VYesYesTFBGA323
SM2258XTSATA 6Gb/s (Revision 3.1)4-CHConfigurable LDPC ECC3.3VNo DRAM--TFBGA144
SM2246ENSATA 6Gb/s (Revision 3.1)4-CHConfigurable BCH ECC3.3VYesYesTFBGA288
SM2246XTSATA 6Gb/s (Revision 3.1)4-CHConfigurable BCH ECC3.3VNo DRAM--TFBGA144

Ref:
http://www.siliconmotion.com/A3.2_Partnumber_Detail.php?sn=7
https://nvmexpress.org/?s=ssd
https://www.mentor.com/products/fv/simulation-verification-ip/pcie

2018年3月20日 星期二

[c++] printf format



函式原型:  int printf ( const char * format, ... ); 

引數說明: %[flags][width][.precision][length]specifier
                
%[旗標][寬度][.精度][長度修飾]資料型態

 

1. 資料型態 %[旗標][寬度][.精度][長度修飾]資料型態 ) 必填欄位 

(1.1) 字元/字串

   %c, %C : 字元,  char c;
       %s :
字元陣列, char buffer[MAX_PATH];
       %S :
字元陣列(Unicode), wchar buffer[MAX_PATH];

[] %C / %S 並未被收在標準函式庫裡,屬 MSVC 特殊支援。

(1.2) 整數


    %d, %i : 10進制整數  , int x; [lemma] 
        %u : 10進制無號數, unsigned int x;
        %o : 8
進制無號數,  unsigned int x;
     %x, %X : 16
進制無號數, 小寫x輸出為"abcdef", 大寫 X 輸出為 "ABCDEF", 
              unsigned x;
%lld, %I64d : long long int, __int64 
輸出型態
             
(註:vc6.0 下只有 __int64,沒有long long int)
%llu, %I64u : unsigned long long int  
輸出型態

[lemma] %d : dec; %i : integer,於 scanf 時有部份差異 (%d 只接受10進位, %i 可接受指定進位,如 0x23, 045),但於 printf %d, %i 並無顯著差異 (感謝 Jacob Lee 補充指導)

 

(1.3) 浮點數

   %e, %E :
浮點數使用科學符號表示之,指數將帶正負號, float x,doubley;
       %f : 單精度浮點數(預設輸出精度6), float x;
           
 ( : printf 而言, %f/%lf 可適用於 double / float)
      %lf : 倍精度浮點數(預設輸出精度6), double x;
%llf, %LF :
雙倍精度浮點數(預設輸出精度6), long double x;
   %g, %G :
由系統決定是否採科學符號表示。

(1.4) 特殊 原創:edisonx.pixnet.net

       %p : 變數位置。 ex:
            int a=0, printf("%p", &a); 
printf("%08x", &a);
       %n : 輸出至緩衝區之長度, ex:
            char str[]="test", int len, printf("%s%n", a, &len);
            
輸出4bytes,len = 4

(1.5) C99新增 < 建議 k spec. 最清楚 >

( : C99 新增了一些資料型態在 inttypes.h / stdint.h 裡面,有興趣搜尋 n1256.pdf 下載下來 K 標準, in section 7.8 。當然 MSVC 不支援 C99 是眾所皆知的事。)

部份原則還是掌握了 %i, %u, %d, %x,另由於這部份在 printf 會顯得很亂,故直接做範例對應。掌握一原則:新的資料型態在 printf 前三個字母一定是 PRI

   "%" PRIdN , "%" PRIiN: 以十進位有號數顯示 intN_t 系列之數值。ex : 

         int8_t i8  = 8  ; <----> printf( "i8 = %" PRId8  " \n", i8);
         int8_t i16 = 16 ; <----> printf( "i16= %" PRIi16 " \n", i16);
         int8_t i32 = 32 ; <----> printf( "i32= %" PRId32 " \n", i32); 
         int8_t i64 = 64 ; <----> printf( "i64= %" PRIi64 " \n", i64); 

 

另上述將 PRIdN / PRIiN ,換成 PRIoN / PRIuN / PRIxN / PRIXN ,便可轉對 uintN_t 資料型態做輸出,分別為 ( 8 進位、10進位、16進位小寫、16進位大寫),有空自己試試,不贅述。 

 

   "%" PRIdLEASTN , "%" PRIiLEASTN: 以十進位有號數顯示 int_leastN_t 系列之數值。ex : 

         int_least8_t  i8  = 8  ; <----> printf( "i8 = %" PRIdLEAST8  " \n", i8);
         int_least16_t i16 = 16 ; <----> printf( "i16= %" PRIiLEAST16 " \n", i16);
         int_least32_t i32 = 32 ; <----> printf( "i32= %" PRIdLEAST32 " \n", i32); 
         int_least64_t i64 = 64 ; <----> printf( "i64= %" PRIiLEAST64 " \n", i64); 

 

 另上述將 PRIdLEAST/ PRIiLEAST 換成 PRIoLEASTN/ PRIuLEASTN/ PRIxLEASTN/ PRIXLEASTN 便可轉對 uint_leastN_t 資料型態做輸出,分別為 ( 8 進位、10進位、16進位小寫、16進位大寫),有空自己試試,不贅述。 

 

    "%" PRIdFASTN , "%" PRIiFASTN: 以十進位有號數顯示 int_fastN_t 系列之數值。ex : 

         int_fast8_t  i8  = 8  ; <----> printf( "i8 = %" PRIdFAST8  " \n", i8);
         int_fast16_t i16 = 16 ; <----> printf( "i16= %" PRIiFAST16 " \n", i16);
         int_fast32_t i32 = 32 ; <----> printf( "i32= %" PRIdFAST32 " \n", i32); 
         int_fast64_t i64 = 64 ; <----> printf( "i64= %" PRIiFAST64 " \n", i64); 

 

 另上述將 PRIdFAST/ PRIiFAST,換成 PRIoFASTN/ PRIuFASTN/ PRIxFASTN/ PRIXFASTN,便可轉對 uint_leastN_t 資料型態做輸出,分別為 ( 8 進位、10進位、16進位小寫、16進位大寫),有空自己試試,不贅述。 

 

   "%" PRIdMAX , "%" PRIdPTR : 分別顯示整數最大值與指標型態。

 

[ : 特別注意 inttypes.h 裡面之型態,printf 引數和 scanf 引數差很多,一樣掌握一原則,新的資料型態在 scanf 前三個字母一定是 SCN  intN_t  系列,scanf 用的是 "%" SCNdN / "%" SCNi uintN_t 系列,scanf 用的是 "%" SCNoN / "%" SCNu/ "%" SCNxN / "%" SCNX int_fastN_t / int_leastN_t 等系列資料型態便不贅述。 )

 

2. 寬度 %[旗標][寬度][.精度][長度修飾]資料型態 ) 選填欄位net

      %m : 指定輸出之寬度。ex:
           int a=2, b=10;
           printf("%d%5d", a, b);
          
輸出為   "2   10"  (210之間有3個空白,因105個文字寬度)
      %* :
以引數方式代入指定輸出之寬度。ex:
           int a=2, width=10;
           printf("%*d",width, a);
          
輸出為   "         2"  (10個文字寬度)

3. 長度修飾 ( %[旗標][寬度][.精度][長度修飾]資料型態 ) 選填欄位

 

      %h : 將數字視為 short int (%hd)  unsigned int (%hu),
          
此修飾只對整數型態之 %hi, %hd, %ho, %hu, %hx, %hX 有效。
           
且針對 char 可用 %hhdunsigned char 可用 %hhu

     ( : MSVC 認得 %hd / %hu / %hhd / %hhu , 但在 gcc 下會發出認不得的警告 )

      %l : 將數字視為 long  int (%ld)  unsigned long int (%lu), 
          
此修飾只對整數型態之 %li, %ld, %lo, %lu, %lx, %lX 有效。
      %L :
此修飾只對浮點數型態之 long double 有效, 可用於修飾
           %Le, %LE, %Lf, %Lg, %LG

4. 精度 ( %[旗標][寬度][.精度][長度修飾]資料型態 ) 選填欄位 

     %.n : 欲輸出小數點後幾位數,即顯示之精度,此修飾只對浮點數資料型態有效(f,F,e,E,g),
          
若使用其它整數型態 (i, d, o, u, x, X) 則將 n 視為 0, 即不輸出小數位數。ex:
           double a=2.1234, printf("%.2lf", a);
           
輸出則為  "2.12" 
     %.* :
%.n 相似,但其 n 值可用變數引入。ex:
           double a=1.3456, int preci=2, printf("%.*lf",preci, a);
           
輸出則為  "1.35"
     %m.n:
這是寬度和精度合用之方法, 代表輸出會有小數點後 n 位,
          
且整個輸出文字寬 m 個字(包含小數點、正負號及數字)ex:
           double c = -102.34567, printf("%10.3lf", c);
          
結果會輸出  "  -102.346" ,前面將會保留二個空白,使得整體寬度為 10
     %*.*: 
和上一說明一樣, 但寬度與精度可用引數決定。ex:
           double c = -102.34567, int m=10, int n=3;
           printf("%*.*lf", m, n, c);
          
結果會輸出  "  -102.346" ,前面將會保留二個空白,使得整體寬度為 10

5. 旗標 ( %[旗標][寬度][.精度][長度修飾]資料型態 ) 選填欄位 

       %- : 原本輸出預設為向右對齊,使用後輸出向左對齊, 需與[寬度]配合使用。ex:
            char buf[] = "Test";
            printf("%-10s");
           
輸出結果為 "Test      " Test 後面將保留6個空白。             
       %+ : 
需為數值型之資料型態,強制輸出正負號,可與 '-' 旗標合用。 ex:
            double a = 3.4567:
            printf("%-+8.2lf", a);
            // '-'
使輸出靠左對齊, '+'強調輸出正負號, 整體寬度為8, 小數點顯示2位。
           
輸出結果為 "+3.46   "
       %0 : 
若輸出之左半部為空白處, 則進行補0, (所以這不能和 '-' 合用) ex:
            unsigned int x = 122;
            printf("%05u", x); 
            // 
寬度為5, 前半空白補零
           
輸出結果為 "00122"
       %# :
對進制加上前綴符號, 只對 %o, %x 有用
            %#o
8進制,前綴符號為 0,
            %#x
16進制,前綴符號為 0x, %#X前綴符號則為 0Xex:
            unsigned int a = 15;
            printf("%u %#o %#X", a, a, a);
            
輸出結果為 "15 017 0XF" 
   %(
空白): 若數字為正號, 則會在該數字前面加上一空白,(故不可與 '+' 合用) ex:
            int a=10;
            printf("% -5d"); // 
寬度5, 向左對齊, 保留正號位置
            
輸出結果為 " 10  "

 

Print formatted data to stdout

specifier

Output

Example

d or i

Signed decimal integer

392

u

Unsigned decimal integer

7235

o

Unsigned octal

610

x

Unsigned hexadecimal integer

7fa

X

Unsigned hexadecimal integer (uppercase)

7FA

f

Decimal floating point, lowercase

392.65

F

Decimal floating point, uppercase

392.65

e

Scientific notation (mantissa/exponent), lowercase

3.9265e+2

E

Scientific notation (mantissa/exponent), uppercase

3.9265E+2

g

Use the shortest representation: %e or %f

392.65

G

Use the shortest representation: %E or %F

392.65

a

Hexadecimal floating point, lowercase

-0xc.90fep-2

A

Hexadecimal floating point, uppercase

-0XC.90FEP-2

c

Character

a

s

String of characters

sample

p

Pointer address

b8000000

n

Nothing printed.
The corresponding argument must be a pointer to a 
signed int.
The number of characters written so far is stored in the pointed location.

%

% followed by another % character will write a single % to the stream.

%




specifiers
lengthd iu o x Xf F e E g G a Acspn
(none)intunsigned intdoubleintchar*void*int*
hhsigned charunsigned charsigned char*
hshort intunsigned short intshort int*
llong intunsigned long intwint_twchar_t*long int*
lllong long intunsigned long long intlong long int*
jintmax_tuintmax_tintmax_t*
zsize_tsize_tsize_t*
tptrdiff_tptrdiff_tptrdiff_t*
Llong double


Data Type Ranges

類型名稱

位元組

其他名稱

值的範圍

printf format

scanf format

int

4

signed

2,147,483,648 2,147,483,647

%d

unsigned int

4

unsigned

0 4,294,967,295

%u

__int8

1

char

128 127

%d

%hhd

unsigned __int8

1

unsigned char

0 255

__int16

2

shortshort intsigned short int

32,768 32,767

unsigned __int16

2

unsigned shortunsigned short int

0 65,535

%hu

__int32

4

signedsigned intint

2,147,483,648 2,147,483,647

unsigned __int32

4

unsignedunsigned int

0 4,294,967,295

__int64

8

long longsigned long long

9,223,372,036,854,775,808 9,223,372,036,854,775,807

%I64d

unsigned __int64

8

unsigned long long

0 18,446,744,073,709,551,615

bool

1

false true

char

1

預設為 –128 127

signed char

1

128 127

unsigned char

1

0 255

short

2

short intsigned short int

32,768 32,767

unsigned short

2

unsigned short int

0 65,535

%hu

long

4

long intsigned long int

2,147,483,648 2,147,483,647

unsigned long

4

unsigned long int

0 4,294,967,295

long long

8

(但是相當於 __int64)

9,223,372,036,854,775,808 9,223,372,036,854,775,807

unsigned long long

8

(但是相當於 unsigned __int64)

0 18,446,744,073,709,551,615

enum

視情況而定

請參閱本文件稍後的備註

浮動

4

3.4E +/- 38 (7 位數)

double

8

1.7E +/- 308 (15 位數)

長雙精度

double 相同

double 相同

wchar_t

2

__wchar_t

0 65,535




ref:

http://edisonx.pixnet.net/blog/post/35305668-%5Bc%5D-printf-%E5%BC%95%E6%95%B8%E8%AA%AA%E6%98%8E

http://www.cplusplus.com/reference/cstdio/printf/

https://msdn.microsoft.com/zh-tw/library/s3f49ktz.aspx