# Cell Based Design Flow
###### tags: `Digital IC Design`
[回到主頁面](https://hackmd.io/@derek8955/BkK2Nb5Jo/https%3A%2F%2Fhackmd.io%2FdpcBlBL8TlShpQ-wSi9Quw)
### <font color="blue"> Prerequisites </font>
[阿嬤都能懂的 IC 設計流程](https://www.youtube.com/watch?v=kYUhk6FQwBc)
> 先把這個影片看過一遍會比較有感覺 :haircut:
### <font color="blue"> What Is Cell based Design Flow </font>
在IC設計流程中,主要分成兩個 flow:
1. Full Custom Design Flow, 類比電路的設計流程
2. Cell Based Design Flow, 數位電路的設計流程,如下圖
- cell 的意思是指利用 cell library 來設計一顆 IC
- cell library 會由 IC vendor 提供(例如台積電、聯電)
- cell library 提供了每個製程節點(Proccess node, 5nm、7nm...等 )對應的所有數位電路,像是 flip-flop、latch、and gate、multiplexers ...等。
### <font color="blue"> Cell based Design Flow </font>
||
|:---:|
| Cell based design flow |
||
| Three types of design level |
- Deside IC SPEC and Algorithm
首先決定 IC 的用途與規格( PPA => Performance, Power, Area ),以及查找適合應用於 IC 內的演算法
- Register Transfer Level(RTL)
在這個階段要做以下兩件事 :
1. 利用 HDL(Hardware Description Language, 例如 Verilog, VHDL, …等) 寫電路
2. 寫測試電路(testbench),它會提供電路 clock, reset signal and data,
同時它也會接收電路所算出的結果來驗證功能是否正確,架構如下圖所示

> - 先把 testbench 寫完再開始寫 circuit
> - 在設計的過程中一定會有bug,觀察電路波形圖是否出現異常(利用 nWave 這套工具 )

- Logic Synthesis 邏輯合成
透過 Synopsys 公司的 eda (Electronic Design Automation, 電子設計自動化) tool **design compiler**,將設計完成的電路從 RTL code 轉成 netlist
> 1. 所有在 IC 設計中所使用之軟體都稱之為 EDA tool,包含先前所說的 nWave
> 2. Netlist : 描述電子電路連接情形的一個檔案,會在合成後經由 design compiler 將檔案匯出。
> 3. testbench 只是測試電路,驗證 RTL code 的 functionality 是否正確,所以在做合成的時候不須將其帶入到 design compiler 中。換句話說就是只需對 RTL code 合成

- Design For Testability(DFT)
幫助晶片 tape-out 完後,方便對晶片測試。會在每個正反器前加上多工器,將整個 design 串成一條或多條的 Scan Chain ( 下圖即為一條 )。要針對電路進行測試時,將Scan Enable(SE)設為 high,觀察 Scan In(SI) 到 Scan Out(SO) 的情況。
> 1. 一樣利用 design compiler 來 insert MUX
> 2. 另外還會使用 synopsys 的 Tetramax 來自動產生測試向量(ATPG, Automatic Test Pattern Generator),以觀察 design 的狀況。
> 3. 所謂的 Scan chain 即是電路從 Scan input(SI) 到 Scan output(SO) 的連線有幾條,像下方上圖即只有一條,下圖則有兩條。
||
|:---:|
|一條 Scan Chain|
||
|兩條 Scan Chain,資料來源: https://zhuanlan.zhihu.com/p/201353304|
- Design IO Constraint
決定 IO PAD 的位置。若不需使用 IO PAD 則跳過此步。
> IO PAD 的用途:1. Level Shift(LS),外部電壓通常都比晶片內部的電壓來的高。2. [Electrostatic Discharge(ESD)](https://zh.m.wikipedia.org/zh-tw/%E9%9D%99%E7%94%B5%E6%94%BE%E7%94%B5),防靜電。
:::warning
想進一步了解 IO PAD [可以看這篇文章](https://timsnote.wordpress.com/2017/08/09/pad-selection/)
:::
- Automatic Placement and Routing(APR)
可以透過 synopsys 的 **ic compiler** 與 candence 的 **innovus** 來達成電路實際的 layout
||
|:---:|
| IC 佈局圖 |
> 詳細內容請看後面的文章
- Design Rule Checking(DRC) and Layout Versus Schematic(LVS)
- DRC: 晶圓廠針對自家的製程技術所作的規範,要確保 layout 中是否有違反 design rule(例如 net 的最小寬度、 net 與 net 之間的最小寬度 ...等)
- LVS: 驗證 layout 與原始電路設計之間有無異常

延伸閱讀
===
http://www.ee.ncu.edu.tw/~jfli/vlsidi/lecture08/ch01.pdf
Reference Image
===
[1] https://slidetodoc.com/introduction-to-design-with-vhdl-iay-0600-digital-2/
[2] https://www.researchgate.net/figure/Gate-level-schematic-of-the-full-adder-circuit-used-in-our-experiments_fig1_339176860
[3] https://www.researchgate.net/figure/NOR-gate-Transistor-level-Schematic_fig3_323628216
[4] https://hackmd.io/@gKtGr2bGRYmQTu5DmxguoA/rJB_1B7tx?type=view
[5] http://cc.ee.ntu.edu.tw/~jhjiang/instruction/courses/fall13-lsv/lec01_4p.pdf
[6] https://www.synopsys.com/glossary/what-is-layout-versus-schematic-checking.html