targets/simple: make it generic (no default_platform, use platform's default_clk_name/default_clk_period)

This commit is contained in:
Florent Kermarrec 2015-02-26 12:53:52 +01:00
parent 02b3f51382
commit 554731ae44
2 changed files with 6 additions and 7 deletions

View File

@ -69,7 +69,10 @@ if __name__ == "__main__":
top_class = target_module.default_subtarget
if args.platform is None:
platform_name = top_class.default_platform
if hasattr(top_class, "default_platform"):
platform_name = top_class.default_platform
else:
raise ValueError("Target has no default platform, specify a platform with -p your_platform")
else:
platform_name = args.platform
platform_module = misoc_import("mibuild.platforms", external_platform, platform_name)

View File

@ -18,17 +18,13 @@ class _CRG(Module):
]
class SimpleSoC(GenSoC, IntegratedBIOS):
default_platform = "de0nano" # /!\ Adapt this!
clk_name = "clk50" # /!\ Adapt this!
clk_freq = 50*1000000 # /!\ Adapt this!
def __init__(self, platform):
GenSoC.__init__(self, platform,
clk_freq=self.clk_freq,
clk_freq=int((1/(platform.default_clk_period))*1000000000),
cpu_reset_address=0)
IntegratedBIOS.__init__(self)
self.submodules.crg = _CRG(platform.request(self.clk_name))
self.submodules.crg = _CRG(platform.request(platform.default_clk_name))
# use on-board SRAM as SDRAM
sys_ram_size = 16*1024