| 1 | 11 | dinesha | # Copyright 2020 Efabless Corporation
 | 
      
         | 2 |  |  | #
 | 
      
         | 3 |  |  | # Licensed under the Apache License, Version 2.0 (the "License");
 | 
      
         | 4 |  |  | # you may not use this file except in compliance with the License.
 | 
      
         | 5 |  |  | # You may obtain a copy of the License at
 | 
      
         | 6 |  |  | #
 | 
      
         | 7 |  |  | #      http://www.apache.org/licenses/LICENSE-2.0
 | 
      
         | 8 |  |  | #
 | 
      
         | 9 |  |  | # Unless required by applicable law or agreed to in writing, software
 | 
      
         | 10 |  |  | # distributed under the License is distributed on an "AS IS" BASIS,
 | 
      
         | 11 |  |  | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
      
         | 12 |  |  | # See the License for the specific language governing permissions and
 | 
      
         | 13 |  |  | # limitations under the License.
 | 
      
         | 14 |  |  |  
 | 
      
         | 15 |  |  | # inputs expected as env vars
 | 
      
         | 16 |  |  | #set opt $::env(SYNTH_OPT)
 | 
      
         | 17 |  |  | ########### config.tcl ##################
 | 
      
         | 18 |  |  | # User config
 | 
      
         | 19 |  |  |  
 | 
      
         | 20 |  |  | # User config
 | 
      
         | 21 |  |  | set ::env(DESIGN_DIR) ../
 | 
      
         | 22 |  |  |  
 | 
      
         | 23 |  |  | set ::env(PROJ_DIR) ../../../../
 | 
      
         | 24 |  |  |  
 | 
      
         | 25 |  |  | # User config
 | 
      
         | 26 |  |  | set ::env(DESIGN_NAME) scr1_top_wb
 | 
      
         | 27 |  |  |  
 | 
      
         | 28 |  |  | # Change if needed
 | 
      
         | 29 |  |  | set ::env(VERILOG_FILES) [glob  \
 | 
      
         | 30 |  |  |         ../src/core/pipeline/scr1_pipe_top.sv  \
 | 
      
         | 31 |  |  |         ../src/core/scr1_core_top.sv  \
 | 
      
         | 32 |  |  |         ../src/core/scr1_dm.sv  \
 | 
      
         | 33 |  |  |         ../src/core/scr1_tapc_synchronizer.sv  \
 | 
      
         | 34 |  |  |         ../src/core/scr1_clk_ctrl.sv  \
 | 
      
         | 35 |  |  |         ../src/core/scr1_scu.sv  \
 | 
      
         | 36 |  |  |         ../src/core/scr1_tapc.sv  \
 | 
      
         | 37 |  |  |         ../src/core/scr1_tapc_shift_reg.sv  \
 | 
      
         | 38 |  |  |         ../src/core/scr1_dmi.sv  \
 | 
      
         | 39 |  |  |         ../src/core/primitives/scr1_reset_cells.sv  \
 | 
      
         | 40 |  |  |         ../src/core/pipeline/scr1_pipe_ifu.sv  \
 | 
      
         | 41 |  |  |         ../src/core/pipeline/scr1_pipe_idu.sv  \
 | 
      
         | 42 |  |  |         ../src/core/pipeline/scr1_pipe_exu.sv  \
 | 
      
         | 43 |  |  |         ../src/core/pipeline/scr1_pipe_mprf.sv  \
 | 
      
         | 44 |  |  |         ../src/core/pipeline/scr1_pipe_csr.sv  \
 | 
      
         | 45 |  |  |         ../src/core/pipeline/scr1_pipe_ialu.sv  \
 | 
      
         | 46 |  |  |         ../src/core/pipeline/scr1_pipe_lsu.sv  \
 | 
      
         | 47 |  |  |         ../src/core/pipeline/scr1_pipe_hdu.sv  \
 | 
      
         | 48 |  |  |         ../src/core/pipeline/scr1_pipe_tdu.sv  \
 | 
      
         | 49 |  |  |         ../src/core/pipeline/scr1_ipic.sv   \
 | 
      
         | 50 |  |  |         ../src/top/scr1_dmem_router.sv   \
 | 
      
         | 51 |  |  |         ../src/top/scr1_imem_router.sv   \
 | 
      
         | 52 |  |  |         ../src/top/scr1_tcm.sv   \
 | 
      
         | 53 |  |  |         ../src/top/scr1_timer.sv   \
 | 
      
         | 54 |  |  |         ../src/top/scr1_top_wb.sv   \
 | 
      
         | 55 |  |  |         ../src/top/scr1_dmem_wb.sv   \
 | 
      
         | 56 |  |  |         ../src/top/scr1_imem_wb.sv   \
 | 
      
         | 57 |  |  |         ../../../lib/sync_fifo.sv  ]
 | 
      
         | 58 |  |  |  
 | 
      
         | 59 |  |  | #set ::env(VERILOG_FILES_BLACKBOX) [glob  \
 | 
      
         | 60 |  |  | #            $::env(DESIGN_DIR)/src/top/scr1_dp_memory.sv ]
 | 
      
         | 61 |  |  |  
 | 
      
         | 62 |  |  | set ::env(VERILOG_INCLUDE_DIRS) [glob $::env(DESIGN_DIR)/src/includes]
 | 
      
         | 63 |  |  |  
 | 
      
         | 64 |  |  | set ::env(SYNTH_DEFINES) [list YOSYS ]
 | 
      
         | 65 |  |  | #set ::env(SYNTH_DEFINES) [list SCR1_DBG_EN SCR1_MPRF_RAM ]
 | 
      
         | 66 |  |  |  
 | 
      
         | 67 |  |  |  
 | 
      
         | 68 |  |  | set ::env(LIB_SYNTH)  ./tmp/trimmed.lib
 | 
      
         | 69 |  |  |  
 | 
      
         | 70 |  |  |  
 | 
      
         | 71 |  |  | #set ::env(SDC_FILE) "./designs/aes128/src/aes128.sdc"
 | 
      
         | 72 |  |  |  
 | 
      
         | 73 |  |  | # Fill this
 | 
      
         | 74 |  |  | set ::env(CLOCK_PERIOD) "10"
 | 
      
         | 75 |  |  | set ::env(CLOCK_PORT) "clk"
 | 
      
         | 76 |  |  | set ::env(CLOCK_TREE_SYNTH) 0
 | 
      
         | 77 |  |  |  
 | 
      
         | 78 |  |  | set ::env(RUN_SIMPLE_CTS) 0
 | 
      
         | 79 |  |  | set ::env(SYNTH_BUFFERING) 0
 | 
      
         | 80 |  |  | set ::env(SYNTH_SIZING) 0
 | 
      
         | 81 |  |  |  
 | 
      
         | 82 |  |  | set ::env(SYNTH_DRIVING_CELL) "sky130_fd_sc_hd__inv_8"
 | 
      
         | 83 |  |  | set ::env(SYNTH_CAP_LOAD) "17.65"
 | 
      
         | 84 |  |  | set ::env(SYNTH_MAX_TRAN) "[expr {0.1*10.0}]"
 | 
      
         | 85 |  |  |  
 | 
      
         | 86 |  |  | set ::env(SYNTH_MAX_FANOUT) 6
 | 
      
         | 87 |  |  | set ::env(FP_CORE_UTIL) 50
 | 
      
         | 88 |  |  | set ::env(PL_TARGET_DENSITY) [ expr ($::env(FP_CORE_UTIL)+5) / 100.0 ]
 | 
      
         | 89 |  |  | set ::env(CELL_PAD) 4
 | 
      
         | 90 |  |  |  
 | 
      
         | 91 |  |  | set ::env(SYNTH_NO_FLAT) "0"
 | 
      
         | 92 |  |  |  
 | 
      
         | 93 |  |  |  
 | 
      
         | 94 |  |  | set ::env(SYNTH_STRATEGY) "AREA 0"
 | 
      
         | 95 |  |  | set ::env(SYNTH_TIELO_PORT) "sky130_fd_sc_hd__conb_1 LO"
 | 
      
         | 96 |  |  | set ::env(SYNTH_TIEHI_PORT) "sky130_fd_sc_hd__conb_1 HI"
 | 
      
         | 97 |  |  | set ::env(SYNTH_MIN_BUF_PORT) "sky130_fd_sc_hd__buf_2 A X"
 | 
      
         | 98 |  |  |  
 | 
      
         | 99 |  |  |  
 | 
      
         | 100 |  |  | set ::env(CLOCK_NET) $::env(CLOCK_PORT)
 | 
      
         | 101 |  |  |  
 | 
      
         | 102 |  |  |  
 | 
      
         | 103 |  |  |  
 | 
      
         | 104 |  |  | set ::env(yosys_tmp_file_tag) "./tmp/"
 | 
      
         | 105 |  |  | set ::env(TMP_DIR) "./tmp/"
 | 
      
         | 106 |  |  | set ::env(yosys_netlist_dir) "./netlist"
 | 
      
         | 107 |  |  | set ::env(yosys_report_file_tag) "./reports/yosys"
 | 
      
         | 108 |  |  | set ::env(yosys_result_file_tag) "./reports/yosys.synthesis"
 | 
      
         | 109 |  |  |  
 | 
      
         | 110 |  |  | set ::env(SAVE_NETLIST) $::env(yosys_netlist_dir)/$::env(DESIGN_NAME).gv
 | 
      
         | 111 |  |  |  
 | 
      
         | 112 |  |  |  
 | 
      
         | 113 |  |  |  
 | 
      
         | 114 |  |  | ########### End of config.tcl
 | 
      
         | 115 |  |  | set buffering $::env(SYNTH_BUFFERING)
 | 
      
         | 116 |  |  | set sizing $::env(SYNTH_SIZING)
 | 
      
         | 117 |  |  |  
 | 
      
         | 118 |  |  | yosys -import
 | 
      
         | 119 |  |  |  
 | 
      
         | 120 |  |  | set vtop $::env(DESIGN_NAME)
 | 
      
         | 121 |  |  | #set sdc_file $::env(SDC_FILE)
 | 
      
         | 122 |  |  | set sclib $::env(LIB_SYNTH)
 | 
      
         | 123 |  |  |  
 | 
      
         | 124 |  |  | if { [info exists ::env(SYNTH_DEFINES) ] } {
 | 
      
         | 125 |  |  |         foreach define $::env(SYNTH_DEFINES) {
 | 
      
         | 126 |  |  |                 log "Defining $define"
 | 
      
         | 127 |  |  |                 verilog_defines -D$define
 | 
      
         | 128 |  |  |         }
 | 
      
         | 129 |  |  | }
 | 
      
         | 130 |  |  |  
 | 
      
         | 131 |  |  | set vIdirsArgs ""
 | 
      
         | 132 |  |  | if {[info exist ::env(VERILOG_INCLUDE_DIRS)]} {
 | 
      
         | 133 |  |  |         foreach dir $::env(VERILOG_INCLUDE_DIRS) {
 | 
      
         | 134 |  |  |                 log "Adding include file -I$dir "
 | 
      
         | 135 |  |  |                 lappend vIdirsArgs "-I$dir"
 | 
      
         | 136 |  |  |         }
 | 
      
         | 137 |  |  |         set vIdirsArgs [join $vIdirsArgs]
 | 
      
         | 138 |  |  | }
 | 
      
         | 139 |  |  |  
 | 
      
         | 140 |  |  |  
 | 
      
         | 141 |  |  |  
 | 
      
         | 142 |  |  | if { [info exists ::env(EXTRA_LIBS) ] } {
 | 
      
         | 143 |  |  |         foreach lib $::env(EXTRA_LIBS) {
 | 
      
         | 144 |  |  |                 read_liberty {*}$vIdirsArgs -lib -ignore_miss_dir -setattr blackbox $lib
 | 
      
         | 145 |  |  |         }
 | 
      
         | 146 |  |  | }
 | 
      
         | 147 |  |  |  
 | 
      
         | 148 |  |  |  
 | 
      
         | 149 |  |  |  
 | 
      
         | 150 |  |  | # ns expected (in sdc as well)
 | 
      
         | 151 |  |  | set clock_period [expr {$::env(CLOCK_PERIOD)*1000}]
 | 
      
         | 152 |  |  |  
 | 
      
         | 153 |  |  | set driver  $::env(SYNTH_DRIVING_CELL)
 | 
      
         | 154 |  |  | set cload   $::env(SYNTH_CAP_LOAD)
 | 
      
         | 155 |  |  | # input pin cap of IN_3VX8
 | 
      
         | 156 |  |  | set max_FO $::env(SYNTH_MAX_FANOUT)
 | 
      
         | 157 |  |  | if {![info exist ::env(SYNTH_MAX_TRAN)]} {
 | 
      
         | 158 |  |  |         set ::env(SYNTH_MAX_TRAN) [expr {0.1*$clock_period}]
 | 
      
         | 159 |  |  | } else {
 | 
      
         | 160 |  |  |         set ::env(SYNTH_MAX_TRAN) [expr {$::env(SYNTH_MAX_TRAN) * 1000}]
 | 
      
         | 161 |  |  | }
 | 
      
         | 162 |  |  | set max_Tran $::env(SYNTH_MAX_TRAN)
 | 
      
         | 163 |  |  |  
 | 
      
         | 164 |  |  |  
 | 
      
         | 165 |  |  | # Mapping parameters
 | 
      
         | 166 |  |  | set A_factor  0.00
 | 
      
         | 167 |  |  | set B_factor  0.88
 | 
      
         | 168 |  |  | set F_factor  0.00
 | 
      
         | 169 |  |  |  
 | 
      
         | 170 |  |  | # Don't change these unless you know what you are doing
 | 
      
         | 171 |  |  | set stat_ext    ".stat.rpt"
 | 
      
         | 172 |  |  | set chk_ext    ".chk.rpt"
 | 
      
         | 173 |  |  | set gl_ext      ".gl.v"
 | 
      
         | 174 |  |  | set constr_ext  ".$clock_period.constr"
 | 
      
         | 175 |  |  | set timing_ext  ".timing.txt"
 | 
      
         | 176 |  |  | set abc_ext     ".abc"
 | 
      
         | 177 |  |  |  
 | 
      
         | 178 |  |  |  
 | 
      
         | 179 |  |  | # get old sdc, add library specific stuff for abc scripts
 | 
      
         | 180 |  |  | set sdc_file $::env(yosys_tmp_file_tag).sdc
 | 
      
         | 181 |  |  | set outfile [open ${sdc_file} w]
 | 
      
         | 182 |  |  | #puts $outfile $sdc_data
 | 
      
         | 183 |  |  | puts $outfile "set_driving_cell ${driver}"
 | 
      
         | 184 |  |  | puts $outfile "set_load ${cload}"
 | 
      
         | 185 |  |  | close $outfile
 | 
      
         | 186 |  |  |  
 | 
      
         | 187 |  |  |  
 | 
      
         | 188 |  |  | # ABC Scrips
 | 
      
         | 189 |  |  | set abc_rs_K    "resub,-K,"
 | 
      
         | 190 |  |  | set abc_rs      "resub"
 | 
      
         | 191 |  |  | set abc_rsz     "resub,-z"
 | 
      
         | 192 |  |  | set abc_rw_K    "rewrite,-K,"
 | 
      
         | 193 |  |  | set abc_rw      "rewrite"
 | 
      
         | 194 |  |  | set abc_rwz     "rewrite,-z"
 | 
      
         | 195 |  |  | set abc_rf      "refactor"
 | 
      
         | 196 |  |  | set abc_rfz     "refactor,-z"
 | 
      
         | 197 |  |  | set abc_b       "balance"
 | 
      
         | 198 |  |  |  
 | 
      
         | 199 |  |  | set abc_resyn2        "${abc_b}; ${abc_rw}; ${abc_rf}; ${abc_b}; ${abc_rw}; ${abc_rwz}; ${abc_b}; ${abc_rfz}; ${abc_rwz}; ${abc_b}"
 | 
      
         | 200 |  |  | set abc_share         "strash; multi,-m; ${abc_resyn2}"
 | 
      
         | 201 |  |  | set abc_resyn2a       "${abc_b};${abc_rw};${abc_b};${abc_rw};${abc_rwz};${abc_b};${abc_rwz};${abc_b}"
 | 
      
         | 202 |  |  | set abc_resyn3        "balance;resub;resub,-K,6;balance;resub,-z;resub,-z,-K,6;balance;resub,-z,-K,5;balance"
 | 
      
         | 203 |  |  | set abc_resyn2rs      "${abc_b};${abc_rs_K},6;${abc_rw};${abc_rs_K},6,-N,2;${abc_rf};${abc_rs_K},8;${abc_rw};${abc_rs_K},10;${abc_rwz};${abc_rs_K},10,-N,2;${abc_b},${abc_rs_K},12;${abc_rfz};${abc_rs_K},12,-N,2;${abc_rwz};${abc_b}"
 | 
      
         | 204 |  |  |  
 | 
      
         | 205 |  |  | set abc_choice        "fraig_store; ${abc_resyn2}; fraig_store; ${abc_resyn2}; fraig_store; fraig_restore"
 | 
      
         | 206 |  |  | set abc_choice2      "fraig_store; balance; fraig_store; ${abc_resyn2}; fraig_store; ${abc_resyn2}; fraig_store; ${abc_resyn2}; fraig_store; fraig_restore"
 | 
      
         | 207 |  |  |  
 | 
      
         | 208 |  |  | set abc_map_old_cnt                     "map,-p,-a,-B,0.2,-A,0.9,-M,0"
 | 
      
         | 209 |  |  | set abc_map_old_dly         "map,-p,-B,0.2,-A,0.9,-M,0"
 | 
      
         | 210 |  |  | set abc_retime_area         "retime,-D,{D},-M,5"
 | 
      
         | 211 |  |  | set abc_retime_dly          "retime,-D,{D},-M,6"
 | 
      
         | 212 |  |  | set abc_map_new_area        "amap,-m,-Q,0.1,-F,20,-A,20,-C,5000"
 | 
      
         | 213 |  |  |  
 | 
      
         | 214 |  |  | set abc_area_recovery_1       "${abc_choice}; map;"
 | 
      
         | 215 |  |  | set abc_area_recovery_2       "${abc_choice2}; map;"
 | 
      
         | 216 |  |  |  
 | 
      
         | 217 |  |  | set map_old_cnt                     "map,-p,-a,-B,0.2,-A,0.9,-M,0"
 | 
      
         | 218 |  |  | set map_old_dly                     "map,-p,-B,0.2,-A,0.9,-M,0"
 | 
      
         | 219 |  |  | set abc_retime_area     "retime,-D,{D},-M,5"
 | 
      
         | 220 |  |  | set abc_retime_dly      "retime,-D,{D},-M,6"
 | 
      
         | 221 |  |  | set abc_map_new_area    "amap,-m,-Q,0.1,-F,20,-A,20,-C,5000"
 | 
      
         | 222 |  |  |  
 | 
      
         | 223 |  |  | if {$buffering==1} {
 | 
      
         | 224 |  |  |         set abc_fine_tune               "buffer,-N,${max_FO},-S,${max_Tran};upsize,{D};dnsize,{D}"
 | 
      
         | 225 |  |  | } elseif {$sizing} {
 | 
      
         | 226 |  |  |         set abc_fine_tune       "upsize,{D};dnsize,{D}"
 | 
      
         | 227 |  |  | } else {
 | 
      
         | 228 |  |  |         set abc_fine_tune       ""
 | 
      
         | 229 |  |  | }
 | 
      
         | 230 |  |  |  
 | 
      
         | 231 |  |  |  
 | 
      
         | 232 |  |  | set delay_scripts [list \
 | 
      
         | 233 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_dly}; scleanup;${abc_map_old_dly};retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 234 |  |  |         \
 | 
      
         | 235 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_dly}; scleanup;${abc_choice2};${abc_map_old_dly};${abc_area_recovery_2}; retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 236 |  |  |         \
 | 
      
         | 237 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_dly}; scleanup;${abc_choice};${abc_map_old_dly};${abc_area_recovery_1}; retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 238 |  |  |         \
 | 
      
         | 239 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_area};scleanup;${abc_choice2};${abc_map_new_area};${abc_choice2};${abc_map_old_dly};retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 240 |  |  |         ]
 | 
      
         | 241 |  |  |  
 | 
      
         | 242 |  |  | set area_scripts [list \
 | 
      
         | 243 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_area};scleanup;${abc_choice2};${abc_map_new_area};retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 244 |  |  |         \
 | 
      
         | 245 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_resyn2};${abc_retime_area};scleanup;${abc_choice2};${abc_map_new_area};${abc_choice2};${abc_map_new_area};retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 246 |  |  |         \
 | 
      
         | 247 |  |  |         "+read_constr,${sdc_file};fx;mfs;strash;refactor;${abc_choice2};${abc_retime_area};scleanup;${abc_choice2};${abc_map_new_area};${abc_choice2};${abc_map_new_area};retime,-D,{D};${abc_fine_tune};stime,-p;print_stats -m" \
 | 
      
         | 248 |  |  |         ]
 | 
      
         | 249 |  |  |  
 | 
      
         | 250 |  |  | set all_scripts [list {*}$delay_scripts {*}$area_scripts]
 | 
      
         | 251 |  |  |  
 | 
      
         | 252 |  |  | set strategy_parts [split $::env(SYNTH_STRATEGY)]
 | 
      
         | 253 |  |  |  
 | 
      
         | 254 |  |  | proc synth_strategy_format_err { } {
 | 
      
         | 255 |  |  |         upvar area_scripts area_scripts
 | 
      
         | 256 |  |  |         upvar delay_scripts delay_scripts
 | 
      
         | 257 |  |  |         log -stderr "\[ERROR] Misformatted SYNTH_STRATEGY (\"$::env(SYNTH_STRATEGY)\")."
 | 
      
         | 258 |  |  |         log -stderr "\[ERROR] Correct format is \"DELAY|AREA 0-[expr [llength $delay_scripts]-1]|0-[expr [llength $area_scripts]-1]\"."
 | 
      
         | 259 |  |  |         exit 1
 | 
      
         | 260 |  |  | }
 | 
      
         | 261 |  |  |  
 | 
      
         | 262 |  |  | if { [llength $strategy_parts] != 2 } {
 | 
      
         | 263 |  |  |         synth_strategy_format_err
 | 
      
         | 264 |  |  | }
 | 
      
         | 265 |  |  |  
 | 
      
         | 266 |  |  | set strategy_type [lindex $strategy_parts 0]
 | 
      
         | 267 |  |  | set strategy_type_idx [lindex $strategy_parts 1]
 | 
      
         | 268 |  |  |  
 | 
      
         | 269 |  |  | if { $strategy_type != "AREA" && $strategy_type != "DELAY" } {
 | 
      
         | 270 |  |  |         log -stderr "\[ERROR] AREA|DELAY tokens not found. ($strategy_type)"
 | 
      
         | 271 |  |  |         synth_strategy_format_err
 | 
      
         | 272 |  |  | }
 | 
      
         | 273 |  |  |  
 | 
      
         | 274 |  |  | if { $strategy_type == "DELAY" && $strategy_type_idx >= [llength $delay_scripts] } {
 | 
      
         | 275 |  |  |         log -stderr "\[ERROR] strategy index ($strategy_type_idx) is too high."
 | 
      
         | 276 |  |  |         synth_strategy_format_err
 | 
      
         | 277 |  |  | }
 | 
      
         | 278 |  |  |  
 | 
      
         | 279 |  |  | if { $strategy_type == "AREA" && $strategy_type_idx >= [llength $area_scripts] } {
 | 
      
         | 280 |  |  |         log -stderr "\[ERROR] strategy index ($strategy_type_idx) is too high."
 | 
      
         | 281 |  |  |         synth_strategy_format_err
 | 
      
         | 282 |  |  | }
 | 
      
         | 283 |  |  |  
 | 
      
         | 284 |  |  | if { $strategy_type == "DELAY" } {
 | 
      
         | 285 |  |  |         set strategy $strategy_type_idx
 | 
      
         | 286 |  |  | } else {
 | 
      
         | 287 |  |  |         set strategy [expr {[llength $delay_scripts]+$strategy_type_idx}]
 | 
      
         | 288 |  |  | }
 | 
      
         | 289 |  |  |  
 | 
      
         | 290 |  |  |  
 | 
      
         | 291 |  |  | for { set i 0 } { $i < [llength $::env(VERILOG_FILES)] } { incr i } {
 | 
      
         | 292 |  |  |         read_verilog -sv {*}$vIdirsArgs [lindex $::env(VERILOG_FILES) $i]
 | 
      
         | 293 |  |  | }
 | 
      
         | 294 |  |  |  
 | 
      
         | 295 |  |  | if { [info exists ::env(VERILOG_FILES_BLACKBOX)] } {
 | 
      
         | 296 |  |  |         foreach verilog_file $::env(VERILOG_FILES_BLACKBOX) {
 | 
      
         | 297 |  |  |                 read_verilog -sv {*}$vIdirsArgs -lib $verilog_file
 | 
      
         | 298 |  |  |         }
 | 
      
         | 299 |  |  | }
 | 
      
         | 300 |  |  | select -module $vtop
 | 
      
         | 301 |  |  | show -format dot -prefix $::env(TMP_DIR)/synthesis/hierarchy
 | 
      
         | 302 |  |  | select -clear
 | 
      
         | 303 |  |  |  
 | 
      
         | 304 |  |  | hierarchy -check -top $vtop
 | 
      
         | 305 |  |  |  
 | 
      
         | 306 |  |  | # Infer tri-state buffers.
 | 
      
         | 307 |  |  | set tbuf_map false
 | 
      
         | 308 |  |  | if { [info exists ::env(TRISTATE_BUFFER_MAP)] } {
 | 
      
         | 309 |  |  |         if { [file exists $::env(TRISTATE_BUFFER_MAP)] } {
 | 
      
         | 310 |  |  |                 set tbuf_map true
 | 
      
         | 311 |  |  |                 tribuf
 | 
      
         | 312 |  |  |         } else {
 | 
      
         | 313 |  |  |           log "WARNING: TRISTATE_BUFFER_MAP is defined but could not be found: $::env(TRISTATE_BUFFER_MAP)"
 | 
      
         | 314 |  |  |         }
 | 
      
         | 315 |  |  | }
 | 
      
         | 316 |  |  |  
 | 
      
         | 317 |  |  | if { $::env(SYNTH_NO_FLAT) } {
 | 
      
         | 318 |  |  |         synth -top $vtop
 | 
      
         | 319 |  |  | } else {
 | 
      
         | 320 |  |  |         synth -top $vtop -flatten
 | 
      
         | 321 |  |  | }
 | 
      
         | 322 |  |  |  
 | 
      
         | 323 |  |  | share -aggressive
 | 
      
         | 324 |  |  | opt
 | 
      
         | 325 |  |  | opt_clean -purge
 | 
      
         | 326 |  |  |  
 | 
      
         | 327 |  |  | tee -o "$::env(yosys_report_file_tag)_pre.stat" stat
 | 
      
         | 328 |  |  |  
 | 
      
         | 329 |  |  | # Map tri-state buffers.
 | 
      
         | 330 |  |  | if { $tbuf_map } {
 | 
      
         | 331 |  |  |         log {mapping tbuf}
 | 
      
         | 332 |  |  |         techmap -map $::env(TRISTATE_BUFFER_MAP)
 | 
      
         | 333 |  |  |         simplemap
 | 
      
         | 334 |  |  | }
 | 
      
         | 335 |  |  |  
 | 
      
         | 336 |  |  | # handle technology mapping of 4-MUX, and tell Yosys to infer 4-muxes
 | 
      
         | 337 |  |  | if { [info exists ::env(SYNTH_MUX4_MAP)] && [file exists $::env(SYNTH_MUX4_MAP)] } {
 | 
      
         | 338 |  |  |   muxcover -mux4
 | 
      
         | 339 |  |  |   techmap -map $::env(SYNTH_MUX4_MAP)
 | 
      
         | 340 |  |  |   simplemap
 | 
      
         | 341 |  |  | }
 | 
      
         | 342 |  |  |  
 | 
      
         | 343 |  |  | # handle technology mapping of 2-MUX
 | 
      
         | 344 |  |  | if { [info exists ::env(SYNTH_MUX_MAP)] && [file exists $::env(SYNTH_MUX_MAP)] } {
 | 
      
         | 345 |  |  |   techmap -map $::env(SYNTH_MUX_MAP)
 | 
      
         | 346 |  |  |   simplemap
 | 
      
         | 347 |  |  | }
 | 
      
         | 348 |  |  |  
 | 
      
         | 349 |  |  | # handle technology mapping of latches
 | 
      
         | 350 |  |  | if { [info exists ::env(SYNTH_LATCH_MAP)] && [file exists $::env(SYNTH_LATCH_MAP)] } {
 | 
      
         | 351 |  |  |         techmap -map $::env(SYNTH_LATCH_MAP)
 | 
      
         | 352 |  |  |         simplemap
 | 
      
         | 353 |  |  | }
 | 
      
         | 354 |  |  |  
 | 
      
         | 355 |  |  | dfflibmap -liberty $sclib
 | 
      
         | 356 |  |  | tee -o "$::env(yosys_report_file_tag)_dff.stat" stat
 | 
      
         | 357 |  |  |  
 | 
      
         | 358 |  |  | if { [info exists ::env(SYNTH_EXPLORE)] && $::env(SYNTH_EXPLORE) } {
 | 
      
         | 359 |  |  |         design -save myDesign
 | 
      
         | 360 |  |  |  
 | 
      
         | 361 |  |  |         for { set index 0 }  { $index < [llength $all_scripts] }  { incr index } {
 | 
      
         | 362 |  |  |                 log "\[INFO\]: ABC: WireLoad : S_$index"
 | 
      
         | 363 |  |  |                 design -load myDesign
 | 
      
         | 364 |  |  |  
 | 
      
         | 365 |  |  |                 abc -D $clock_period \
 | 
      
         | 366 |  |  |                         -constr "$sdc_file" \
 | 
      
         | 367 |  |  |                         -liberty $sclib  \
 | 
      
         | 368 |  |  |                         -script [lindex $all_scripts $index]
 | 
      
         | 369 |  |  |  
 | 
      
         | 370 |  |  |                 setundef -zero
 | 
      
         | 371 |  |  |  
 | 
      
         | 372 |  |  |                 hilomap -hicell {*}$::env(SYNTH_TIEHI_PORT) -locell {*}$::env(SYNTH_TIELO_PORT)
 | 
      
         | 373 |  |  |  
 | 
      
         | 374 |  |  |                 # get rid of the assignments that make verilog2def fail
 | 
      
         | 375 |  |  |                 splitnets
 | 
      
         | 376 |  |  |                 opt_clean -purge
 | 
      
         | 377 |  |  |                 insbuf -buf {*}$::env(SYNTH_MIN_BUF_PORT)
 | 
      
         | 378 |  |  |  
 | 
      
         | 379 |  |  |                 tee -o "$::env(yosys_report_file_tag)_$index$chk_ext" check
 | 
      
         | 380 |  |  |                 write_verilog -noattr -noexpr -nohex -nodec -defparam "$::env(yosys_result_file_tag)_$index.v"
 | 
      
         | 381 |  |  |                 design -reset
 | 
      
         | 382 |  |  |         }
 | 
      
         | 383 |  |  | } else {
 | 
      
         | 384 |  |  |  
 | 
      
         | 385 |  |  |         log "\[INFO\]: ABC: WireLoad : S_$strategy"
 | 
      
         | 386 |  |  |  
 | 
      
         | 387 |  |  |         abc -D $clock_period \
 | 
      
         | 388 |  |  |                 -constr "$sdc_file" \
 | 
      
         | 389 |  |  |                 -liberty $sclib  \
 | 
      
         | 390 |  |  |                 -script [lindex $all_scripts $strategy] \
 | 
      
         | 391 |  |  |                 -showtmp;
 | 
      
         | 392 |  |  |  
 | 
      
         | 393 |  |  |         setundef -zero
 | 
      
         | 394 |  |  |  
 | 
      
         | 395 |  |  |         hilomap -hicell {*}$::env(SYNTH_TIEHI_PORT) -locell {*}$::env(SYNTH_TIELO_PORT)
 | 
      
         | 396 |  |  |  
 | 
      
         | 397 |  |  |         # get rid of the assignments that make verilog2def fail
 | 
      
         | 398 |  |  |         splitnets
 | 
      
         | 399 |  |  |         opt_clean -purge
 | 
      
         | 400 |  |  |         insbuf -buf {*}$::env(SYNTH_MIN_BUF_PORT)
 | 
      
         | 401 |  |  |  
 | 
      
         | 402 |  |  |         tee -o "$::env(yosys_report_file_tag)_$strategy$chk_ext" check
 | 
      
         | 403 |  |  |         write_verilog -noattr -noexpr -nohex -nodec -defparam "$::env(SAVE_NETLIST)"
 | 
      
         | 404 |  |  | }
 | 
      
         | 405 |  |  |  
 | 
      
         | 406 |  |  | if { $::env(SYNTH_NO_FLAT) } {
 | 
      
         | 407 |  |  |         design -reset
 | 
      
         | 408 |  |  |         file copy -force $::env(SAVE_NETLIST) $::env(yosys_tmp_file_tag)_unflat.v
 | 
      
         | 409 |  |  |         read_verilog -sv $::env(SAVE_NETLIST)
 | 
      
         | 410 |  |  |         synth -top $vtop -flatten
 | 
      
         | 411 |  |  |         splitnets
 | 
      
         | 412 |  |  |         opt_clean -purge
 | 
      
         | 413 |  |  |         insbuf -buf {*}$::env(SYNTH_MIN_BUF_PORT)
 | 
      
         | 414 |  |  |         write_verilog -noattr -noexpr -nohex -nodec -defparam "$::env(SAVE_NETLIST)"
 | 
      
         | 415 |  |  |         tee -o "$::env(yosys_report_file_tag)_$strategy$chk_ext" check
 | 
      
         | 416 |  |  | }
 |