2014-09-20 16:48:53 -04:00
|
|
|
from migen.fhdl.std import *
|
|
|
|
from migen.bus import wishbone
|
|
|
|
|
2015-02-26 13:38:52 -05:00
|
|
|
from misoclib.gensoc import GenSoC, IntegratedBIOS, 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)
|
|
|
|
]
|
|
|
|
|
|
|
|
class SimpleSoC(GenSoC, IntegratedBIOS):
|
2015-02-26 13:38:52 -05:00
|
|
|
mem_map = {
|
|
|
|
"sdram": 0x40000000, # (shadow @0xc0000000)
|
|
|
|
}
|
|
|
|
mem_map.update(GenSoC.mem_map)
|
|
|
|
|
2014-09-20 16:48:53 -04:00
|
|
|
def __init__(self, platform):
|
|
|
|
GenSoC.__init__(self, platform,
|
2015-02-26 06:53:52 -05:00
|
|
|
clk_freq=int((1/(platform.default_clk_period))*1000000000),
|
2014-09-20 16:48:53 -04:00
|
|
|
cpu_reset_address=0)
|
|
|
|
IntegratedBIOS.__init__(self)
|
|
|
|
|
2015-02-26 06:53:52 -05:00
|
|
|
self.submodules.crg = _CRG(platform.request(platform.default_clk_name))
|
2014-09-20 16:48:53 -04:00
|
|
|
|
|
|
|
# use on-board SRAM as SDRAM
|
|
|
|
sys_ram_size = 16*1024
|
|
|
|
self.submodules.sys_ram = wishbone.SRAM(sys_ram_size)
|
2015-02-26 13:38:52 -05:00
|
|
|
self.add_wb_slave(mem_decoder(self.mem_map["sdram"]), self.sys_ram.bus)
|
|
|
|
self.add_cpu_memory_region("sdram", self.mem_map["sdram"], sys_ram_size)
|
2014-09-20 16:48:53 -04:00
|
|
|
|
|
|
|
default_subtarget = SimpleSoC
|