Tcl與Design Compiler (十三)——Design Compliler中常用到的命令(示例)總結


本文如果有錯,歡迎留言更正;此外,轉載請標明出處 http://www.cnblogs.com/IClearner/  ,作者:IC_learner

本文將描述在Design Compliler中常用到的命令,這些命令按照流程的順序進行嵌套講解,主要是列舉例子;大概的講解布局如下所示:

                       

大概有11個部分,下面我們逐個部分進行(簡單的)介紹的舉例。

1、tcl的命令和結構

tcl的命令和結構請參照第二節的內容:

http://www.cnblogs.com/IClearner/p/6617207.html ,下面是簡單的常用舉例。

--> 設置變量命令: set PER 2.0

  顯示變量命令: echo $PER  # Result: 2.0

--> 表達式操作:

    set MARG  0.95

    expr  $PER  *  $MARG

    # expr: *, /, +, >, <, =, <=, >=

    set PCI_PORTS  [get_ports  A]

    set PCLPORTS   [get_ports “Y??M Z*”]

 -->命令嵌套,顯示命令中嵌套表達式命令:

    echo “Effctv P = [expr  $PERIOD * $MARGIN]”

    # Result with soft quotes: “Effctv P = 1.9”

等價於:

    echo {Effctv P = [expr $PERIOD * $MARGIN]}

    # Result with hard quotes:

    # “Effctv P = [expr $PERIOD * $MARGIN]”

-->tcl的注釋行:# Tcl Comment line

    set COMMENT injine ; # Tel inline comment

-->設置tcl中的列表變量:

    set MY_DESIGNS “A.v  B.v  Top.v”

查看列表變量:

  foreach  DESIGN  $MY_DESIGNS {

    read_verilog  $DESIGN

    }

 

-->for循環:

  for  { set i 1}  { $i  < 10 }  { incr  i} {  

    read_verilog  BLOCK_$i.v

  }

 

 

2、獲取幫助

-->在dc_shell 中能用的命令:

  pwd 、 cd 、 Is、history、 !l 、 !7 、 Ireport 、

  sh  <LINUX_command> :加上sh后,可以執行在linux中執行的命令,如sh  gvim  xxx.v  & (&是后台運行)、

  printenv、

  get_linux_variable  <LINUX_variable>

-->在dc_shell中尋求幫助:

  下面的這些man、printvar命令都只能在dc_shell中運行:

  help -verbose *clock :列出與*clock有關的選項

  create_clock -help :查看create_clock這個命令的簡單用法

  man  create_clock :查看create_clock這個命令的詳細信息

  printvar  Mibrary :查看 Mibrary這個變量的內容

  man target_library :查看target_library這個命令的詳細信息

 

-->linux關聯DC中的幫助,獲取更多的幫助

  為了能夠在linux中使用dc_shell中的man命令,或者說能在linux中查看某些dc的命令,可以使用關聯(alias):

    $ alias  dcman “/usr/bin/man  -M  $SYNOPSYS/doc/syn/man”

  然后我們就可以使用dcman來參看dc中的命令了,例如:

    $dcman  targetjibrary

 

3、tcl語法的檢查

當在DC可以執行tcl文件,在運行之前,我們要檢查這個tcl文件是否有語法錯誤,可以使用下面的命令:

      $dcprocheck   xxx.tcl

 

4、設計對象的操作

關於設計對象的內容(比如上面是設計對象等),請查看前面的章節,這里我們只進行說對設計對象操作的一些命令(這些命令可以在dc_shell 中執行,或者寫在tcl文件中)。

-->獲取設計對象

  get_ports  、get_pins  、get_designs  、get_cells  、get_nets  、get_clocks  、get_nets  -of_objects  [get_pins  FF1_reg/Q] 、get_libs <lib_name> 、get_lib_cells  <lib_name/cell_names>  、get_lib_pins <lib_name/cell_name/pin_names>

 

-->設計對象(的集合):

設計對象的物集,總之就是多個設計對象(組成一個集合)

  all_inputs 、all_outputs  、all_clocks  、all_registers  、all_connected  、all_fanin  、all_fanout  、all_ideal_nets

 

 

-->對設計對象的操作:

  獲取設計對象(get_ports pci_*)后賦予給變量PCI__PORTS:

    set  PCI__PORTS  [get_ports pci_*]

    echo $PCI__PORTS # -≫ _sel184

  查詢設計對象:

    query_objects  $PCI__PORTS  # -> {pci_1 pci_2 ...}

  獲取設計對象的名字:

    get_object_name  $PCIMPORTS # -> pci_1  pci_2 ...

  獲取設計對象物集的大小:

    sizeof_collection  $PCI_PORTS   # -> 37

  往設計對象物集里面增加設計對象:

    set PCI_PORTS [add_to_collection  $PCI_PORTS  [get_ports CTRL*]]

  從設計對象物集里面減少設計對象:

    set ALL_INP_EXC_CLK  [remove_from_collection  [alljnputs] [get_ports CLK]]

  比較設計對象:

    compare_collections

  設計對象的索引:

    index_collection

  分類設計對象:

    sort_collection

 

  循環查看(進行遍歷)設計對象物集的內容:

    foreach_in_collection  my_cells  [get_cells  -hier  *  -filter “is_hierarchical == true”] {

      echo “Instance [get_object_name $cell] is hierarchical”

    }

 

  過濾運算符:

    # Filtering operators: ==, !=, >, <, >=, <=, =~, h

    filter_collection [get_cells *]  “ref_name AN*”

    get_cells * -filter “dontjouch == true”

    get_clocks * -filter “period < 10”

 

  列出所有單元屬性並將輸出重定向到文件:

  # List all cell attributes and redirect output to a file

    redirect -file cell_attr {list_attributes -application -class cell}

 

  Grep以dont_為開頭的單元屬性文件:

  # Grep the file for cell attributes starting with dont_

    $grep dont_ cell__attr | more

 

  列出屬性為dont_touch的單元名字:

    # List the value of the attribute dont_touch

    get_attribute  <cell_name> dont_touch

 

  識別當前設計集中的膠合單元(GLUE_CELLS):

  # Example: Identify glue cells in the current design 

    set GLUE_CELLS  [get_cells *-filter “is_hierarchicai == false”]

 

5、啟動環境的配置

這些設置主要是在.synopsys_dc.setup文件中;或者在common_setup.tcl和dc_setup.tcl文件中,然后.synopsys_dc.setup文件把這兩個文件包含。

·common_setup.tcl文件中:

    set   ADDITIONAL_SEARCH_PATH   “./libs/sc/LM   ./rtl ./scripts”

    set   TARGET_LIBRARY_FILES  sc_max.db

    set   ADDL_LINK_LIBRARY_FILES  IP_max.db

    set   SYMBOL_LIBRARY_FILES   sc.sdb

    set   MW_DESIGN_LIB  MY_DESIGN_LIB

    set   MW_REFERENCE_LIB_DIRS  “./libs/mw_lib/sc   ./libs/mw_libs/IP”

    set   TECH_FILE    ./Iibs/tech/cb13_6m.tf

    set   TLUPLUS_MAX__FILE   ./Iibs/tlup/cb13_6m_max.tluplus

    set    MAP FILE   ./Iibs/tlup/cb13_6m.map

·dc_setup.tcl文件中:

#庫的設置:

    set_app_var   search_path   "$search_path  $ADDITIONAL_SEARCH_PATH"

    set_app_var   target_library   $TARGET_LIBRARY_FILES

    set_app_var   link_library    "*  $target_library  $ADDL_LINK_LIBRARY_FILES"

    set_app_var   symbol_library   $SYMBOL_LIBRARY_FILES

    set_app_var   mw_reference_library   $MW_REFERENCE_LIB_DIRS

    set_app_var   mw_design_library    $MW_DESIGN_LIB

    get_app_var   -list   -only_changed_vars   *

#如果存在Milkyway design庫,那就不創建;否則創建Milkyway design庫

  if {![file  isdirectory  $mw_design Jibrary ]} {

    create_mw_lib  -technology  $TECH_FILE  -mw_reference_library  $mw_reference_library  $mw_design_library

  }

  open_mw_lib  $mw_design_library

  check_library

  set_tlu_plus_tiles  -max_tluplus  $TLUPLUS_MAX_FILE  -tech2itf_map  $MAP_FILE

  check_tlu_plus_files

  history  keep  200

  set_app_var  alib_library_analysis_path   ../ ;  # ALIB files

  define_design_lib   WORK   -path   ./work

  set_svf    <myjilename.svf>

  set_app_var   sh_enable_page_mode   false

  suppress_message   {LINT-28   LINT-32   LINT-33   UID-401}

  set_app_var  alib_library_analysis_path   [get_unix_variable   HOME]

  alias  h   history

  alias  rc “report_constraint   -all_violators”

 

 

6、DC的啟動方式(舉例)

    $dc_shell   -topographical  #交互式啟動

    dc_shell-topo>  start_gui   #啟動圖形化界面

    dc_sheli-topo>  stop_gui   #停止圖形化界面

    $design_vision  -topographical  #啟動圖形化界面的同時,調用拓撲模式

    $dc_shell  -topo  -f dc.tcl  | tee -i dc.log  #批處理模式

 

 

7、讀入設計

有下面這些讀入情況:

    ·read_db library_file.db

    ·read_verilog  {A.v  B.v   TOP.v}

    ·read_sverilog  {A.sv  B.sv  TOP.sv}

    ·read_vhdl   {A.vhd  B.vhd  TOP.vhd}

    ·read_ddc   MY_TOP.ddc

    ·analyze  -format  verilog  {A.v  B.v  TOP.v}

      elaborate  MY_TOP  -parameters “A_WIDTH=8, B__WIDTH=16”

后是讀入設計后的一些必要操作:

  設置頂層設計:

    current_design   MY_T0P

  檢查是否缺失子模塊:

    link

  檢查設計:

    if {[check_design] ==0} {

      echo “Check Design Error”

      exit  #檢查出錯,退出DC

    }

  寫出讀入后的未映射設計:

  write_file  -f  ddc  -hier  -out  unmappedd/TOP.ddc

 

8、(環境、設計、時序等的)檢查和移除

      reset_design

      report_clock

      report_clock  -skew  -attr

      report_design

      report_port -verbose

      report_path_group

      report_timing

      report_timing_requirements  -ignored

      report_auto_ungroup

      report_interclock_relation

      check_timing

      reset_path  -from  FF1_reg

      remove_clock

      remove_clockJransition

      remove_clock_uncertainty

      remove_input_delay

      remove_output_delay

      remove_driving_cell

      list_libs

      redirect  -file  reports/lib.rpt {report_lib <libname>}

      report_hierarchy [-noleaf]

      # Arithmetic implementation and resource-sharing info

      report_resources

      # List area for all cells in the design

      report_cell  [get_cells  -hier  *]

      check_design

      check_design -html check_design.html

      sh firefox check_design.html

      report_constraint  -all_violators

      report_timing  [ -delay <max | min> ]

              [ -to <pi n_port_clockJ ist> ]

              [ -from <pin__port_clock_list> ]

              [ -through <pin_port_list> ]

              [ -group]

              [ -input__pins ]

              [ -max_paths <path_count> ]

              [ -nworst <paths_per_endpoint_count >]

              [ -nets ]

              [ -capacitance ]

              [ -significant_digits <number>]

      report_qor

      report_area

      report_congestion

 

9、約束的設置和執行

·預算估計:

如果實際輸出負載值未知,則用於“負載預算”。找到庫中最大的max_capacitance值,並將該值作為保守的輸出負載。

    set LIB_NAME ssc_core_slow

    set MAX_CAP 0

    set OUTPUT_PINS [get_lib_pins  $LIB_NAME/*/* \

    -filter "direction == 2"]

    Foreach_in_collection  pin  $OUTPUT_PINS {

      set  NEW_CAP  [get_attribute  Spin  max_capacitance]

      if {$NEW_CAP > $MAX_CAP} {

        set MAX_CAP  $NEW_CAP

      }

     }

    set_load  $MAX _CAP  [all_outputs]

·普通的約束:

    reset_design

############# CLOCKS###################

# 默認情況下,每一個時鍾都只對於一個時鍾,除非設置下面的命令為真:

    set_app_var  timing_enable_multiple_clocks_per_reg  true

#下面是時鍾建模的例子:

    create_clock -period 2 -name  Main_Clk [get_ports Clk1]

    create_clock -period 2.5 -waveform {0 1.5} [get_ports Clk2]

    create_clock -period 3.5 -name V_Clk; # 這是虛擬時鍾

    create_generated_clock -name DIV2CLK -divide_by2  -source  [get_ports Clk1] [get_pins I_DIV__FF/Q]

    set_clock_uncertainty -setup 0.14 [get_clocks *]

    set_clock_uncertainty -setup 0.21 -from [get_clocks Main_Clk] -to [get_clocks Clk2]

    set_clock_latency -max 0.6 [get_clocks Main_Clk] ; # 這是版圖之前的時鍾情況

    set_propagated__clock  [all_clocks]; # 這是時鍾樹綜合后的情況

    set_clock_latency  -source -max 0.3 [get_clocks Main_Clk]

    set_clock_transition  0.08  [get_clocks Main_Clk]

############# CLOCK TIMING EXCEPTIONS ########

    set_clock_group  -logically_exclusive | -physically_exclusive | -asynchronous  -group CLKA -group CLKB

    set_false_path -from [get_clocks Asynch_CLKA] -to [get_clocks Asynch_CLKB]

    set_multicycle_path -setup 4 -from -from A_reg -through U_Mult/Out -to B_reg

    set_multicycle_path -hold 3 -from -from A_reg -through U_Mult/Out -to B_reg

    set_input_delay -max 0.6 -clock Main_Clk [alljnputs]

    set_input_delay -max 0.3 -clock Clk2 -clock_fall -add_delay [get_ports “B  E”]

    set_input_delay  -max 0.5 -clock -network_latency_included V_Clk [get_ports “A  C  F”]

    set_output_delay -max 0.8 -clock -source_latency_included Main_Clk [all__outputs]

    set_output_delay -max 1.1 -clock V_Clk [get_ports “OUT2  OUT7]

################ ENVIRONMENT ######################

    set_max_capacitance 1.2 [alljnputs]; # (這是用戶自定義的設計規則約束)

    set_load 0.080  [all_outputs]

    set_load [expr [load_of slow_proc/NAND2_3/A] * 4] [get_ports OUT3]

    set_load 0.12 [all_inputs]

    set_input_transition 0.12 [remove_from_collection [all_inputs][get_ports  B]]

    set_driving_cell -lib_cell FD1 -pin Q [get_ports B]

與物理設計有關的約束:

    create_bounds ...

    create_rp_groups...

    set_app_var placer_soft_keepout_channel_width...

    set_app_var placer_max_cell_density_threshold...

    set_congestion_options...

    setjgnoredjayers...

 

    set_aspect_ratio 0.5 # (高度和寬度的比值)

    set_utilization  0.7 #(利用率)

    set_placement_area  -coordinate  {0 0 600 400}

    create_die_area  -polygon {{0 0} {0 400} {200 400} {200 200} {400 200} {400 0} {0 0}}

    set_port_side {R} Port__N

    set_port_location -coordinate {0 40} PortA

    set_cell_location -coordinate {400 160} -fixed -orientation {N} RAM1

    create_placement_blockage -name Blockagel -coordinate {350 110 600 400}

    create_bounds -name “b1” -coordinate {100 100 200 200} INST_1

    create_site_row -coordinate {10,10} -kind CORE -space 5 -count 3 {SITE_ROW#123}

    create_voltage_area -name VA1 -coordinate {100 100 200 200} INST_1

    create_net__shape -type wire -net VSS -origin {0 0} -length 10 -width 2 -layer M1

    create_wiring_keepouts -name "my__keep1" -layer "METAL1" -coord {12 12 100 100}

    report_physical_constraints

    reset_physical_constraints

約束的執行:

    redirect -tee -file reports/precompile.rpt {source -echo -verbose TOP.con}

    redirect -append -tee -file reports/precompile.rpt {check_timing}

如果有直接的tcl約束,那么直接約束:

    source <Physical_Constraints_TCL_file>

如果沒有的話,可以從物理設計中抽取:

    extract_physieal_constraints  <DEF_file>

    read_floorplan  <floorplan_cmd_file>  

 

 

10、綜合優化

路徑分組:

    group_path -name CLK1 -criticai_range <10% of CLK1 Period> -weight 5

    group_path -name CLK2 -critical_range <10% of CLK2 Period> -weight 2

    group_path -name INPUTS -from [alljnputs]

    group_path -name OUTPUTS -to [all_outputs]

    group_path -name COMBO -from [alljnputs] -to [all_outputs]

    set_fix_multiple_port_nets  -all  -buffer_constants

綜合時的選項:

# Licenses required to take advantage of all Design Compiler optimization

# features: DC-Ultra, DesignWare, DC-Extension (for DC-Graphical), DFTC

# Enable multi-core optimization, if applicable:

    set_host_options  -max_cores <#>

    report_host__options

    remove_host_options

# 防止特定的子模塊被 ungrouped:

    set_ungroup  <top_level_and/or_pipeiined_blocks>  false

# 防止DesignWare層次結構被 ungrouped:

    set_app_var  compile_ultra_ungroup_dw  false

# 如果需要:禁用特定子設計的邊界優化:

    set_boundary_optimization  <cells or designs>  false

# 如果需要:從適應性重新定時中排除特定的單元/設計(-retime)(也就是放在某些模塊或者設計的寄存器被retime移動):

    set_dont_retime  <cells_or_designs>  true

# 如果需要:通過手動控制寄存器復制的個數

  #最大扇出的情況:

    set_register_replication [-num_copies 3 | -max_fanout 40]   [get_cells  B_reg]

# 如果需要:更改寄存器復制命名樣式:

    set_app_var  register_replication_naming_style  "%s_rep%d"

# 如果要求應用,那么就要為測試准備的綜合選擇掃描寄存器,並且禁止自動地移位寄存器定義:

    set_scan_configuration -style <multiplexed_flip_flop | clocked_scan | lssd | aux_clock_lssd>

    set_app_var compile_seqmap_identify_shift_registers false

# 如果有要求保持流水線中的寄存器器輸出,就要進行約束:

    set_dont_retime   [get_cells  U_Pipeline/R12_reg*]  true

# 如果設計中包含有純的流水線設計,那么可以進行寄存器retiming:

    set_optimize_registers  true  -design  My_Pipeline_Subdesign -clock CLK1 -delay_threshold <clock_period>

# 默認情況下,整個層次結構使用compile_ultra -spg進行擁塞優化,選擇性地禁用/啟用子設計上的擁塞優化:

    set_congestion_optimization  [get_designs A]  false

# 第一次編譯:根據需要啟用/禁用優化:

    compile_ultra -scan -retime -timing [-spg] \

            [-no_boundary] \

            [-no_autoungroup] \

            [-no_design_rule] \

                        [-no_seq_output_inversion]

#根據需要,更多地關注違規的關鍵路徑:

 group_path -name <group_name> -from <path_start> -to <path_end>  -critical range <10% of max delay goal> -weight 5

# 執行增量編譯:

    compile_ultra -scan -timing -retime -incremental [-spg]

 

11、綜合后處理

    set_app_var verilogout_no_tri true

    change_names -rule verilog -hier

    write_file - f verilog -hier -out mapped/TOP.v

    write__file - f ddc -hier -out mapped/TOP.ddc

    write_sdc TOP.sdc

    write_scan_def -out TOP_scan.def

 最后附上兩張流程圖:

    

       

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM