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



     


    本人做过FPGA设计的项目,后面想转 IC 设计方向。现在从 DC 工具的使用开始学起,DC 是新思科技的EDA软件,具体的安装见下面的文章:

    Synopsys EDA Tools 安装问题记录https://blog.csdn.net/qq_43045275/article/details/127630241学习的过程就是啃书+看视频+看帖子。随我的学习进度同步更新~~~~

    本篇文章就记录一下,DC的使用和配置。


    目录

    知识储备

    实际操作

    DC setup

    1、.synopsys_dc.setup 配置

    2、当前用户的目录

    3、工程路径下添加 .synopsys_dc.setup

    启动 DC

    1、输入命令

    2、读取设计文件

    3、link

    其他

    list_libs

    report_lib <库名称>

    -help

     man

    打印环境变量

     list_designs

     current_design

    参考说明



    知识储备

     target library 是最基本的一些门、触发器等基本器件的工艺信息。

    link library 包括一些 第三方 IP对应的db格式文件。

     

     文件权限 3  > 2 >1

     

     

     




    实际操作

    DC setup

    DC在启动前会加载配置文件,下面分别说明。分布在3个地方:DC的安装目录、

    1、.synopsys_dc.setup 配置

    1、软件安装目录

    1、在DC安装的如下路径下面打开终端:

    /Synopsys/DC2016_install_loc/admin/setup

    2、在终端输入:

    ls -al

    3、执行如下命令:

    gvim .synopsys_dc.setup

    或者使用 :

    gedit .synopsys_dc.setup

    如果没有安装 vim,可以通过以下的命令来完成:

    sudo apt install vim-gtk

    打开后可以看到:

    2、当前用户的目录

    1、终端输入如下命令,切换到当前用户目录

    cd ~

    2、通过下面命令可以看到配置文件

    ls -al

    我的用户目录没有找到 .synopsys_dc.setup 文件,但是并不影响使用 DC。

    3、工程路径下添加 .synopsys_dc.setup

    下面是我的启动文件。

    1. echo "=============-----------------\\\\\\\\-----------------============="
    2. echo "********************* START LOAD MY .synopsys_dc.setup *********************"
    3. echo "=============-----------------\\\\\\\\-----------------============="
    4. set SYN_ROOT_PATH /home/xyb-ubuntu1604/XYB/MY_DC/Example_1
    5. set RTL_PATH $SYN_ROOT_PATH/rtl
    6. set CONFIG_PATH $SYN_ROOT_PATH/config
    7. set SCRIPT_PATH $SYN_ROOT_PATH/script
    8. set MAPPED_PATH $SYN_ROOT_PATH/mapped
    9. set UNMAPPED_PATH $SYN_ROOT_PATH/unmapped
    10. # define work directory
    11. set WORK_PATH $SYN_ROOT_PATH/work
    12. set DC_PATH /home/xyb-ubuntu1604/XYB/Synopsys_Tool/DC2016
    13. define_design_lib work -path $WORK_PATH
    14. set SYMBOL_PATH /home/xyb-ubuntu1604/XYB/MY_STUDY_LIB/smic180/std_cell/fb_2005q4v1/aci/sc-x/symbols/synopsys
    15. set LIB_PATH /home/xyb-ubuntu1604/XYB/MY_STUDY_LIB/smic180/std_cell/fb_2005q4v1/aci/sc-x/synopsys
    16. set_app_var search_path [list . $search_path $LIB_PATH \
    17. $SYMBOL_PATH $RTL_PATH \
    18. $SCRIPT_PATH \
    19. ${DC_PATH}/libraries/syn]
    20. # This virables are automatically set if you perform ultra command.
    21. # Specify for use during optimization
    22. # You do not need to be anything to access the standard library.
    23. # DC is setup to use this lirary by default
    24. set_app_var synthetic_library [list dw_foundation.sldb standard.sldb]
    25. set_app_var target_library [list typical.db]
    26. set_app_var link_library [list * ${target_library} dw_foundation.sldb]
    27. set_app_var symbol_library [list smic18.sdb]
    28. echo "=============-----------------\\\\\\\\-----------------============="
    29. echo "********************* END OF LOAD MY .synopsys_dc.setup ********************"
    30. echo "=============-----------------\\\\\\\\-----------------============="
    31. echo "=============-----------------\\\\\\\\-----------------============="
    32. echo "*********************** START source hs_name_rules.v ***********************"
    33. echo "=============-----------------\\\\\\\\-----------------============="
    34. # source -v -e ./hs_name_rules.tcl
    35. echo "=============-----------------\\\\\\\\-----------------============="
    36. echo "********************** END OF source hs_name_rules.v ***********************"
    37. echo "=============-----------------\\\\\\\\-----------------============="

    关于hs_name_rules.tcl 文件我没有在网上找到可用的文件,后面的命令暂且注释。

    启动 DC

    1、输入命令

    dc_shell |tee dc_start.log

    启动 DC 的同时,记录启动的log信息。

    启动完成:

     

    2、读取设计文件

    read_verilog -rtl [list TOP.v]

     

    设计文件源代码:

    1. `define RESET_STATE 3'b000
    2. `define FETCH_INSTR 3'b001
    3. `define READ_OPS 3'b010
    4. `define EXECUTE 3'b011
    5. `define WRITEBACK 3'b100
    6. module TOP(Clk, Reset, Crnt_Instrn, Zro_Flag, Carry_Flag, Neg_Flag, Return_Addr, Current_State, PC);
    7. input Clk;
    8. input Reset;
    9. input [31:0] Crnt_Instrn; // Current Executing Inst
    10. input Zro_Flag, Carry_Flag, Neg_Flag; // Flags from ALU or Stack
    11. input [7:0] Return_Addr;
    12. output [2:0] Current_State; // CurrentState from Control FSM
    13. output [7:0] PC; // Program Count
    14. wire Incrmnt_PC, Ld_Brnch_Addr, Ld_Rtn_Addr;
    15. wire [2:0] CurrentState;
    16. FSM I_FSM (
    17. .Clk(Clk),
    18. .Reset(Reset),
    19. .CurrentState(CurrentState)
    20. );
    21. DECODE I_DECODE (
    22. .Zro_Flag(Zro_Flag),
    23. .Carry_Flag(Carry_Flag),
    24. .Neg_Flag(Neg_Flag),
    25. .CurrentState(CurrentState),
    26. .Crnt_Instrn(Crnt_Instrn),
    27. .Incrmnt_PC(Incrmnt_PC),
    28. .Ld_Brnch_Addr(Ld_Brnch_Addr),
    29. .Ld_Rtn_Addr(Ld_Rtn_Addr)
    30. );
    31. COUNT I_COUNT (
    32. .Reset(Reset),
    33. .Clk(Clk),
    34. .Incrmnt_PC(Incrmnt_PC),
    35. .Ld_Brnch_Addr(Ld_Brnch_Addr),
    36. .Ld_Rtn_Addr(Ld_Rtn_Addr),
    37. .Imm_Addr(Crnt_Instrn[7:0]),
    38. .Return_Addr(Return_Addr),
    39. .PC(PC)
    40. );
    41. assign Current_State = CurrentState;
    42. endmodule
    43. module FSM(Clk, Reset, CurrentState);
    44. input Clk, Reset; // CPU Clock
    45. // CPU Reset
    46. output [2:0] CurrentState; // Current State of FSM
    47. reg [2:0] Current_State, Next_State;
    48. always @(Reset or Current_State) begin
    49. case (Current_State)
    50. `RESET_STATE: begin
    51. Next_State <= `FETCH_INSTR;
    52. end
    53. `FETCH_INSTR: begin
    54. Next_State <= `READ_OPS;
    55. end
    56. `READ_OPS: begin
    57. Next_State <= `EXECUTE;
    58. end
    59. `EXECUTE: begin
    60. Next_State <= `WRITEBACK;
    61. end
    62. `WRITEBACK: begin
    63. Next_State <= `FETCH_INSTR;
    64. end
    65. default : begin
    66. Next_State <= `RESET_STATE;
    67. end
    68. endcase
    69. end
    70. always @( posedge Clk) begin
    71. if (Reset == 1'b1) begin
    72. Current_State <= `RESET_STATE;
    73. end else begin
    74. Current_State <= Next_State;
    75. end
    76. end
    77. assign CurrentState = Current_State;
    78. endmodule
    79. module DECODE(Zro_Flag, Carry_Flag, Neg_Flag, CurrentState, Crnt_Instrn, Incrmnt_PC, Ld_Brnch_Addr, Ld_Rtn_Addr);
    80. input Zro_Flag, Carry_Flag, Neg_Flag; // "Zero" Flag from DATA_PATH
    81. // "Carry" Flag from DATA_PATH
    82. // "Negative" Flag from DATA_PATH
    83. input [2:0] CurrentState; // CurrentState from FSM
    84. input [31:0] Crnt_Instrn; // Current instruction under execution
    85. // from Instruction Latch
    86. output Incrmnt_PC, Ld_Brnch_Addr, Ld_Rtn_Addr; // Increments PC (in WRITEBACK cycle)
    87. reg Incrmnt_PC; // appended automatically by vhdl2verilog.
    88. // Load Immediate add from Instrn Latch
    89. // into PC (in WRITEBACK cycle)
    90. // Load Return addr from Stack into PC (in WRITEBACK cycle)
    91. reg Brnch_Addr, Rtn_Addr, Take_Branch;
    92. reg Neg, Carry, Zro, Jmp;
    93. always @(Take_Branch or CurrentState or Crnt_Instrn or Zro_Flag or Carry_Flag or Neg_Flag or Brnch_Addr or Rtn_Addr) begin
    94. Brnch_Addr <= 1'b0;
    95. Rtn_Addr <= 1'b0;
    96. // Determine if Jmp on False or Jmp on True
    97. if ((Crnt_Instrn[25]) == 1'b1) begin
    98. Neg = ~Neg_Flag;
    99. Carry = ~Carry_Flag;
    100. Zro = ~Zro_Flag;
    101. Jmp = 1'b0;
    102. end else begin
    103. Neg = Neg_Flag;
    104. Carry = Carry_Flag;
    105. Zro = Zro_Flag;
    106. Jmp = 1'b1;
    107. end
    108. // Determines which of the CONDITIONs needs to be checked and whether to jmp
    109. if (Crnt_Instrn[23:16] == 8'b00000000) begin
    110. Take_Branch <= Neg;
    111. end else if (Crnt_Instrn[23:16] == 8'b00000001) begin
    112. Take_Branch <= Zro;
    113. end else if (Crnt_Instrn[23:16] == 8'b00000010) begin
    114. Take_Branch <= Carry;
    115. end else if (Crnt_Instrn[23:16] == 8'b00111111) begin
    116. Take_Branch <= Jmp;
    117. end else begin
    118. Take_Branch <= 1'b0;
    119. end
    120. case (CurrentState)
    121. `WRITEBACK: begin
    122. if (Crnt_Instrn[31:30] == 2'b00) begin
    123. // For Jmp/Call with condition check
    124. if ((Crnt_Instrn[29] == 1'b1 || Crnt_Instrn[28] == 1'b1) && Take_Branch == 1'b1) begin
    125. Brnch_Addr <= 1'b1;
    126. end
    127. // For Return
    128. if (Crnt_Instrn[27] == 1'b1) begin
    129. Rtn_Addr <= 1'b1;
    130. end
    131. end
    132. // If not Jmping or Rtrning the increment PC
    133. if (Rtn_Addr == 1'b1 || Brnch_Addr == 1'b1) begin
    134. Incrmnt_PC <= 1'b0;
    135. end else begin
    136. Incrmnt_PC <= 1'b1;
    137. end
    138. end
    139. default: begin
    140. Incrmnt_PC <= 1'b0;
    141. end
    142. endcase
    143. end
    144. assign Ld_Brnch_Addr = Brnch_Addr;
    145. assign Ld_Rtn_Addr = Rtn_Addr;
    146. endmodule
    147. module COUNT(Reset, Clk, Incrmnt_PC, Ld_Brnch_Addr, Ld_Rtn_Addr, Imm_Addr, Return_Addr, PC);
    148. input Reset, Clk, Incrmnt_PC, Ld_Brnch_Addr, Ld_Rtn_Addr; // Reset for the PC
    149. // CPU Clock
    150. // Increment PC
    151. // Load Jmp/Call Addr from instruction
    152. // Load Return Addr
    153. input [7:0] Imm_Addr, Return_Addr; // Immediate Addr for Jmp/Call
    154. // Return addr from Stack
    155. output [7:0] PC; // Addr of instruction to be fetched in
    156. // the next Fetch Cycle
    157. reg [7:0] PCint;
    158. always @(posedge Clk) begin
    159. if (Reset == 1'b1) begin
    160. PCint <= 8'b00000000;
    161. end else if (Incrmnt_PC == 1'b1) begin // Occurs in WRITEBACK cycle
    162. PCint <= PCint + 3'b001;
    163. end else if (Ld_Rtn_Addr == 1'b1) begin // Occurs in WRITEBACK cycle
    164. PCint <= Return_Addr;
    165. end else if (Ld_Brnch_Addr == 1'b1) begin // Occurs in WRITEBACK cycle
    166. PCint <= Imm_Addr;
    167. end
    168. end
    169. assign PC = PCint;
    170. endmodule

    其他

    list_libs

    report_lib <库名称>

     此命令可以查看某一工艺库的信息。我这里报错主要因为没安装 library compiler

    -help

    示例:

     man

    查看某一个命令的详细用法

    示例:

    打印环境变量

     list_designs

     current_design

     


     


    参考说明

    1、数字IC设计之综合工具Synopsys DC(2)

    2、新新新手Icer练习(二):Synopsys Design Compiler (DC) 基础操作


    欢迎交流~~~ 

  • 相关阅读:
    Typora最强替代神器Marktext
    nodejs爬虫 测试 modi
    43 mysql insert select 的实现
    滑动页面滚动条,获取div显示顶部是那个div
    Python里的引用与拷贝规律
    2023 “华为杯” 中国研究生数学建模竞赛(F题)深度剖析|数学建模完整代码+建模过程全解全析
    C++学习之引用
    图问题——深度和广度遍历,剑指offer专项105-107
    ES解析word内容为空的问题和直接使用Tika解析文档的方案
    第18篇ESP32platformio-arduino框架-ili9488-3.5lcd显示时间天气
  • 原文地址:https://blog.csdn.net/qq_43045275/article/details/127673625