• Design Compiler工具学习笔记(7)




    目录

    引言

    背景知识

    多时钟设计

    DC 输出文件分析

    实际操作

    设计源码

    综合脚本

    综合网表

    SDF文件

    SDC文件

    REPORT文件







    引言

    本篇继续学习 DC的基本使用。本篇主要学习 DC 综合之后的效果分析,多同步时钟设计以及 DC 综合完成之后的各种输出文件。

    前文链接:

    Design Compiler工具学习笔记(1)

    Design Compiler工具学习笔记(2)

    Design Compiler工具学习笔记(3)

    Design Compiler工具学习笔记(4)

    Design Compiler工具学习笔记(5)

    Design Compiler工具学习笔记(6)



    背景知识

    多时钟设计

    多周期约束时,对应的设计代码也需要修改。比如使能信号、数据有效信号需要延迟相应的时间。 

    DC 输出文件分析

     



     



    实际操作

    设计源码

    简单的设计文件:做一个9级延迟的寄存器链。源代码:

    1. module MY_DESIGN
    2. (
    3. input I_CLK_100M,
    4. input I_RSTN_100M,
    5. input I_DATA,
    6. input I_VAL,
    7. output O_DATA
    8. );
    9. reg [9:0] R_I_DATA;
    10. genvar GV_I;
    11. generate
    12. for(GV_I = 0;GV_I < 10;GV_I = GV_I + 1)
    13. begin
    14. always @ (posedge I_CLK_100M)
    15. begin
    16. if(~I_RSTN_100M)
    17. begin
    18. R_I_DATA[GV_I] <= 0;
    19. end
    20. else if(GV_I == 0)
    21. begin
    22. R_I_DATA[GV_I] <= I_DATA & I_VAL;
    23. end
    24. else
    25. begin
    26. R_I_DATA[GV_I] <= R_I_DATA[GV_I-1];
    27. end
    28. end
    29. end
    30. endgenerate
    31. assign O_DATA = R_I_DATA[9];
    32. endmodule

    综合脚本

    1. # |===========================================================
    2. # | Author : Xu Y. B.
    3. # | Date : 2022-11-21
    4. # | Description : tcl script for top design
    5. # |===========================================================
    6. # |===========================================================
    7. # |STEP 1: Read & elaborate the RTL design file list & check
    8. # |===========================================================
    9. set TOP_MODULE MY_DESIGN
    10. analyze -format verilog [list MY_DESIGN.v]
    11. elaborate $TOP_MODULE -architecture verilog
    12. current_design $TOP_MODULE
    13. if {[link] == 0} {
    14. echo "Your Link has errors !";
    15. exit;
    16. }
    17. if {[check_design] == 0} {
    18. echo "Your check design has errors !";
    19. exit;
    20. }
    21. # |===========================================================
    22. # |STEP 2: reset design
    23. # |===========================================================
    24. reset_design
    25. # |===========================================================
    26. # |STEP 3: Write unmapped ddc file
    27. # |===========================================================
    28. uniquify
    29. set uniquify_naming_style "%s_%d"
    30. write -f ddc -hierarchy -output ${UNMAPPED_PATH}/${TOP_MODULE}.ddc
    31. # |===========================================================
    32. # |STEP 4: define clocks
    33. # |===========================================================
    34. # -------------------------- CLK 100MHz ----------------------
    35. set CLK_NAME I_CLK_100M
    36. set CLK_PERIOD 10
    37. set CLK_SKEW [expr {$CLK_PERIOD*0.05}]
    38. set CLK_TRANS [expr {$CLK_PERIOD*0.01}]
    39. set CLK_SRC_LATENCY [expr {$CLK_PERIOD*0.1 }]
    40. set CLK_LATENCY [expr {$CLK_PERIOD*0.1 }]
    41. create_clock -period $CLK_PERIOD [get_ports $CLK_NAME]
    42. set_ideal_network [get_ports $CLK_NAME]
    43. set_dont_touch_network [get_ports $CLK_NAME]
    44. set_drive 0 [get_ports $CLK_NAME]
    45. set_clock_uncertainty -setup $CLK_SKEW [get_clocks $CLK_NAME]
    46. set_clock_transition -max $CLK_TRANS [get_clocks $CLK_NAME]
    47. set_clock_latency -source -max $CLK_SRC_LATENCY [get_clocks $CLK_NAME]
    48. set_clock_latency -max $CLK_LATENCY [get_clocks $CLK_NAME]
    49. # --------------------------- CLK 50MHz ----------------------
    50. # set CLK_NAME_2 I_CLK_50M
    51. # set CLK_PERIOD_2 20
    52. # set CLK_SKEW_2 [expr {$CLK_PERIOD_2*0.05}]
    53. # set CLK_TRANS_2 [expr {$CLK_PERIOD_2*0.01}]
    54. # set CLK_SRC_LATENCY_2 [expr {$CLK_PERIOD_2*0.1 }]
    55. # set CLK_LATENCY_2 [expr {$CLK_PERIOD_2*0.1 }]
    56. # create_clock -period $CLK_PERIOD_2 [get_ports $CLK_NAME_2]
    57. # set_ideal_network [get_ports $CLK_NAME_2]
    58. # set_dont_touch_network [get_ports $CLK_NAME_2]
    59. # set_drive 0 [get_ports $CLK_NAME_2]
    60. # set_clock_uncertainty -setup $CLK_SKEW_2 [get_clocks $CLK_NAME_2]
    61. # set_clock_transition -max $CLK_TRANS_2 [get_clocks $CLK_NAME_2]
    62. # set_clock_latency -source -max $CLK_SRC_LATENCY_2 [get_clocks $CLK_NAME_2]
    63. # set_clock_latency -max $CLK_LATENCY_2 [get_clocks $CLK_NAME_2]
    64. # |===========================================================
    65. # |STEP 5: define reset
    66. # |===========================================================
    67. # ------------------------- RST 1 ----------------------------
    68. set RST_NAME I_RSTN_100M
    69. set_ideal_network [get_ports $RST_NAME]
    70. set_dont_touch_network [get_ports $RST_NAME]
    71. set_drive 0 [get_ports $RST_NAME]
    72. # # ------------------------- RST 2 ----------------------------
    73. # set RST_NAME_2 I_RSTN_50M
    74. # set_ideal_network [get_ports $RST_NAME_2]
    75. # set_dont_touch_network [get_ports $RST_NAME_2]
    76. # set_drive 0 [get_ports $RST_NAME_2]
    77. # |===========================================================
    78. # |STEP 6: set input delay using timing budget
    79. # |Assume a weak cell to drive the input pins
    80. # |===========================================================
    81. set LIB_NAME typical
    82. set WIRE_LOAD_MODEL smic18_wl10
    83. set DRIVE_PIN Y
    84. set OPERATE_CONDITION typical
    85. set ALL_INPUT_EXCEPT_CLK [remove_from_collection [all_inputs] [get_ports "$CLK_NAME"]]
    86. set INPUT_DELAY [expr {$CLK_PERIOD*0.6}]
    87. set_input_delay $INPUT_DELAY -clock $CLK_NAME $ALL_INPUT_EXCEPT_CLK
    88. set_driving_cell -lib_cell ${DRIVE_CELL} -pin ${DRIVE_PIN} $ALL_INPUT_EXCEPT_CLK
    89. # |===========================================================
    90. # |STEP 7: set output delay
    91. # |===========================================================
    92. set OUTPUT_DELAY [expr {$CLK_PERIOD*0.6}]
    93. set MAX_LOAD [expr {[load_of $LIB_NAME/INVX4/A] * 10}]
    94. set_output_delay $OUTPUT_DELAY -clock $CLK_NAME [all_outputs]
    95. set_load [expr {$MAX_LOAD * 3}] [all_outputs]
    96. set_isolate_ports -type buffer [all_outputs]
    97. # |===========================================================
    98. # |STEP 8: set max delay for comb logic
    99. # |===========================================================
    100. # set_input_delay [expr $CLK_PERIOD * 0.1] -clock $CLK_NAME -add_delay [get_ports I_1]
    101. # set_output_delay [expr $CLK_PERIOD * 0.1] -clock $CLK_NAME -add_delay [get_ports O_1]
    102. # |===========================================================
    103. # |STEP 9: set operating condition & wire load model
    104. # |===========================================================
    105. set_operating_conditions -max $OPERATE_CONDITION \
    106. -max_library $LIB_NAME
    107. set auto_wire_load_selection false
    108. set_wire_load_mode top
    109. set_wire_load_model -name $WIRE_LOAD_MODEL \
    110. -library $LIB_NAME
    111. # |===========================================================
    112. # |STEP 10: set area constraint (Let DC try its best)
    113. # |===========================================================
    114. set_max_area 1000
    115. # |===========================================================
    116. # |STEP 11: set DRC constraint
    117. # |===========================================================
    118. # set MAX_CAPACITANCE [expr {[load_of $LIB_NAME/NAND4X2/Y] * 5}]
    119. # set_max_capacitance $MAX_CAPACITANCE $ALL_INPUT_EXCEPT_CLK
    120. # |===========================================================
    121. # |STEP 12: set group path
    122. # |Avoid getting stack on one path
    123. # |===========================================================
    124. group_path -name $CLK_NAME -weight 5 \
    125. -critical_range [expr {$CLK_PERIOD * 0.1}]
    126. group_path -name INPUTS -from [all_inputs] \
    127. -critical_range [expr {$CLK_PERIOD * 0.1}]
    128. group_path -name OUTPUTS -to [all_outputs] \
    129. -critical_range [expr {$CLK_PERIOD * 0.1}]
    130. group_path -name COMBS -from [all_inputs] \
    131. -to [all_outputs] \
    132. -critical_range [expr {$CLK_PERIOD * 0.1}]
    133. report_path_group
    134. # |===========================================================
    135. # |STEP 13: Elimate the multiple-port inter-connect &
    136. # | define name style
    137. # |===========================================================
    138. # set_app_var verilogout_no_tri true
    139. # set_app_var verilogout_show_unconnected_pins true
    140. # set_app_var bus_naming_style {%s[%d]}
    141. # simplify_constants -boundary_optimization
    142. # set_boundary_optimization [current_design] true
    143. # set_fix_multiple_port_nets -all -buffer_constants
    144. # |===========================================================
    145. # |STEP 14: timing exception define
    146. # |===========================================================
    147. # set_false_path -from [get_clocks I_CLK_100M] -to [get_clocks I_CLK_100M]
    148. # set ALL_CLKS [all_clocks]
    149. # foreach_in_collection CUR_CLK $ALL_CLKS
    150. # {
    151. # set OTHER_CLKS [remove_from_collection [all_clocks] $CUR_CLK]
    152. # set_false_path -from $CUR_CLK $OTHER_CLKS
    153. # }
    154. # set_false_path -from [get_clocks I_CLK_100M] -to [get_clocks I_CLK_100M]
    155. # set_false_path -from [get_clocks I_CLK_100M] -to [get_clocks I_CLK_100M]
    156. # set_disable_timing TOP/U1 -from a -to y
    157. # set_case_analysis 0 [get_ports sel_i]
    158. # set_multicycle_path -setup 6 -from FFA/CP -through ADD/out -to FFB/D
    159. # set_multicycle_path -hold 5 -from FFA/CP -through ADD/out -to FFB/D
    160. # set_multicycle_path -setup 2 -to FFB/D
    161. # set_multicycle_path -hold 1 -to FFB/D
    162. # |===========================================================
    163. # |STEP 15: compile flow
    164. # |===========================================================
    165. # ungroup -flatten -all
    166. # 1st-pass compile
    167. # compile -map_effort high -area_effort high
    168. # compile -map_effort high -area_effort high -boundary_optimization
    169. compile -map_effort high -area_effort high
    170. # simplify_constants -boundary_optimization
    171. # set_fix_multiple_port_nets -all -buffer_constants
    172. # compile -map_effort high -area_effort high -incremental_mapping -scan
    173. # 2nd-pass compile
    174. # compile -map_effort high -area_effort high -incremental_mapping -boundary_optimization
    175. # compile_ultra -incr
    176. # |===========================================================
    177. # |STEP 16: write post-process files
    178. # |===========================================================
    179. change_names -rules verilog -hierarchy
    180. remove-unconnected_ports [get_cells -hier *] -blast_buses
    181. # Write the mapped files
    182. write -f ddc -output $MAPPED_PATH/${TOP_MODULE}.ddc
    183. write -f verilog -hierarchy -output $MAPPED_PATH/${TOP_MODULE}.v
    184. write_sdc -version 1.7 $MAPPED_PATH/${TOP_MODULE}.sdc
    185. write_sdf -version 2.1 $MAPPED_PATH/${TOP_MODULE}.sdf
    186. # |===========================================================
    187. # |STEP 17: generate report files
    188. # |===========================================================
    189. # Get report file
    190. redirect -tee -file ${REPORT_PATH}/check_design.txt {check_design}
    191. redirect -tee -file ${REPORT_PATH}/check_timing.txt {check_timing}
    192. redirect -tee -file ${REPORT_PATH}/report_constraint.txt {report_constraint -all_violators}
    193. redirect -tee -file ${REPORT_PATH}/check_setup.txt {report_timing -delay_type max}
    194. redirect -tee -file ${REPORT_PATH}/check_hold.txt {report_timing -delay_type min}
    195. redirect -tee -file ${REPORT_PATH}/report_area.txt {report_area}

    综合网表

    打开映射后的 .v 文件:

    编译时可以加上 -scan 选项,观察寄存器映射的差别:

    SDF文件

    里面包含了单元的延迟信息。

    SDC文件

    里面包含了该设计的所有约束

    REPORT文件

    可以分别打开进行分析,包括时间、面积等。此处就不一一展开。

     



    至此 DC 的视频学习告一段落,了解了基本的使用技巧。但是功夫还需要磨练,多结合工程进行实践是必不可缺的环节。继续加油~~

  • 相关阅读:
    2023山东健博会/营养健康展/特医食品展/山东大健康展
    【Spring Boot】Spring Boot中的简单查询
    在Unity中制作路网
    LeetCode_双指针_中等_328.奇偶链表
    基于单片机设计的智能风扇(红外线无线控制开关调速定时)
    《golang设计模式》第二部分·结构型模式-06-享元模式(Flyweight)
    【c语言】字符函数和字符串函数(下)
    x64 简介
    CMMI认证是什么?为什么IT类企业都在申请?
    使用OpenTelemetry进行监控
  • 原文地址:https://blog.csdn.net/qq_43045275/article/details/128041162