Skip to content

Commit

Permalink
Merge pull request #453 from mithro/or1k-rom-size-fix
Browse files Browse the repository at this point in the history
targets: Working on ROM size fixes.
  • Loading branch information
mithro committed Sep 1, 2018
2 parents 2939f93 + 754f0a3 commit 2b3ff04
Show file tree
Hide file tree
Showing 21 changed files with 177 additions and 87 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ jobs:
- stage: Targets
env: C=or1k.linux F=linux P=arty T="net"

- stage: Targets
env: C=or1k.linux F=linux P=atlys T="net"

- stage: Targets
env: C=or1k.linux F=linux P=opsis T="net"

- stage: Targets
env: C=or1k.linux F=linux P=nexys_video T="net"

#--------------------------------------------
# Video Targets
#--------------------------------------------
Expand Down
10 changes: 6 additions & 4 deletions targets/arty/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ class BaseSoC(SoCSDRAM):
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, spiflash="spiflash_1x", **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
4 changes: 4 additions & 0 deletions targets/arty/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class NetSoC(BaseSoC):
mem_map.update(BaseSoC.mem_map)

def __init__(self, platform, *args, **kwargs):
# Need a larger integrated ROM on or1k to fit the BIOS with TFTP support.
if 'integrated_rom_size' not in kwargs and kwargs.get('cpu_type', 'lm32') == 'or1k':
kwargs['integrated_rom_size'] = 0x10000

BaseSoC.__init__(self, platform, *args, **kwargs)

self.submodules.ethphy = LiteEthPHY(
Expand Down
14 changes: 8 additions & 6 deletions targets/atlys/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,19 @@ class BaseSoC(SoCSDRAM):
csr_map_update(SoCSDRAM.csr_map, csr_peripherals)

mem_map = {
"spiflash": 0x20000000, # (default shadow @0xa0000000)
"spiflash": 0x20000000, # (default shadow @0xa0000000)
}
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = 75*1000000
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x4000,
with_uart=True,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

Expand Down
4 changes: 4 additions & 0 deletions targets/atlys/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class NetSoC(BaseSoC):
mem_map.update(BaseSoC.mem_map)

def __init__(self, platform, *args, **kwargs):
# Need a larger integrated ROM on or1k to fit the BIOS with TFTP support.
if 'integrated_rom_size' not in kwargs and kwargs.get('cpu_type', 'lm32') == 'or1k':
kwargs['integrated_rom_size'] = 0x10000

BaseSoC.__init__(self, platform, *args, **kwargs)

self.submodules.ethphy = LiteEthPHY(
Expand Down
10 changes: 6 additions & 4 deletions targets/basys3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ class BaseSoC(SoCCore):
mem_map.update(SoCCore.mem_map)

def __init__(self, platform, spiflash="spiflash_1x", **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCCore.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCCore.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
10 changes: 6 additions & 4 deletions targets/cmod_a7/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ class BaseSoC(SoCCore):
mem_map.update(SoCCore.mem_map)

def __init__(self, platform, spiflash="spiflash_1x", **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCCore.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCCore.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
26 changes: 20 additions & 6 deletions targets/galatea/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from litedram.phy import s6ddrphy
from litedram.core import ControllerSettings

from gateware import info

from targets.utils import csr_map_update


Expand Down Expand Up @@ -173,26 +175,38 @@ class BaseSoC(SoCSDRAM):
csr_peripherals = (
"spiflash",
"ddrphy",
"info",
)
csr_map_update(SoCSDRAM.csr_map, csr_peripherals)

# FIXME: Add spiflash
#mem_map = {
# "spiflash": 0x20000000, # (default shadow @0xa0000000)
#}
#mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
clk_freq = 50*1000000
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000

if 'expansion' in kwargs:
tofe_board_name = kwargs.get('expansion')
del kwargs['expansion']
else:
tofe_board_name = None

SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x4000,
with_uart=True,
**kwargs)

clk_freq = 50*1000000
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

# Basic peripherals
self.submodules.info = info.Info(platform, self.__class__.__name__)

# sdram
sdram_module = MT41J128M16(self.clk_freq, "1:4")
self.submodules.ddrphy = s6ddrphy.S6QuarterRateDDRPHY(
Expand Down
21 changes: 12 additions & 9 deletions targets/mimasv2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,20 @@ class BaseSoC(SoCSDRAM):
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=None
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000

cpu_reset_address = self.mem_map["spiflash"]+platform.gateware_size
kwargs['cpu_reset_address']=self.mem_map["spiflash"]+platform.gateware_size
if os.environ.get('JIMMO', '0') == '0':
kwargs['uart_baudrate']=19200
else:
kwargs['uart_baudrate']=115200

clk_freq = (83 + Fraction(1, 3))*1000*1000
SoCSDRAM.__init__(self, platform, clk_freq,
#integrated_rom_size=0x8000,
integrated_rom_size=None,
integrated_sram_size=0x4000,
uart_baudrate=(19200, 115200)[int(os.environ.get('JIMMO', '0'))],
cpu_reset_address=cpu_reset_address,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

Expand All @@ -219,7 +222,7 @@ def __init__(self, platform, **kwargs):

bios_size = 0x8000
self.add_constant("ROM_DISABLE", 1)
self.add_memory_region("rom", cpu_reset_address, bios_size)
self.add_memory_region("rom", kwargs['cpu_reset_address'], bios_size)
self.flash_boot_address = self.mem_map["spiflash"]+platform.gateware_size+bios_size

# sdram
Expand Down
17 changes: 11 additions & 6 deletions targets/minispartan6/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,27 @@ class BaseSoC(SoCSDRAM):
csr_map_update(SoCSDRAM.csr_map, csr_peripherals)

mem_map = {
"spiflash": 0x20000000, # (default shadow @0xa0000000)
"spiflash": 0x20000000, # (default shadow @0xa0000000)
}
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000

clk_freq = 80*1000000
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

self.submodules.cas = cas.ControlAndStatus(platform, clk_freq)
# Basic peripherals


self.submodules.info = info.Info(platform, self.__class__.__name__)
self.submodules.cas = cas.ControlAndStatus(platform, clk_freq)


self.submodules.spiflash = spi_flash.SpiFlash(
Expand Down
10 changes: 6 additions & 4 deletions targets/neso/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ class BaseSoC(SoCSDRAM):
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, spiflash="spiflash_1x", **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
10 changes: 6 additions & 4 deletions targets/netv2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ class BaseSoC(SoCSDRAM):
csr_map_update(SoCSDRAM.csr_map, csr_peripherals)

def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
11 changes: 6 additions & 5 deletions targets/nexys_video/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,13 @@ class BaseSoC(SoCSDRAM):
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, spiflash="spiflash_1x", **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x8000

clk_freq = int(100e6)
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x8000,
with_uart=False,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, with_uart=False, **kwargs)

self.submodules.crg = _CRG(platform)
self.crg.cd_sys.clk.attr.add("keep")
Expand Down
4 changes: 4 additions & 0 deletions targets/nexys_video/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class NetSoC(BaseSoC):
mem_map.update(BaseSoC.mem_map)

def __init__(self, platform, *args, **kwargs):
# Need a larger integrated ROM on or1k to fit the BIOS with TFTP support.
if 'integrated_rom_size' not in kwargs and kwargs.get('cpu_type', 'lm32') == 'or1k':
kwargs['integrated_rom_size'] = 0x10000

BaseSoC.__init__(self, platform, *args, **kwargs)

self.submodules.ethphy = LiteEthPHYRGMII(
Expand Down
12 changes: 7 additions & 5 deletions targets/opsis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ class BaseSoC(SoCSDRAM):
mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000

clk_freq = 50*1000000

if 'expansion' in kwargs:
Expand All @@ -242,11 +247,8 @@ def __init__(self, platform, **kwargs):
else:
tofe_board_name = None

SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x4000,
with_uart=False,
**kwargs)
SoCSDRAM.__init__(self, platform, clk_freq, with_uart=False, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

Expand Down
4 changes: 4 additions & 0 deletions targets/opsis/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class NetSoC(BaseSoC):
mem_map.update(BaseSoC.mem_map)

def __init__(self, platform, *args, **kwargs):
# Need a larger integrated ROM on or1k to fit the BIOS with TFTP support.
if 'integrated_rom_size' not in kwargs and kwargs.get('cpu_type', 'lm32') == 'or1k':
kwargs['integrated_rom_size'] = 0x10000

BaseSoC.__init__(self, platform, *args, **kwargs)

self.submodules.ethphy = LiteEthPHYRGMII(
Expand Down
12 changes: 8 additions & 4 deletions targets/pipistrello/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,15 @@ class BaseSoC(SoCSDRAM):


def __init__(self, platform, **kwargs):
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000

clk_freq = (83 + Fraction(1, 3))*1000*1000
SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size=0x8000,
integrated_sram_size=0x4000,
**kwargs)

SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

self.submodules.crg = _CRG(platform, clk_freq)
self.platform.add_period_constraint(self.crg.cd_sys.clk, 1e9/clk_freq)

Expand Down
21 changes: 15 additions & 6 deletions targets/saturn/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,23 @@ class BaseSoC(SoCSDRAM):
)
csr_map_update(SoCSDRAM.csr_map, csr_peripherals)

# FIXME: Add spiflash
#mem_map = {
# "spiflash": 0x20000000, # (default shadow @0xa0000000)
#}
#mem_map.update(SoCSDRAM.mem_map)

def __init__(self, platform, **kwargs):
clk_freq=(31 + Fraction(1, 4))*1000*1000
if 'integrated_rom_size' not in kwargs:
kwargs['integrated_rom_size']=0x8000
if 'integrated_sram_size' not in kwargs:
kwargs['integrated_sram_size']=0x4000


clk_freq = (31 + Fraction(1, 4))*1000*1000

SoCSDRAM.__init__(self, platform, clk_freq, **kwargs)

SoCSDRAM.__init__(self, platform, clk_freq,
integrated_rom_size = 0x8000,
integrated_sram_size = 0x4000,
**kwargs
)
self.submodules.crg = _CRG(platform, clk_freq)

# sdram
Expand Down

0 comments on commit 2b3ff04

Please sign in to comment.