build/generic_platform: add default_clk constraints only when used.

This commit is contained in:
Florent Kermarrec 2020-06-02 13:34:09 +02:00
parent 0cd613ccb8
commit 89106873db
1 changed files with 3 additions and 1 deletions

View File

@ -278,6 +278,7 @@ class GenericPlatform:
self.verilog_include_paths = [] self.verilog_include_paths = []
self.output_dir = None self.output_dir = None
self.finalized = False self.finalized = False
self.use_default_clk = 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)
@ -313,6 +314,7 @@ class GenericPlatform:
"No default clock and no clock domain defined") "No default clock and no clock domain defined")
crg = CRG(self.request(self.default_clk_name)) crg = CRG(self.request(self.default_clk_name))
fragment += crg.get_fragment() fragment += crg.get_fragment()
self.user_default_clk = True
self.do_finalize(fragment, *args, **kwargs) self.do_finalize(fragment, *args, **kwargs)
self.finalized = True self.finalized = True
@ -320,7 +322,7 @@ class GenericPlatform:
def do_finalize(self, fragment, *args, **kwargs): def do_finalize(self, fragment, *args, **kwargs):
"""overload this and e.g. add_platform_command()'s after the modules """overload this and e.g. add_platform_command()'s after the modules
had their say""" had their say"""
if hasattr(self, "default_clk_period"): if self.use_default_clk:
try: try:
self.add_period_constraint( self.add_period_constraint(
self.lookup_request(self.default_clk_name), self.lookup_request(self.default_clk_name),