@@ -75,6 +75,11 @@ YYosys::YYosys() {
75
75
/* create Yosys child process */
76
76
if ((this ->yosys_pid = fork ()) < 0 )
77
77
error_message (UTIL, unknown_location, " %s" , YOSYS_FORK_ERROR);
78
+ else {
79
+ /* set up VTR_ROOT path environment variable */
80
+ set_env (" VTR_ROOT" , std::string (global_args.program_root + " /.." ).c_str (), 1 );
81
+ }
82
+
78
83
#endif
79
84
}
80
85
@@ -205,52 +210,57 @@ void YYosys::execute() {
205
210
/* must only be performed in the Yosys child process */
206
211
oassert (this ->yosys_pid == 0 );
207
212
208
- // Read the hardware decription Verilog circuits
209
- // FOR loop enables include feature for Yosys+Odin (multiple Verilog input files)
210
- for (auto verilog_circuit : this ->verilog_circuits )
211
- run_pass (std::string (" read_verilog -nomem2reg -nolatches " + verilog_circuit));
212
-
213
- // Check whether cells match libraries and find top module
214
- run_pass (std::string (" hierarchy -check -auto-top" ));
215
-
216
- // Use a readable name convention
217
- run_pass (std::string (" autoname" ));
218
- // Translate processes to netlist components such as MUXs, FFs and latches
219
- run_pass (std::string (" proc; opt;" ));
220
- // Extraction and optimization of finite state machines
221
- run_pass (std::string (" fsm; opt;" ));
222
- // Collects memories, their port and create multiport memory cells
223
- run_pass (std::string (" memory_collect; memory_dff; opt;" ));
224
-
225
- // Looking for combinatorial loops, wires with multiple drivers and used wires without any driver.
226
- run_pass (std::string (" check" ));
227
- // Transform asynchronous dffs to synchronous dffs using techlib files provided by Yosys
228
- run_pass (std::string (" techmap -map " + this ->odin_techlib + " /adff2dff.v" ));
229
- run_pass (std::string (" techmap -map " + this ->odin_techlib + " /adffe2dff.v" ));
230
-
231
- /* *
232
- * convert yosys mem blocks to BRAMs / ROMs
233
- *
234
- * [NOTE] : Yosys complains about expression width more than 24 bits.
235
- * E.g.[63 : 0] memory[18 : 0] == > ERROR : Expression width 33554432 exceeds implementation limit of 16777216 !
236
- * Therfore, Yosys internal memory cells will be handled inside Odin-II as YMEM cell type.
237
- *
238
- * The following commands transform Yosys internal memories into BRAMs/ROMs defined in the Odin-II techlib
239
- * However, due to the above-mentioned reason they are commented.
240
- * Yosys::run_pass(std::string("memory_bram -rules ", this->odin_techlib, "/mem_rules.txt"))
241
- * Yosys::run_pass(std::string("techmap -map ", this->odin_techlib, "/mem_map.v"));
242
- */
243
-
244
- // Transform the design into a new one with single top module
245
- run_pass (std::string (" flatten" ));
246
- // Transforms PMUXes into trees of regular multiplexers
247
- run_pass (std::string (" pmuxtree" ));
248
- // "-undirven" to ensure there is no wire without drive
249
- run_pass (std::string (" opt -undriven -full" )); // -noff #potential option to remove all sdffXX and etc. Only dff will remain
250
- // Use a readable name convention
251
- run_pass (std::string (" autoname" ));
252
- // Print statistics
253
- run_pass (std::string (" stat" ));
213
+ if (configuration.tcl_file != " " ) {
214
+ // run the tcl file by yosys
215
+ run_pass (std::string (" tcl " + configuration.tcl_file ));
216
+ } else {
217
+ // Read the hardware decription Verilog circuits
218
+ // FOR loop enables include feature for Yosys+Odin (multiple Verilog input files)
219
+ for (auto verilog_circuit : this ->verilog_circuits )
220
+ run_pass (std::string (" read_verilog -nomem2reg -nolatches " + verilog_circuit));
221
+
222
+ // Check whether cells match libraries and find top module
223
+ run_pass (std::string (" hierarchy -check -auto-top" ));
224
+
225
+ // Use a readable name convention
226
+ run_pass (std::string (" autoname" ));
227
+ // Translate processes to netlist components such as MUXs, FFs and latches
228
+ run_pass (std::string (" proc; opt;" ));
229
+ // Extraction and optimization of finite state machines
230
+ run_pass (std::string (" fsm; opt;" ));
231
+ // Collects memories, their port and create multiport memory cells
232
+ run_pass (std::string (" memory_collect; memory_dff; opt;" ));
233
+
234
+ // Looking for combinatorial loops, wires with multiple drivers and used wires without any driver.
235
+ run_pass (std::string (" check" ));
236
+ // Transform asynchronous dffs to synchronous dffs using techlib files provided by Yosys
237
+ run_pass (std::string (" techmap -map " + this ->odin_techlib + " /adff2dff.v" ));
238
+ run_pass (std::string (" techmap -map " + this ->odin_techlib + " /adffe2dff.v" ));
239
+
240
+ /* *
241
+ * convert yosys mem blocks to BRAMs / ROMs
242
+ *
243
+ * [NOTE] : Yosys complains about expression width more than 24 bits.
244
+ * E.g.[63 : 0] memory[18 : 0] == > ERROR : Expression width 33554432 exceeds implementation limit of 16777216 !
245
+ * Therfore, Yosys internal memory cells will be handled inside Odin-II as YMEM cell type.
246
+ *
247
+ * The following commands transform Yosys internal memories into BRAMs/ROMs defined in the Odin-II techlib
248
+ * However, due to the above-mentioned reason they are commented.
249
+ * Yosys::run_pass(std::string("memory_bram -rules ", this->odin_techlib, "/mem_rules.txt"))
250
+ * Yosys::run_pass(std::string("techmap -map ", this->odin_techlib, "/mem_map.v"));
251
+ */
252
+
253
+ // Transform the design into a new one with single top module
254
+ run_pass (std::string (" flatten" ));
255
+ // Transforms PMUXes into trees of regular multiplexers
256
+ run_pass (std::string (" pmuxtree" ));
257
+ // "-undirven" to ensure there is no wire without drive
258
+ run_pass (std::string (" opt -undriven -full" )); // -noff #potential option to remove all sdffXX and etc. Only dff will remain
259
+ // Use a readable name convention
260
+ run_pass (std::string (" autoname" ));
261
+ // Print statistics
262
+ run_pass (std::string (" stat" ));
263
+ }
254
264
255
265
#endif
256
266
}
0 commit comments