# Lab 3 report
組別:2
組員: 劉祐瑋、陳昇達、劉佩雯
Lab: 3
HackMD link: https://hackmd.io/KXAS8ZMZSdGc5_2W3l1inw?view (歡迎利用此閱讀)
Github link: 本次實驗無
## 目錄
[TOC]
## Script_explain
### Lab Synthesis
#### Script discreption
* Makefile:
Makefile主要執行 dc_shell ./../scripts/compile_for_timing.tcl
使用Design Compile進行logic synthesis,將Verilog或VHDL編寫的設計描述轉換成optimized gate-level netlist,並map到specific logic libary。當synthsis的設計滿足功能性、時序、功率和其他設計目標時,再將設計給icc2進行floor plan、placement and route optimization。

* Main TCL:

* 逐行解釋 Main TCL:
```
第01行:先做基本設定:連結tool path,design library file,constraints file,tech file,output file...
第02行:為了使設計完整,Design Compiler將all cell instances與 library components和設計相連結
第03行:使用者指定standard library,讓Design Compiler mapping設計中的標準單元,像是combinational logic and registers.
第04行:在RTL生成PG pin
第05行:檢查design以及報告錯誤,並且產生中繼檔
第06行:透過第5行產生的中繼檔,將design轉換成technology-independent design(GTECH)
第07行:設定目前design
第08行:連結目前design
第09行:對速度做優化約束
第10行:設定防止multiple-port connections
第11行:去除不重要的警告
第12行:指定在優化過程中排除一些在target library的特定cell
第13行:檢查當前設計的內部表示的一致性,並根據需要發出錯誤和警告訊息
第14行:連結目前design
第15行:編譯順序單元應按照HDL中的指示正確映射來產生gate-level description
第16行:報告timing information
第17行:報告QoR information
第18行:報告area information
第19行:報告power information
第20行:確保每個檔名match
第21行:用verilog format及hierarchy形式,將desgin寫入到檔案
第22行:離開Design Compiler
```
* 補充Main TCL:
Main TCL 根據圖1的Design flow 與圖2的Synthesis flow
圖1顯示Design Compiler in the Design flow:

圖2顯示Design Compiler in the Synthesis flow:

> 第02行:set link_library "$Std_cell_lib $Ram_lib"
> ***dcug.pdf,page112***
> 
> 第03行:set target_library "$Std_cell_lib $Ram_lib"
> ***dcug.pdf,page111***
> 
> 
> 第04行:set dc_allow_rtl_pg true
> ***dcug.pdf,page104-105***
> 
> 第05行:analyze -library WORK -format sverilog " \
> ***dcug.pdf,page151***
> 
> 第06行:elaborate ${DESIGN_NAME} -architecture verilog -library WORK
> ***dcug.pdf,page152***
> 
> 第07行:current_design ${DESIGN_NAME}
> ***dcug.pdf,page154***
> 
> 第08行:link
> ***dcug.pdf,page155***
> 
> 第09行:source ../../common/i2c_master_top.sdc
> ***dcug.pdf,page106,page213,page226***
> 
> 第10行:set_fix_multiple_port_nets -outputs -feedthroughs
> ***dcug.pdf,page408***
> 
> 第12行:source ../scripts/set_dont_use.tcl
> ***dcug.pdf,page121***
> 
> 第13行:check_design
> ***dcug.pdf,page796,page849***
> 第15行:compile -exact_map -map_effort high -area_effort medium -> power_effort none
> ***dcug.pdf,page468***
> 第16-19行: report_xxx
> ***dcug.pdf,page393***
> 第20行:change_names -rules verilog
> ***dcug.pdf,page186***
> 第21行:write_file -format verilog -hierarchy -pg -output ../../input/${DESIGN_NAME}.v
> ***dcug.pdf,page72***
* 參考
https://drive.google.com/drive/folders/1DS7P8PmUP2mCEkGKJ4PQ0MUdv5HzQNYh
### Lab1 Floorplan
#### Script discreption
* Makefile:
Makefile主要執行3個步驟:
1. icc2_shell ./../scripts/step1_data_setup.tcl
2. icc2_shell ./../scripts/step2_floorplan.tcl
3. icc2_shell ./../scripts/step3_powerplan.tcl
ICC2的Design Planning提供了以下功能,以開發hierarchical and flat designs,例如:
-多層Physical Hierarchy Floorplanning
-高級抽象管理,用於處理大型設計
-圖形任務管理器guided floorplanning
-數據流分析,用於 macro management and placement assistance
-快速放置 macros and standard cells
-Pattern-based power planning
-使用 UPF 的Power network描述
-虛擬就地時序優化
-針腳放置和匯流排bundling
-時序預算
這些功能有助於提高設計的效率和質量,並確保最終產品能夠滿足性能和功耗的要求。
這些工具的使用可以顯著減少設計時間,並提高大型複雜設計的可管理性。

* Main TCL:
1. step1_data_setup.tcl

2. step2_floorplan.tcl

3. step3_powerplan.tcl

* 逐行解釋 Main TCL:
1. step1_data_setup.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#設定Ref. Library
第03行:指定library作為目前設計的reference library
第04行:在優化過程中,icc2可以從target_library中選擇任何library cell
#建立Library
第06行:建立新的design library
#設定Tlupuls file
第10行:將TLUPlus models讀入library工作區
#建立Block
第13行:讀取design netlist,如同新建立block
第14行:指定在logic netlist中的hierarchical module name當作目前的block
第15行:Clock Tree Synthesis的前置作業
第16行:儲存block到disk
第17行:儲存design library到disk
第18行:關閉block,將block從memory移除
第19行:將design library從memory移除
第20行:離開icc2_shell
```
2. step2_floorplan.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#設定Ref. Library
第03行:指定library作為目前設計的reference library
第04行:在優化過程中,icc2可以從target_library中選擇任何library cell
#開啟 Library
第06行:開啟已儲存的library來看或編輯
第07行:在同樣的library複製block到新的block
第08行:開啟已儲存的block來看或編輯
#Report
第10行:報告clocks information
第11行:報告exceptions information
第12行:報告disable_timing information
#設定Pins/節點/Port
第14-19行:power設定為"VDD";ground設定為"VSS"
#設定Option
第21-22行:使用者自行需求設定應用選項
第23-25行:優化路徑
#儲存Block
第27行:將編輯好的block存到disk
#設定Routing方向
第29行:設定可忽略的layers
第30-37行:奇數層是垂直方向;偶數層是水平方向
#建立FloorPlan
第39行:在design planning初始化floorplan
#Ports放置
第42行:在design planning展現pin placement
#設定Pins/節點/Port
第44-45行:設定VDD,VSS
第46行:檢查design的電路是否有接好
#儲存Block
第48行:將編輯好的block存到disk
#建立FloorPlan and Placement
第50行:建立一個粗略的布局
第51行:合法的布局
第52行:展現global繞線
第53行:報告placement QoR information
#儲存Block
第55-56行:將編輯好的block存到disk
第57行:儲存design library到disk
第58行:關閉block,將block從memory移除
第59行:將design library從memory移除
第60行:離開icc2_shell
```
3. step3_powerplan.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#開啟 Library
第03行:開啟已儲存的library來看或編輯
第04行:在同樣的library複製block到新的block
第05行:開啟已儲存的block來看或編輯
#佈局Power
第07行:設定節點VDD值為power
第08行:設定節點VSS值為ground
第09行:連接VDD pins到PG net
第10行:連接VSS pins到PG net
第11行:移除PG via規則
第12行:移除PG pattern
第13行:移除PG strategies
第14行:移除PG strategy via rules
#建立Standard cell Rail
第16行:設定M1 rail連接模式
第17行:設定M1 rail power network PG佈局策略
第18行:設定M1 rail ground network PG佈局策略
第19行:建立M1_rail power network
第20行:建立M1_rail ground network
#建立Top垂直Mesh
第22行:建立TOP_MESH_VERTICAL一個PG mesh pattern
第23行:對VDDVSS_TOP_MESH_VERTICAL power ground network設定PG策略
第30行:建立VDDVSS_TOP_MESH_VERTICAL power ground network
#建立Top水平Mesh
第22行:建立TOP_MESH_HORIZONTAL一個PG mesh pattern
第23行:對VDDVSS_TOP_MESH_HORIZONTAL power ground network設定PG策略
第30行:建立VDDVSS_TOP_MESH_HORIZONTAL power ground network
#建立Rectangular Rings
第22行:建立ring_pattern一個PG ring pattern
第23行:對RING power ground network設定PG策略
第30行:建立RING power ground network
第31行:檢查PG network連接
#儲存Block
第52行:將編輯好的block存到disk
第53行:儲存design library到disk
第54行:關閉block,將block從memory移除
第55行:將design library從memory移除
第56行:離開icc2_shell
```
* 補充Main TCL:

1. step1_data_setup.tcl
Data setup主要是建立library與block兩個操作架構組合而成
圖1建立Design Library

圖2建立Block

表1列出Design Library Operation

表2列出Block Operation

> 第03行:link_library
> icc2ug.pdf,page69
> 
> 第06行:target_library
> icc2ug.pdf,page66
> 
> 
> icc2dm.pdf,page52
> 
> 第10行:read_parasitic_tech
> lmug.pdf,page41
> 
> 第13行:read_verilog
> icc2dm.pdf,page56,
> 
> 第14行:current_design
> icc2dm.pdf,page19,page211,
> 
> 
> 第15行:source ../../common/i2c_master_top.sdc
> icc2ug.pdf,page225,plot1-9
> 
> 第16行:save_block
> icc2dm.pdf,page61,plot1-6,plot1-10
> 
> 第17行:save_lib
> icc2dm.pdf,page24
> 
> 第18行:close_block
> icc2dm.pdf,page75
> 
> 第19行:close_lib
> icc2dm.pdf,page30
> 
2. step2_floorplan.tcl
> 第06行:open_lib
> icc2dm.pdf,page20,plot2-1
> 
> 第07行:copy_block
> icc2dm.pdf,page74,plot2-2
> 
> 第08行:open_block
> icc2dm.pdf,page68,page76,plot2-3
> 
> 第10行:report_clocks
> icc2dm.pdf,page183,plot2-4
> 
> 第21-22行:set_app_option
> icc2dm.pdf,page179
> 
> 第23-25行:group_path
> dcug.pdf,page399
> 
> 第46行:check_mv_design
> icc2mv.pdf,page37
>
> 第52行:route_global
> icc2ug.pdf,page409
> 
> 第53行:report_placement
> icc2ug.pdf,page203
> 
3. step3_powerplan.tcl
> 第07行:set_attribute
> icc2/icc2dm.pdf,page188
> 
> 第19-20行:compile_pg
> icc2/icc2mv.pdf,page207
> 
### Lab2 Placement & Route
#### Script discreption
* Makefile:
Makefile主要執行3個步驟:
1. icc2_shell ./../scripts/step4_place.tcl
2. icc2_shell ./../scripts/step5_clock_tree_syntesis.tcl
3. icc2_shell ./../scripts/step6_route.tcl
ICC2會先對設計做初始化動作,接著會對各部分做優化步驟:
第一步佈局優化,第二步Clock Tree合成與優化,第三步Clock Route與 post-clock優化,第四步繞線及postroute優化,
以上步驟均完成後,及設計完成可以製成程序

* Main TCL:
1. step4_place.tcl

2. step5_clock_tree_syntesis.tcl

3. step6_route.tcl

* 逐行解釋 Main TCL:
1. step4_place.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#設定Ref. Library
第03行:指定library作為目前設計的reference library
第04行:在優化過程中,icc2可以從target_library中選擇任何library cell
#開啟 Library
第06行:開啟已儲存的library來看或編輯
第07行:在同樣的library複製block到新的block
第08行:開啟已儲存的block來看或編輯
#設定優化
第10-11行:設定time相關訊息優化
第12-15行:設定佈局相關設定優化
第16行:設定corner;設定parasitic;產生scenario;讀取constraints information
第17行:指定在優化過程中排除一些在target library的特定cell
第18行:佈局優化
第19行:驗證佈局是否合法,確保放置位置符合所有設計規則及製造限制
#Reports
第21行:優化時間報告儲存位置
第22行:用HTML format產生一個分類的佈局QoR分析報告
第23行:報告佈局QoR information
第24行:報告目前block的QoR information以及統計數據
第25行:報告目前block的logical DRC violations
第26行:報告目前block的最大時序路徑
第26行:報告目前block的最小時序路徑
#儲存Block
第29行:將編輯好的block存到disk
第30行:儲存design library到disk
第31行:關閉block,將block從memory移除
第32行:關閉lib,將design library從memory移除
第33行:離開icc2_shell
```
2. step5_clock_tree_syntesis.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#設定Ref. Library
第03行:指定library作為目前設計的reference library
第04行:在優化過程中,icc2可以從target_library中選擇任何library cell
#開啟 Library
第06行:開啟已儲存的library來看或編輯
第07行:在同樣的library複製block到新的block
第08行:開啟已儲存的block來看或編輯
#設定Clock Tree Options
第10行:驗證佈局是否合法,如果佈局不合法會導致Clock Tree合成時間過長並且減少QoR
第11行:設定忽略最小繞線層與最大繞線層
第12-13行:設定相關Clock Tree Synthesis選項
第14行:使用者調整Clock Tree Synthesis skew量以及latency量,並且用在所有的clock
#設定Clock Tree Reference
第17行:設定library來啟動Clock Tree Synthesis
#設定Clock Tree Options
第20行:預測clock skew量對於所有的clock,來模擬佈局對於clock tree effect
第21行:產生 M2~M4的CLK_space routing rule
第22行:設定M2的CLK_SPACING是最小繞線層,M4的CLK_SPACING是最大繞線層
第23行:報告clock設定
第24行:設定clock優化
第25行:設定corner;設定parasitic;產生scenario;讀取constraints information
第26行:時序優化 從 build_block 到 build_block
#儲存單元
第28行:優化時間報告儲存位置
第29行:用HTML format產生一個分類的時序QoR分析報告
第30行:設定Clock Tree Synthesis compile enable global routing
#報告
第32行:報告在routing之前的佈局QoR information
第33行:報告目前block在routing之前的QoR information以及統計數據
第34行:報告目前block在routing之前的logical DRC violations
第35行:報告目前block在routing之前的最大時序路徑
第36行:報告目前block在routing之前的最小時序路徑
#設定時序優化
第37行:設定時序優化
第38行:時序優化從 route_clock 到 final_opto
#報告
第41行:產生Clock Tree Summary QoR報告等等
第42行:產生single-clock local skew報告
第43行:用HTML format產生一個分類的時序QoR分析報告
第44行:報告在routing之後的佈局QoR information
第45行:報告目前block在routing之後的QoR information以及統計數據
第46行:報告目前block在routing之後的logical DRC violations
第47行:報告目前block在routing之後的最大時序路徑
第48行:報告目前block在routing之後的最小時序路徑
#連接Power/Gnd的Pins & Nets
第50行:連接VDD pins到PG net
第51行:連接VSS pins到PG net
#儲存Block
第53行:將編輯好的block存到disk
第54行:儲存design library到disk
第55行:關閉block,將block從memory移除
第56行:關閉lib,將design library從memory移除
第57行:離開icc2_shell
```
3. step6_route.tcl
```
第01行:先做基本設定:連結tool path,design library file,constraints file等等...
#設定Ref. Library
第03行:指定library作為目前設計的reference library
第04行:在優化過程中,icc2可以從target_library中選擇任何library cell
#開啟 Library
第06行:開啟已儲存的library來看或編輯
第07行:在同樣的library複製block到新的block
第08行:開啟已儲存的block來看或編輯
#檢查
第10行:設定忽略最小繞線層與最大繞線層
第11行:報告忽略層
#繞線優化
第13行:設定corner;設定parasitic;產生scenario;讀取constraints information
第14行:設定繞線忽略DRC選項
第15行:自動繞線
第16行:繞線優化
#連接Power/Gnd的Pins & Nets
第18行:連接VDD pins到PG net
第19行:連接VSS pins到PG net
第20行:優化接線跟Via
第21行:檢查LVS
#報告
第23行:優化時間報告儲存位置
第24行:用HTML format產生一個分類的繞線QoR分析報告
第25行:報告congestion情況
第26行:從目前設計寫verilog pg_netlist
第27行:報告繞線QoR information
第28行:報告目前block的繞線QoR information以及統計數據
第29行:報告目前block的繞線的logical DRC violations
第30行:報告目前block的最大繞線路徑時間
第31行:報告目前block的最小繞線路徑時間
#儲存Block
第33行:將編輯好的block存到disk
第34行:儲存design library到disk
#輸出GDS
第36行:從目前設計寫verilog i2c_master_top netlist
第37行:寫入i2c_master_top sdc檔案
第38行:寫入i2c_master_top DEF檔案
第39行:寫入i2c_master_top block level寄生spf檔案
第40行:寫入i2c_master_top GDS檔案
第48行:關閉block,將block從memory移除
第49行:關閉lib,將design library從memory移除
第50行:離開icc2_shell
```
* 補充Main TCL:
下圖顯示ICC2 Placement and Route Overview

1. step4_place.tcl
> 第10行:set_app_options
> icc2dm.pdf,page167
> 
> 第19行:legalize_placement
> icc2ug.pdf,page133
> 
> 第24-27行:report_xxx
> icc2ug.pdf,page207
> 
2. step5_clock_tree_syntesis.tcl
> 第10行:check_legality
> icc2ug.pdf,page225
> 
> 第14行:set_clock_tree_options
> icc2ug.pdf,page246
> 
> 第20行:set_clock_uncertainty
> icc2ug.pdf,page143
> 
> 第22行:set_clock_routing_rules
> icc2ug.pdf,page171
> 
> 第41行:report_clock_qor
> icc2ug.pdf,page316
> 
> 第42行:report_clock_timing
> icc2ug.pdf,page320
> 
3. step6_route.tcl
> 第36-38行:write_xxx
> icc2dm.pdf,page134
> 
* 參考:
https://drive.google.com/drive/folders/1Rszjde4knKzEiAIJcq2k4bWaV6affNwA
### Lab StarRC
#### Script discreption
首先我們先從Makefile來討論。

圖:Makefile內容
我們會先利用gen_StarRC_smc.tcl和gen_star_cmd_gate_DEFLEF.tcl產生兩個檔案StarRC.smc(裡面設定tempature 、corner的資訊)和Star_cmd_gate(用來跑StarXtract的tcl)

圖:StarRC.smc內容

圖:Star_cmd_gate內容
接著利用StarXtract來執行Star_cmd_gate就完成這部分lab。
StarXtract 是一款由 Synopsys 公司開發的寄生抽取軟件,屬於 StarRC(寄生抵抗和電容計算)工具的一部分。它專門用於從半導體設計的物理佈局中抽取寄生參數,如電阻、電容和電感,這對於確定電路在實際製造和運行中的表現至關重要。
主要功能和用途:
- 寄生參數抽取:
StarXtract 能夠從集成電路設計的佈局數據中抽取寄生電阻和電容值。這些值是通過分析導體間的幾何關係以及導體與其周圍環境的相互作用來計算得出的。
- 多層次寄生模型支持:
它支援多層次的寄生模型,能夠分析從單個元件到完整子系統或整個晶片層面的寄生效應,並將其整合入更大的系統級模型中。
- 高精度和高效率:
StarXtract 設計用於提供高精度的抽取結果,這對於高性能和高頻率的設計尤其重要,同時它也針對大型設計進行優化,以提高抽取過程的效率。
- 設計驗證和優化:
抽取得到的寄生參數可用於後續的設計驗證和性能優化,如信號完整性分析、功率整合分析和電磁干擾分析等。
下面是Star_cmd_gate中的指令說明:
- BLOCK: 指定要進行寄生效應抽取的區塊名稱,這裡是 i2c_master_top。

圖:StarRCTM User Guide and Command Reference 518頁
- TOP_DEF_FILE: 定義文件的路徑,用於指定抽取寄生效應的頂層設計文件。

圖:StarRCTM User Guide and Command Reference 1084頁
- MAPPING_FILE: 提供設計層到製程層的映射文件路徑。

圖:StarRCTM User Guide and Command Reference 756頁
- LEF_FILE: 指定 LEF 文件的路徑,這通常包含有關標準元件的信息。

圖:StarRCTM User Guide and Command Reference 742頁
- REDUCTION: 抽取時是否進行減少,例如不添加額外迴路。

圖:StarRCTM User Guide and Command Reference 996頁
- NETS: 指定哪些網路需要抽取,這裡使用 * 表示所有網路。


圖:StarRCTM User Guide and Command Reference 920頁
- EXTRACTION: 抽取類型,這裡是 RC(電阻-電容)。

圖:StarRCTM User Guide and Command Reference 644頁
- DPT: 是否開啟深層次處理。

圖:StarRCTM User Guide and Command Reference 611頁
- NUM_CORES: 指定用於計算的核心數量。

圖:StarRCTM User Guide and Command Reference 929頁
- STARRC_DP_STRING: 額外的 StarRC 配置參數(未指定具體值)。


圖:StarRCTM User Guide and Command Reference 1068-1069頁
- CORNERS_FILE: 指定角落分析的配置文件。


圖:StarRCTM User Guide and Command Reference 558-559頁
- DENSITY_BASED_THICKNESS: 是否基於密度來設定厚度。

圖:StarRCTM User Guide and Command Reference 595頁
- SELECTED_CORNERS: 選定的角落,這裡是 fast 和 slow。

圖:StarRCTM User Guide and Command Reference 1023頁
- SIMULTANEOUS_MULTI_CORNER: 是否同時進行多角落分析。


圖:StarRCTM User Guide and Command Reference 1033-1034頁
- SKIP_CELLS: 設置忽略的元件,!* 表示忽略所有元件。

圖:StarRCTM User Guide and Command Reference 1043頁
- COUPLE_TO_GROUND: 是否將耦合效應接地。


圖:StarRCTM User Guide and Command Reference 565-566頁
- COUPLING_ABS_THRESHOLD 和 COUPLING_REL_THRESHOLD: 設定耦合的絕對和相對閾值。

圖:StarRCTM User Guide and Command Reference 573頁

圖:StarRCTM User Guide and Command Reference 575頁
- REDUCTION_MAX_DELAY_ERROR: 設定最大延遲誤差的閾值。

圖:StarRCTM User Guide and Command Reference 998頁
- NETLIST_FORMAT: 輸出網表的格式,這裡是 SPEF。

圖:StarRCTM User Guide and Command Reference 852頁
- NETLIST_FILE: 指定輸出寄生網表的文件名。
- SUMMARY_FILE: 輸出運行時間和記憶體使用的摘要文件。

圖:StarRCTM User Guide and Command Reference 1075頁
- STAR_DIRECTORY: 指定 StarRC 內部資訊的工作目錄。

圖:StarRCTM User Guide and Command Reference 1065頁
如需更詳細內容設定可以參考 synopsys提供的 StarRC User Guide and Command Reference (https://drive.google.com/drive/folders/1hGrDiKlNjs57P9MnZ5D2zseKvDKL2mAm)
### Lab PrimeTime
#### Script discreption
首先我們先從Makefile來討論。

圖:Makefile
gen_pt_cmd:用來產生run_pt_cmd.fast.tcl 和 run_pt_cmd.slow.tcl,這兩個檔案將會用來跑pt_shell 的tcl。

圖:gen_pt_cmd.tcl中部分內容,可以看到第6行創立run_pt_cmd.fast.tcl 和 run_pt_cmd.slow.tcl下面是撰寫內容。

圖:run_pt_cmd.fast.tcl 1-36行

圖:run_pt_cmd.fast.tcl 39-72行

圖:run_pt_cmd.fast.tcl 73-106行

圖:run_pt_cmd.fast.tcl 108-113行
set_pt_cmd:用於設定檔案系統權限的 Shell 腳本
- for SCENARIO in $(PT_SELECTED_SCENARIO); do ... done:
這是一個 for 循環,它會遍歷 PT_SELECTED_SCENARIO 變量中列出的每個場景。PT_SELECTED_SCENARIO 被設定為 fast slow,意味著此循環會先對 fast 場景進行操作,然後是 slow 場景。
- chmod 777 -R ./pt_workspace/$$SCENARIO:
- chmod 是改變檔案或目錄權限的命令。
- 777 是權限設定,其中每個數字代表不同的權限級別。7 表示讀、寫和執行權限。這裡的 777 表示對檔案或目錄的所有者、所屬組和其他使用者都賦予讀、寫和執行權限。
- -R 表示遞迴地應用權限變更,也就是不僅對指定的目錄,而且對其內所有子目錄和檔案都設置相同的權限。
- ./pt_workspace/$$SCENARIO 是目標目錄的路徑
接者利用pt_shell來執行run_pt_cmd.fast.tcl 和 run_pt_cmd.slow.tcl就完成這部分lab。
pt_shell 是指 PrimeTime Shell,它是由 Synopsys 公司開發的一種軟件工具,用於集成電路(IC)設計的時序分析。PrimeTime 是業界廣泛使用的靜態時序分析工具,它可以精確地分析和驗證數字集成電路設計在不同製程、電壓和溫度條件下的時序。
主要功能
- 時序分析:
PrimeTime 可以計算和驗證設計的時序,確保設計在特定的製程條件下達到預期的時鐘頻率,並且滿足設定的時序要求。
- 報告生成:
它可以生成詳細的時序報告,這些報告包含了關鍵路徑、時序違規等重要信息,這對於時序優化和問題診斷至關重要。
- 時鐘樹分析:
軟件提供時鐘樹分析工具,幫助設計師優化時鐘信號在整個芯片上的分配,以減少時鐘偏斜和提高整體性能。
- 功耗分析:
除了時序分析,PrimeTime 也支援對設計功耗的計算和分析,這對於功耗敏感的應用非常重要。
使用方式
pt_shell 通常在命令行界面中運行,並可通過腳本(通常是 Tcl 腳本)自動化復雜的時序分析流程,例如本次lab利用run_pt_cmd.fast.tcl 和 run_pt_cmd.slow.tcl,以下是run_pt_cmd.fast.tcl(slow類似就不特別說明)中的指令說明:
- set sdir ".":
設定一個名為 sdir 的變量,其值為當前目錄(.)。
- source ../../common/common.tcl:
載入上層目錄中 common 子目錄下的 common.tcl 檔案。
- file mkdir ./pt_workspace/fast/$PT_REPORTS_DIR 和 file mkdir ./pt_workspace/fast/$PT_RESULTS_DIR:
創建目錄,以存放報告和結果檔案。使用的路徑依賴於環境變數。
- set report_default_significant_digits 3:
設定報告中顯示的數字精度為三位有效數字。
- set sh_source_uses_search_path true:
允許搜索路徑功能,使得 PrimeTime 在尋找檔案時會遵循設定的搜索路徑。
- set search_path ". $search_path ":
更新搜索路徑,將當前目錄添加到現有的搜索路徑中。
- read_verilog $PT_NETLIST_FILES:
讀取先前lab產生Verilog 檔案,這些檔案通常包含netlist資訊。

圖:common.tcl 84行
- current_design $DESIGN_NAME:
設定當前的設計名稱,以便於後續的分析。
- link:
執行連結過程,通常是將讀取的netlist與設計庫中的元件進行對應。
- read_parasitics:
讀取先前產生的寄生參數檔案,這些檔案包含電路元件之間的寄生效應信息。

圖:common.tcl 85-86行

圖:Prime time User Guide 75頁
- read_sdc -echo:
讀取並應用時序約束檔案(SDC),這是控制設計時序要求的主要方式。

圖:i2c_master_top.sdc file

圖:Prime time User Guide 262頁
- update_timing -full 和 check_timing -verbose:
更新和檢查時序。這些命令確保時序數據是最新的,並對時序進行詳細檢查。

圖:Prime time User Guide 669頁

圖:Prime time User Guide 925頁
- report_*:
生成各種時序分析報告,包括全局時序、時鐘偏移、分析覆蓋率和具體的時序報告。

圖:Prime time User Guide 456頁
- fix_eco_power -pba_mode none -verbose:
執行 ECO以優化功耗,這裡設定為不使用 PBA(Path-Based Analysis)模式(可以選none、full),且verbose 模式時,程式會輸出更為詳細的資訊。
除此之外,還可以利用此功能來減少漏電流。

圖:Prime time User Guide 871頁
- write_sdf ./../../results/i2c_master_top.fast.sdf:
寫出 SDF 檔案,用於後續的模擬。
SDF檔案:在進行後仿真(Post-Simulation)時,SDF文件用於將實際的timing信息反向註釋到模擬中,以確保仿真結果能準確地反映實際的電路行為。
- save_session ./pt_workspace/fast/$PT_SESSION_DIR:
保存當前的 PrimeTime 會話,以便將來恢復或查閱。

圖:Prime time User Guide 66頁
- exec /bin/cp -r parasitics_command.log ./pt_workspace/fast/parasitics_command.log.fast:
複製日誌文件到指定目錄。
- exit:
結束腳本執行
如需更詳細內容設定可以參考 synopsys提供的 Prime time User Guide (https://picture.iczhiku.com/resource/eetop/SykdfdRlrLPEQBBX.pdf)
### Lab4 Chip Finishing
#### Script discreption
首先我們先從Makefile來討論。

圖:Makefile
接者利用icc2_shell來執行step7_finishing.tcl 就完成這部分lab。
icc2_shell這是由 Synopsys 公司開發的集成電路布局和布線工具的命令行界面。IC Compiler II 是一個高性能的電子設計自動化(EDA)工具,主要用於完成數字集成電路的物理設計階段,包括布局、布線、優化和分析。
以下是step7_finishing.tcl中的指令說明(特別說明與icc2有關指令,terminal 端就不特別說明,像是set ...等):
- open_lib:
打開頂層庫

圖:IC CompilerTM II Implementation User Guide 74頁
- copy_block、open_block:
從一個現有塊中複製資料到一個臨時塊,用於進一步的處理、打開指定的塊以進行操作。

圖:IC CompilerTM II Data Model User Guide 57頁中Figure 9 Creating, Opening, Editing, Saving, and Closing a Block


圖:IC CompilerTM II Data Model User Guide 58頁

圖:IC CompilerTM II Data Model User Guide 74頁

圖:IC CompilerTM II Data Model User Guide 68頁
- add_redundant_vias:
添加冗餘的通孔以增強連接的可靠性。


圖:IC CompilerTM II Implementation User Guide 508-509頁
- create_stdcell_fillers:
創建標準單元填充物,通常用於填補空間以保持版圖的均勻性和改善製造過程。

圖:IC CompilerTM II Implementation User Guide 519頁
By default, the create_stdcell_fillers command fills all empty space in the horizontal standard-cell rows of the entire block by inserting instances of the filler library cells specified by the -lib_cells option.(You can control the another aspects of the filler cell insertion 參考 IC CompilerTM II Implementation User Guide 521-524頁)
- set_app_options :
設定應用選項
- lappend create_metal_fill_cmd -select_layers $METAL_FILL_SELECT_LAYER:
lappend 命令用來將元素添加到一個列表的末尾。這裡,它被用來將選擇層的選項(-select_layers $METAL_FILL_SELECT_LAYER)添加到已存在的命令 create_metal_fill_cmd 中。這樣做的目的是為了擴展原始的命令,使其包含一個額外的選項,指定了哪些層應該被選中進行填充。
- set_attribute and connect_pg_net:
為電源(VDD)和地(VSS)網設置屬性並連接,這對於整個設計的votage穩定性非常關鍵。

圖:IC CompilerTM II Implementation User Guide 85頁

圖:IC CompilerTM II Implementation User Guide 86頁
- check_mv_design:
檢查多電壓設計的配置是否正確。

圖:IC CompilerTM II Implementation User Guide 89頁
- check_lvs:
執行佈局與原理圖(LVS)檢查,確保佈局的準確性。



圖:IC CompilerTM II Implementation User Guide 456-458頁
- report_design and report_timing:
生成設計總結和時序報告,提供關於設計的詳細信息以及時序性能。

圖:IC CompilerTM II Implementation User Guide 207頁
- write_verilog、write_sdc, write_parasitics, write_def, and write_gds:
輸出Verilog檔案、設計約束(SDC)、寄生參數(SPEF)、設計交換格式文件(DEF)和圖形資料系統格式文件(GDS),這些都是下線前所需的關鍵文件。

圖:IC CompilerTM II Data Model User Guide 134頁

圖:IC CompilerTM II Timing Analysis User Guide 148頁
- save_block and save_lib:
保存當前的塊和庫,以確保所有變更都被正確保存。
- close_block and close_lib:
關閉打開的塊和庫,以結束當前的設計階段。
如需更詳細內容設定可以參考 synopsys提供的 User Guide:
IC CompilerTM II Multivoltage User Guide
IC CompilerTM II Graphical User Interface User Guide
IC CompilerTM II Data Model User Guide
IC CompilerTM II Timing Analysis User Guide
IC CompilerTM II Implementation User Guide
IC CompilerTM II Design Planning User Guide
(https://drive.google.com/drive/folders/1Rszjde4knKzEiAIJcq2k4bWaV6affNwA)
### Lab IC Validator - DRC
#### Script discreption

這個 makefile 主要用於自動化設置環境和執行 ICV 工具進行 Design rule check。
- TOP_CELL:用於指定驗證過程中考慮的主要設計元件。

- FORMATE:用於指定文件格式。
- LAYOUT_FILE:指定產生出的.gds檔案的路徑。
- LAYER_MAPPING_FILE:用於定義不同製程產生出的不同layer在驗證軟體之間的對應關係。
- INPUT_LIBRARY_PATH:定義包含驗證所需的標準文件庫資料的路徑,這些標準文件庫包含了設計中使用的元件特性。
- RUN_DIR:用於存放驗證過程中生成的產生的文件和中間文件的位置。
- RUNSET_FILE:由台積提供,指定用於 DRC 驗證的運行設定文件(Runset File),包含了進行 DRC 驗證所需要的所有規則和參數設定。
### Lab IC Validator – LVS
#### Script discreption

這個 makefile 主要用於自動化設置環境和執行 ICV 工具進行 LVS check。
- GDSII_TOPCELL_NAME:指定GDSII文件中的 top cell 的名稱。在 LVS 驗證過程中,需要明確指出哪一個 cell 是設計的頂層,以確保驗證工具正確地處理整個 chip 或 miodule。
- GDSII_FILE:指定 GDSII 格式的 layout file 的位置和名稱。
- SPICE_FILE:指定 SPICE 格式的 netlist 檔案的位置和名稱。
- NETLIST_TOPCELL_NAME:指定 SPICE netlist 檔中的 top cell 名稱。進行LVS驗證時,對照 GDSII layout file 的頂層單元。
- LVS_RUNSET_FILE:由台積提供,指定用於 LVS 驗證的運行設定文件(Runset File),包含了進行LVS驗證所需要的所有規則和參數設定。
### Lab formality
#### Script discreption

這個 makefile 主要用於 gate level 和做完 placement & routing 做完的檔案做比較。Reference design 是 design compiler 所寫出的 netlist 檔,而 Implement design 是 P&R 完產生的 netlist
- read_db "$Std_cell_lib $Ram_lib"
讀取標準元件和 RAM 的 library。

- set hdlin_interface_only ""
這個指令可以設定特定的 design 作為 black box

- read_verilog -r /path/to/reference.v -work_library WORK
從指定的文件讀取 reference design,-r 代表 reference,-work_library 指定使用哪個資料庫

- set_top -auto
設定 reference 的 top-level design,-auto 代表自動設定

- read_verilog -i /path/to/implementation.v
從指定的文件讀取 implement design,-i 代表 implement

- set_top i:WORK/i2c_master_top
設定 implement 的 top-level design

## discussion and observation
IC Design Flow Overview
**1. Specification Definition:**
Before any design begins, a detailed specification of the IC must be created. This includes defining the functionality, performance targets, power consumption limits, physical size constraints, and environmental conditions under which the IC must operate.
**2. Architectural Design:**
In this stage, high-level decisions are made about the structure and interconnections of the major components of the IC. This could involve selecting processor cores, memory architectures, and the integration of various IP blocks.
**3. RTL Design:**
The detailed functionality of the IC is described in a Hardware Description Language (HDL), such as Verilog or VHDL. This description is at the Register Transfer Level (RTL), focusing on how data moves between registers and how it is processed.
**Lab Synthesis:**
The RTL description is transformed into a gate-level netlist using synthesis tools like Synopsys Design Compiler. Synthesis involves translating RTL code into a form that maps onto the available technology library's logic gates and flip-flops. Optimizations for speed, area, and power are conducted at this stage to meet the initial specifications.
**Lab1 Floorplan:**
Initial placement of the major components, I/O pads, and defining the power and ground rails. The floorplan must optimize the use of space and provide a framework for efficient routing while considering thermal and manufacturability constraints.
**Lab2 Placement & Route:**
After floorplanning, the next step is the detailed placement of all the standard cells and the routing of the interconnections between them. Tools like Synopsys IC Compiler are used. The aim is to minimize wire length and congestion, which impacts performance and power consumption. This stage may iterate with synthesis to refine the netlist for better placement and routing results.
**Lab StarRC:**
Post-placement, the parasitic extraction tool StarRC is used to model the resistance and capacitance of the interconnects. This information is crucial for accurate simulation and timing analysis, as it significantly impacts the IC's performance, particularly at higher frequencies.
**Lab PrimeTime:**
Performs Static Timing Analysis (STA) to ensure all timing requirements are met, including setup and hold times, and conducts power analysis to verify that power consumption remains within specifications. This analysis helps identify critical timing paths and potential power issues that could affect the chip's reliability and function.
**Lab4 Chip Finishing:**
The final steps in the design include adding filler cells to ensure density requirements, making adjustments for manufacturability, and producing the GDSII file, which is the final output used for manufacturing the IC.
**Lab IC Validator - DRC and LVS:**
Design Rule Checking (DRC) ensures that the IC layout adheres to all foundry-specific manufacturing rules, preventing physical defects. Layout Versus Schematic (LVS) checks confirm that the layout accurately reflects the original schematic and the netlist generated post-synthesis. Errors here can lead to functional failures.
**Lab Formality:**
Formality is used to ensure logical equivalence between the RTL and the synthesized netlist, verifying that transformations during synthesis have not introduced errors.
Finally, note that in this experiment, LVS and DRC errors are likely to occur due to issues with the process files. If the correct files are used, these problems would not occur.
## Lab_screenshot_part:
### Lab Synthesis
#### Results







### Lab1 Floorplan
#### Results





















### Lab2 Placement & Route
#### Results































### Lab StarRC
#### Results


### Lab PrimeTime
#### Results




### Lab4 Chip Finishing
#### Results







### Lab IC Validator - DRC
#### Results



### Lab IC Validator – LVS
#### Results





### Lab formality
#### Results

