diff --git a/litex/build/efinix/efinity.py b/litex/build/efinix/efinity.py index 77ff913f7..0390a33cd 100644 --- a/litex/build/efinix/efinity.py +++ b/litex/build/efinix/efinity.py @@ -324,8 +324,91 @@ class EfinityToolchain: # Run if run: - if subprocess.call([self.efinity_path + '/scripts/efx_run.py', build_name + '.xml', '-f', 'compile']) != 0: - raise OSError("Error occurred during efx_run script execution.") + if True: # FIXME: Keep efx_run for now as default. + if subprocess.call([self.efinity_path + '/scripts/efx_run.py', build_name + '.xml', '-f', 'compile']) != 0: + raise OSError("Error occurred during efx_run script execution.") + else: + # Synthesis/Mapping. + r = subprocess.call([self.efinity_path + "/bin/efx_map", + "--project", f"{build_name}", + "--root", f"{build_name}", + "--write-efx-verilog", f"outflow/{build_name}.map.v", + "--write-premap-module", f"outflow/{build_name}.elab.vdb", + "--binary-db", f"{build_name}.vdb", + "--family", "Trion", + "--device", platform.device, + "--mode", "speed", + "--max_ram", "-1", + "--max_mult", "-1", + "--infer-clk-enable", "3", + "--infer-sync-set-reset", "1", + "--fanout-limit", "0", + "--bram_output_regs_packing", "1", + "--retiming", "1", + "--seq_opt", "1", + "--blast_const_operand_adders", "1", + "--mult_input_regs_packing", "1", + "--mult_output_regs_packing", "1", + "--veri_option", "verilog_mode=verilog_2k,vhdl_mode=vhdl_2008", + "--work-dir", "work_syn", + "--output-dir", "outflow", + "--project-xml", f"{build_name}.xml", + "--I", "./" + ]) + if r != 0: + raise OSError("Error occurred during efx_map execution.") + + # Place and Route. + r = subprocess.call([self.efinity_path + "/bin/python3", + self.efinity_path + "/scripts/efx_run_pt.py", + f"{build_name}", + "Trion", + platform.device + ]) + if r != 0: + raise OSError("Error occurred during efx_run_pt execution.") + + r = subprocess.call([self.efinity_path + "/bin/efx_pnr", + "--circuit", f"{build_name}", + "--family", "Trion", + "--device", platform.device, + "--operating_conditions", platform.timing_model, + "--pack", + "--place", + "--route", + "--vdb_file", f"work_syn/{build_name}.vdb", + "--use_vdb_file", "on", + "--place_file", f"outflow/{build_name}.place", + "--route_file", f"outflow/{build_name}.route", + "--sdc_file", f"{build_name}.sdc", + #"--sync_file", f"{build_name}.csv", # FIXME. + "--seed", "1", + "--work_dir", "work_pnr", + "--output_dir", "outflow", + "--timing_analysis", "on", + "--load_delay_matrix" + ]) + if r != 0: + raise OSError("Error occurred during efx_pnr execution.") + + # Bitstream. + r = subprocess.call([self.efinity_path + "/bin/efx_pgm", + "--source", f"work_pnr/{build_name}.lbf", + "--dest", f"outflow/{build_name}.hex", + "--device", platform.device, + "--family", "Trion", + "--periph", f"outflow/{build_name}.lpf", + "--interface_designer_settings", f"outflow/{build_name}_or.ini", + "--oscillator_clock_divider", "DIV8", + "--spi_low_power_mode", "off", + "--io_weak_pullup", "on", + "--enable_roms", "on", + "--mode", "active", + "--width", "1", + "--enable_crc_check", "on" + ]) + if r != 0: + raise OSError("Error occurred during efx_pgm execution.") os.chdir(cwd)