e6d89128aa482a5c9551b157b3a582de96e8c936
7 from migen
.genlib
.io
import CRG
9 from misoc
.cores
.liteeth_mini
.phy
import LiteEthPHY
10 from misoc
.cores
.liteeth_mini
.mac
import LiteEthMAC
11 from misoc
.integration
.soc_core
import *
12 from misoc
.integration
.builder
import *
15 class BaseSoC(SoCCore
):
16 def __init__(self
, platform
, **kwargs
):
17 SoCCore
.__init
__(self
, platform
,
18 clk_freq
=int((1/(platform
.default_clk_period
))*1000000000),
19 integrated_rom_size
=0x8000,
20 integrated_main_ram_size
=16*1024,
22 self
.submodules
.crg
= CRG(platform
.request(platform
.default_clk_name
))
25 class MiniSoC(BaseSoC
):
30 csr_map
.update(BaseSoC
.csr_map
)
35 interrupt_map
.update(BaseSoC
.interrupt_map
)
38 "ethmac": 0x30000000, # (shadow @0xb0000000)
40 mem_map
.update(BaseSoC
.mem_map
)
42 def __init__(self
, platform
, **kwargs
):
43 BaseSoC
.__init
__(self
, platform
, **kwargs
)
45 self
.submodules
.ethphy
= LiteEthPHY(platform
.request("eth_clocks"),
46 platform
.request("eth"))
47 self
.submodules
.ethmac
= LiteEthMAC(phy
=self
.ethphy
, dw
=32,
49 with_preamble_crc
=False)
50 self
.add_wb_slave(mem_decoder(self
.mem_map
["ethmac"]), self
.ethmac
.bus
)
51 self
.add_memory_region("ethmac", self
.mem_map
["ethmac"] | self
.shadow_base
, 0x2000)
55 parser
= argparse
.ArgumentParser(description
="Generic MiSoC port")
58 parser
.add_argument("--with-ethernet", action
="store_true",
59 help="enable Ethernet support")
60 parser
.add_argument("platform",
61 help="module name of the Migen platform to build for")
62 args
= parser
.parse_args()
64 platform_module
= importlib
.import_module(args
.platform
)
65 platform
= platform_module
.Platform()
66 cls
= MiniSoC
if args
.with_ethernet
else BaseSoC
67 soc
= cls(platform
, **soc_core_argdict(args
))
68 builder
= Builder(soc
, **builder_argdict(args
))
72 if __name__
== "__main__":