相關閱讀
SDC命令詳解https://blog.csdn.net/weixin_45791458/category_12931432.html?spm=1001.2014.3001.5482
? ? ? ? 在使用get_cells等命令訪問設計對象時,需要指定設計對象的名字,這個名字是一個相對路徑,本文就將對此進行討論。
相對路徑
? ? ? ? 使用相對路徑來訪問設計對象時,該對象必須位于當前設計(Current Design)中,且路徑相對當前實例(Current Instance)指定,當前實例是當前設計中的一個層次單元,默認情況下當前實例就是當前設計,可以使用current_instance命令設置當前實例。
圖1 一個簡單的層次設計
? ? ? ? 以圖1為例,如果想在當前設計中Multiplier_Booth_STG_0中設置單元M1/C150的dont_touch屬性,可以使用下面兩種方法:
// 方法一
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> set_dont_touch [get_cells M1/C150]
// 方法二
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> current_instance . // 確認當前實例,注意點的添加
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
prompt> current_instance M1 // 設置當前實例
Current instance is '/Multiplier_Booth_STG_0/M1'.
/Multiplier_Booth_STG_0/M1
prompt> set_dont_touch [get_cells C150]
? ? ? ? 在方法一中,路徑相對當前設計(即頂層設計)指定;在方法二中,路徑相對實例M1指定。若想將當前實例重置為當前設計,只需要使用不帶參數的current_instance命令即可,如下所示。
prompt> current_instance
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
? ? ? ? 需要注意的是,如果使用current_design重新設置了當前設計,則當前實例也會被重置為當前設計,如下所示。
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> current_design Datapath // 設置當前設計
Current design is 'Datapath'.
{Datapath}
Current design is 'Datapath'.
prompt> current_instance . // 確認當前實例,注意點的添加
Current instance is the top-level of design 'Datapath'.
? ? ? ? 順帶一提,除了使用current_instance命令設置當前實例,current_instance變量也可以設置和查詢當前實例,如下所示。
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> current_instance . // 確認當前實例,注意點的添加
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
prompt> set current_instance M1 // 設置當前實例
Current instance is '/Multiplier_Booth_STG_0/M1'.
/Multiplier_Booth_STG_0/M1
prompt> printvar current_instance // 直接查看變量值
current_instance = "/Multiplier_Booth_STG_0/M1"
? ? ? ? 當使用report_cell等命令時,如果不指定對象作為參數,默認以當前實例為參數,如下所示。?
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> current_instance . // 確認當前實例,注意點的添加
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
prompt> report_cell // 報告當前實例內的單元
****************************************
Report : cell
Design : Multiplier_Booth_STG_0
Version: W-2024.09-SP2
Date : Sat Apr 12 13:17:57 2025
****************************************Attributes:b - black box (unknown)h - hierarchicaln - noncombinationalr - removableu - contains unmapped logicCell Reference Library Area Attributes
--------------------------------------------------------------------------------
M1 Datapath 0.000000 h, n, u
M2 Controller 0.000000 h, n, u
--------------------------------------------------------------------------------
Total 2 cells 0.000000
prompt> set current_instance M1 // 設置當前實例
Current instance is '/Multiplier_Booth_STG_0/M1'.
/Multiplier_Booth_STG_0/M1
prompt> report_cell // 報告當前實例內的單元
****************************************
Report : cell
Design : Multiplier_Booth_STG_0/M1 (Datapath)
Version: W-2024.09-SP2
Date : Sat Apr 12 13:21:17 2025
****************************************Attributes:b - black box (unknown)c - control logich - hierarchicaln - noncombinationalr - removables - synthetic operatoru - contains unmapped logicCell Reference Library Area Attributes
--------------------------------------------------------------------------------
B_0 GTECH_BUF gtech 0.000000 c, u
B_1 GTECH_BUF gtech 0.000000 c, u
C128 *SELECT_OP_5.1_5.1_1 0.000000 s, u
C129 *SELECT_OP_2.8_2.1_8 0.000000 s, u
C130 *SELECT_OP_2.4_2.1_4 0.000000 s, u
C131 *SELECT_OP_5.1_5.1_1 0.000000 s, u
C132 *SELECT_OP_3.8_3.1_8 0.000000 s, u
C142 GTECH_OR2 gtech 0.000000 c, u
C143 GTECH_OR2 gtech 0.000000 c, u
C144 GTECH_OR2 gtech 0.000000 c, u
C147 GTECH_AND2 gtech 0.000000 c, u
C148 GTECH_AND2 gtech 0.000000 c, u
C150 GTECH_AND2 gtech 0.000000 c, u
C152 GTECH_AND2 gtech 0.000000 c, u
C153 GTECH_AND2 gtech 0.000000 c, u
C154 GTECH_AND2 gtech 0.000000 c, u
C156 GTECH_AND2 gtech 0.000000 c, u
C157 GTECH_AND2 gtech 0.000000 c, u
C158 GTECH_AND2 gtech 0.000000 c, u
I_0 GTECH_NOT gtech 0.000000 u
I_1 GTECH_NOT gtech 0.000000 c, u
I_2 GTECH_NOT gtech 0.000000 c, u
I_3 GTECH_NOT gtech 0.000000 c, u
I_4 GTECH_NOT gtech 0.000000 c, u
add_28_S2 *ADD_UNS_OP_8_8_8 0.000000 s, u
multiplicand_reg[0] **SEQGEN** 0.000000 n, u
multiplicand_reg[1] **SEQGEN** 0.000000 n, u
multiplicand_reg[2] **SEQGEN** 0.000000 n, u
multiplicand_reg[3] **SEQGEN** 0.000000 n, u
multiplicand_reg[4] **SEQGEN** 0.000000 n, u
multiplicand_reg[5] **SEQGEN** 0.000000 n, u
multiplicand_reg[6] **SEQGEN** 0.000000 n, u
multiplicand_reg[7] **SEQGEN** 0.000000 n, u
multiplier_reg[0] **SEQGEN** 0.000000 n, u
multiplier_reg[1] **SEQGEN** 0.000000 n, u
multiplier_reg[2] **SEQGEN** 0.000000 n, u
multiplier_reg[3] **SEQGEN** 0.000000 n, u
product_reg[0] **SEQGEN** 0.000000 n, u
product_reg[1] **SEQGEN** 0.000000 n, u
product_reg[2] **SEQGEN** 0.000000 n, u
product_reg[3] **SEQGEN** 0.000000 n, u
product_reg[4] **SEQGEN** 0.000000 n, u
product_reg[5] **SEQGEN** 0.000000 n, u
product_reg[6] **SEQGEN** 0.000000 n, u
product_reg[7] **SEQGEN** 0.000000 n, u
sub_31_S2 *SUB_UNS_OP_8_8_8 0.000000 s, u
--------------------------------------------------------------------------------
Total 46 cells 0.000000
current_instance命令
? ? ? ? 除了不帶參數和使用當前實例下的層次單元作為參數,current_instance命令還可以接受其他類型的參數,就像Linux中的相對路徑那樣,可以接受.以表示當前實例和..表示上層實例,如下所示。
prompt> current_design // 確認當前設計
Current design is 'Multiplier_Booth_STG_O'.
(Multiplier_Booth_STG_0}
prompt> current_instance . // 確認當前實例,注意點的添加
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
prompt> current_instance ./M1 // 設置當前實例,與current_instance M1等價
Current instance is '/Multiplier_Booth_STG_0/M1'.
/Multiplier_Booth_STG_0/M1
prompt> current_instance .. // 設置當前實例
Current instance is the top-level of design 'Multiplier_Booth_STG_0'.
prompt> current_instance ../../../M1 // 設置當前實例
Current instance is '/Multiplier_Booth_STG_0/M1'.
? ? ? ? 上例還有兩點細節可以注意:1、參數末尾加不加/效果相同,這與Linux中作為參數的目錄類似;2、如果索引超出了當前設計,則視為當前設計。
類似概念
? ? ? ? 在低功耗設計(UPF)中也存在類似當前實例的概念,叫做當前范圍(Current Scope),使用set_scope命令可以設置當前范圍,實際上使用本文的current_instance命令和current_instance變量也可以設置當前范圍,它們之間的差別很小。