Applying updates for Libero SoC support (#1855)
* Updated the new_project tcl function and removed set_device function. * fixing tcl command set_root and adding in build_hierarchy command. * Adding tcl command to export_prog_job file for FPExpress, saves in Libero SoC default location. * Attempting error checking on Libero SoC installation, and typo clean up. * Fixing -adv_options in new_project tcl command. * Moving script_ext back to its original location. * Commented out Libero environment variable. * Removed Libero environment variable.
This commit is contained in:
parent
94e6bb0247
commit
72cade55da
|
@ -8,6 +8,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
|
from shutil import which
|
||||||
|
|
||||||
from migen.fhdl.structure import _Fragment
|
from migen.fhdl.structure import _Fragment
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
def build_project(self):
|
def build_project(self):
|
||||||
tcl = []
|
tcl = []
|
||||||
|
|
||||||
|
die, package, speed = self.platform.device.split("-")
|
||||||
# Create project
|
# Create project
|
||||||
tcl.append(" ".join([
|
tcl.append(" ".join([
|
||||||
"new_project",
|
"new_project",
|
||||||
|
@ -96,35 +98,16 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
"-use_enhanced_constraint_flow 1",
|
"-use_enhanced_constraint_flow 1",
|
||||||
"-hdl {VERILOG}",
|
"-hdl {VERILOG}",
|
||||||
"-family {PolarFire}",
|
"-family {PolarFire}",
|
||||||
"-die {}",
|
|
||||||
"-package {}",
|
|
||||||
"-speed {}",
|
|
||||||
"-die_voltage {}",
|
|
||||||
"-part_range {}",
|
|
||||||
"-adv_options {}"
|
|
||||||
]))
|
|
||||||
|
|
||||||
die, package, speed = self.platform.device.split("-")
|
|
||||||
tcl.append(" ".join([
|
|
||||||
"set_device",
|
|
||||||
"-family {PolarFire}",
|
|
||||||
"-die {}".format(self.tcl_name(die)),
|
"-die {}".format(self.tcl_name(die)),
|
||||||
"-package {}".format(self.tcl_name(package)),
|
"-package {}".format(self.tcl_name(package)),
|
||||||
"-speed {}".format(self.tcl_name("-" + speed)),
|
"-speed {}".format(self.tcl_name("-" + speed)),
|
||||||
# FIXME: common to all PolarFire devices?
|
|
||||||
"-die_voltage {1.0}",
|
"-die_voltage {1.0}",
|
||||||
"-part_range {EXT}",
|
"-part_range {IND}",
|
||||||
"-adv_options {IO_DEFT_STD:LVCMOS 1.8V}",
|
"-adv_options {VCCI_1.2_VOLTR:IND}",
|
||||||
"-adv_options {RESTRICTPROBEPINS:1}",
|
"-adv_options {VCCI_1.5_VOLTR:IND}",
|
||||||
"-adv_options {RESTRICTSPIPINS:0}",
|
"-adv_options {VCCI_1.8_VOLTR:IND}",
|
||||||
"-adv_options {TEMPR:EXT}",
|
"-adv_options {VCCI_2.5_VOLTR:IND}",
|
||||||
"-adv_options {UNUSED_MSS_IO_RESISTOR_PULL:None}",
|
"-adv_options {VCCI_3.3_VOLTR:IND}"
|
||||||
"-adv_options {VCCI_1.2_VOLTR:EXT}",
|
|
||||||
"-adv_options {VCCI_1.5_VOLTR:EXT}",
|
|
||||||
"-adv_options {VCCI_1.8_VOLTR:EXT}",
|
|
||||||
"-adv_options {VCCI_2.5_VOLTR:EXT}",
|
|
||||||
"-adv_options {VCCI_3.3_VOLTR:EXT}",
|
|
||||||
"-adv_options {VOLTR:EXT} "
|
|
||||||
]))
|
]))
|
||||||
|
|
||||||
# Add sources
|
# Add sources
|
||||||
|
@ -132,13 +115,16 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
filename_tcl = "{" + filename + "}"
|
filename_tcl = "{" + filename + "}"
|
||||||
tcl.append("import_files -hdl_source " + filename_tcl)
|
tcl.append("import_files -hdl_source " + filename_tcl)
|
||||||
|
|
||||||
|
# Building the design Hierarchy
|
||||||
|
tcl.append("build_design_hierarchy")
|
||||||
# Set top level
|
# Set top level
|
||||||
tcl.append("set_root -module {}".format(self.tcl_name(self._build_name)))
|
tcl.append("set_root -module {}".format(self.tcl_name(self._build_name + "::work")))
|
||||||
|
|
||||||
# Copy init files FIXME: support for include path on LiberoSoC?
|
# Copy init files FIXME: support for include path on LiberoSoC?
|
||||||
for file in os.listdir(self._build_dir):
|
# Commenting out copy init file as this breaks the LiberoSoC flow.
|
||||||
if file.endswith(".init"):
|
# for file in os.listdir(self._build_dir):
|
||||||
tcl.append("file copy -- {} impl/synthesis".format(file))
|
# if file.endswith(".init"):
|
||||||
|
# tcl.append("file copy -- {} impl/synthesis".format(file))
|
||||||
|
|
||||||
# Import io constraints
|
# Import io constraints
|
||||||
tcl.append("import_files -io_pdc {}".format(self.tcl_name(self._build_name + "_io.pdc")))
|
tcl.append("import_files -io_pdc {}".format(self.tcl_name(self._build_name + "_io.pdc")))
|
||||||
|
@ -178,6 +164,23 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
tcl.append("run_tool -name {GENERATEPROGRAMMINGDATA}")
|
tcl.append("run_tool -name {GENERATEPROGRAMMINGDATA}")
|
||||||
tcl.append("run_tool -name {GENERATEPROGRAMMINGFILE}")
|
tcl.append("run_tool -name {GENERATEPROGRAMMINGFILE}")
|
||||||
|
|
||||||
|
# Export the FPExpress programming file to Libero SoC default location
|
||||||
|
tcl.append(" export_prog_job \
|
||||||
|
-job_file_name {top} \
|
||||||
|
-export_dir {./impl/designer/top/export} \
|
||||||
|
-bitstream_file_type {TRUSTED_FACILITY} \
|
||||||
|
-bitstream_file_components {FABRIC SNVM} \
|
||||||
|
-zeroization_likenew_action 0 \
|
||||||
|
-zeroization_unrecoverable_action 0 \
|
||||||
|
-program_design 1 \
|
||||||
|
-program_spi_flash 0 \
|
||||||
|
-include_plaintext_passkey 0 \
|
||||||
|
-design_bitstream_format {PPD} \
|
||||||
|
-prog_optional_procedures {} \
|
||||||
|
-skip_recommended_procedures {} \
|
||||||
|
-sanitize_snvm 0 ")
|
||||||
|
|
||||||
|
|
||||||
# Generate tcl
|
# Generate tcl
|
||||||
tools.write_to_file(self._build_name + ".tcl", "\n".join(tcl))
|
tools.write_to_file(self._build_name + ".tcl", "\n".join(tcl))
|
||||||
return self._build_name + ".tcl"
|
return self._build_name + ".tcl"
|
||||||
|
@ -221,6 +224,7 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
copy_stmt = "cp"
|
copy_stmt = "cp"
|
||||||
fail_stmt = " || exit 1"
|
fail_stmt = " || exit 1"
|
||||||
|
|
||||||
|
script_contents += "libero script:" + self._build_name + ".tcl\n"
|
||||||
script_file = "build_" + self._build_name + script_ext
|
script_file = "build_" + self._build_name + script_ext
|
||||||
tools.write_to_file(script_file, script_contents,
|
tools.write_to_file(script_file, script_contents,
|
||||||
force_unix=False)
|
force_unix=False)
|
||||||
|
@ -236,6 +240,10 @@ class MicrosemiLiberoSoCPolarfireToolchain(GenericToolchain):
|
||||||
else:
|
else:
|
||||||
shell = ["bash"]
|
shell = ["bash"]
|
||||||
|
|
||||||
|
if which("libero") is None:
|
||||||
|
msg = "Unable to find or source Libero SoC toolchain, please make sure libero has been installed corectly.\n"
|
||||||
|
raise OSError(msg)
|
||||||
|
|
||||||
if subprocess.call(shell + [script]) != 0:
|
if subprocess.call(shell + [script]) != 0:
|
||||||
raise OSError("Subprocess failed")
|
raise OSError("Subprocess failed")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue