build/efinix/efinity: Prepare build switch to direct calls of efx_map/efx_pnr/efx_pgm.

Will give us more flexibily and to display build infos.
This commit is contained in:
Florent Kermarrec 2021-11-10 19:46:09 +01:00
parent 873a0d4e17
commit ee605540bf
1 changed files with 85 additions and 2 deletions

View File

@ -324,8 +324,91 @@ class EfinityToolchain:
# Run # Run
if run: if run:
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: 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.") 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) os.chdir(cwd)