2014-09-20 16:48:53 -04:00
|
|
|
from migen.fhdl.std import *
|
|
|
|
from migen.bus import wishbone
|
|
|
|
|
2015-02-28 05:36:15 -05:00
|
|
|
from misoclib.soc import SoC, mem_decoder
|
2014-09-20 16:48:53 -04:00
|
|
|
|
|
|
|
class _CRG(Module):
|
|
|
|
def __init__(self, clk_in):
|
|
|
|
self.clock_domains.cd_sys = ClockDomain()
|
|
|
|
self.clock_domains.cd_por = ClockDomain(reset_less=True)
|
|
|
|
|
|
|
|
# Power on Reset (vendor agnostic)
|
|
|
|
rst_n = Signal()
|
|
|
|
self.sync.por += rst_n.eq(1)
|
|
|
|
self.comb += [
|
|
|
|
self.cd_sys.clk.eq(clk_in),
|
|
|
|
self.cd_por.clk.eq(clk_in),
|
|
|
|
self.cd_sys.rst.eq(~rst_n)
|
|
|
|
]
|
|
|
|
|
2015-02-28 05:36:15 -05:00
|
|
|
class SimpleSoC(SoC):
|
2015-02-27 09:28:37 -05:00
|
|
|
def __init__(self, platform, **kwargs):
|
2015-02-28 05:36:15 -05:00
|
|
|
SoC.__init__(self, platform,
|
2015-02-26 06:53:52 -05:00
|
|
|
clk_freq=int((1/(platform.default_clk_period))*1000000000),
|
2015-02-27 09:28:37 -05:00
|
|
|
with_rom=True,
|
|
|
|
with_sdram=True, sdram_size=16*1024,
|
|
|
|
**kwargs)
|
2015-02-28 17:08:50 -05:00
|
|
|
clk_in = platform.request(platform.default_clk_name)
|
|
|
|
self.submodules.crg = _CRG(clk_in if not hasattr(clk_in, "p") else clk_in.p)
|
2014-09-20 16:48:53 -04:00
|
|
|
|
|
|
|
default_subtarget = SimpleSoC
|