Skip to content

Commit 554731a

Browse files
committedFeb 26, 2015
targets/simple: make it generic (no default_platform, use platform's default_clk_name/default_clk_period)
1 parent 02b3f51 commit 554731a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed
 

Diff for: ‎make.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ def _get_args():
6969
top_class = target_module.default_subtarget
7070

7171
if args.platform is None:
72-
platform_name = top_class.default_platform
72+
if hasattr(top_class, "default_platform"):
73+
platform_name = top_class.default_platform
74+
else:
75+
raise ValueError("Target has no default platform, specify a platform with -p your_platform")
7376
else:
7477
platform_name = args.platform
7578
platform_module = misoc_import("mibuild.platforms", external_platform, platform_name)

Diff for: ‎targets/simple.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,13 @@ def __init__(self, clk_in):
1818
]
1919

2020
class SimpleSoC(GenSoC, IntegratedBIOS):
21-
default_platform = "de0nano" # /!\ Adapt this!
22-
clk_name = "clk50" # /!\ Adapt this!
23-
clk_freq = 50*1000000 # /!\ Adapt this!
24-
2521
def __init__(self, platform):
2622
GenSoC.__init__(self, platform,
27-
clk_freq=self.clk_freq,
23+
clk_freq=int((1/(platform.default_clk_period))*1000000000),
2824
cpu_reset_address=0)
2925
IntegratedBIOS.__init__(self)
3026

31-
self.submodules.crg = _CRG(platform.request(self.clk_name))
27+
self.submodules.crg = _CRG(platform.request(platform.default_clk_name))
3228

3329
# use on-board SRAM as SDRAM
3430
sys_ram_size = 16*1024

0 commit comments

Comments
 (0)
Please sign in to comment.