* generic_platform.py: add a finalize() method
... to add e.g. timing constraints after the other modules have had their say and when the signal names are known
This commit is contained in:
parent
6b56428a21
commit
e233c62d27
|
@ -74,6 +74,7 @@ quartus_sta {build_name}.qpf
|
||||||
class AlteraQuartusPlatform(GenericPlatform):
|
class AlteraQuartusPlatform(GenericPlatform):
|
||||||
def build(self, fragment, build_dir="build", build_name="top",
|
def build(self, fragment, build_dir="build", build_name="top",
|
||||||
quartus_path="/opt/Altera", run=True):
|
quartus_path="/opt/Altera", run=True):
|
||||||
|
self.finalize(fragment)
|
||||||
tools.mkdir_noerror(build_dir)
|
tools.mkdir_noerror(build_dir)
|
||||||
os.chdir(build_dir)
|
os.chdir(build_dir)
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ class GenericPlatform:
|
||||||
name = self.__module__.split(".")[-1]
|
name = self.__module__.split(".")[-1]
|
||||||
self.name = name
|
self.name = name
|
||||||
self.sources = []
|
self.sources = []
|
||||||
|
self.finalized = False
|
||||||
|
|
||||||
def request(self, *args, **kwargs):
|
def request(self, *args, **kwargs):
|
||||||
return self.constraint_manager.request(*args, **kwargs)
|
return self.constraint_manager.request(*args, **kwargs)
|
||||||
|
@ -162,6 +163,17 @@ class GenericPlatform:
|
||||||
def add_platform_command(self, *args, **kwargs):
|
def add_platform_command(self, *args, **kwargs):
|
||||||
return self.constraint_manager.add_platform_command(*args, **kwargs)
|
return self.constraint_manager.add_platform_command(*args, **kwargs)
|
||||||
|
|
||||||
|
def finalize(self, fragment, *args, **kwargs):
|
||||||
|
if self.finalized:
|
||||||
|
raise ConstraintError("Already finalized")
|
||||||
|
self.do_finalize(fragment, *args, **kwargs)
|
||||||
|
self.finalized = True
|
||||||
|
|
||||||
|
def do_finalize(self, fragment, *args, **kwargs):
|
||||||
|
"""overload this and e.g. add_platform_command()'s after the
|
||||||
|
modules had their say"""
|
||||||
|
pass
|
||||||
|
|
||||||
def add_source(self, filename, language=None):
|
def add_source(self, filename, language=None):
|
||||||
if language is None:
|
if language is None:
|
||||||
language = tools.language_by_filename(filename)
|
language = tools.language_by_filename(filename)
|
||||||
|
|
|
@ -150,6 +150,7 @@ class XilinxISEPlatform(GenericPlatform):
|
||||||
|
|
||||||
def build(self, fragment, build_dir="build", build_name="top",
|
def build(self, fragment, build_dir="build", build_name="top",
|
||||||
ise_path="/opt/Xilinx", source=True, run=True):
|
ise_path="/opt/Xilinx", source=True, run=True):
|
||||||
|
self.finalize(fragment)
|
||||||
tools.mkdir_noerror(build_dir)
|
tools.mkdir_noerror(build_dir)
|
||||||
os.chdir(build_dir)
|
os.chdir(build_dir)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue