Skip to content

Commit

Permalink
targets: Use KILOBYTE/MEGABYTE constants when possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
enjoy-digital committed Aug 29, 2024
1 parent 5bfde29 commit fd4f9ac
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 27 deletions.
2 changes: 1 addition & 1 deletion litex_boards/targets/alchitry_mojo.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def __init__(self, sys_clk_freq=62.5e6, sdram_rate="1:1",
self.add_sdram("sdram",
phy = self.sdrphy,
module = MT48LC32M8(sys_clk_freq, sdram_rate),
l2_cache_size = kwargs.get("l2_size", 1024)
l2_cache_size = kwargs.get("l2_size", 1 * KILOBYTE)
)

# HDMI Options -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/aliexpress_xc7k70t.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, sys_clk_freq=100e6, sdram_rate="1:1",
self.add_sdram("sdram",
phy = self.sdrphy,
module = W9812G6JB(sys_clk_freq, sdram_rate),
l2_cache_size = kwargs.get("l2_size", 1024)
l2_cache_size = kwargs.get("l2_size", 1 * KILOBYTE)
)

# HDMI Options -----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/alinx_axu2cga.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ def __init__(self, sys_clk_freq=25e6, with_led_chaser=True, **kwargs):

self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 1 * 1024 * 1024 * 1024) # DDR
size = 1 * GIGABYTE) # DDR
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 512 * 1024 * 1024 // 8,
size = 512 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 1199880127
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self, *, sys_clk_freq=100e6, iodelay_clk_freq=200e6,
# HyperRAM ---------------------------------------------------------------------------------
if with_hyperram:
self.hyperram = HyperRAM(platform.request("hyperram"), sys_clk_freq=sys_clk_freq)
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8*1024*1024))
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8 * MEGABYTE))

# SD Card ----------------------------------------------------------------------------------
if with_sdcard:
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/antmicro_lpddr4_test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, *, sys_clk_freq=50e6, iodelay_clk_freq=200e6,
# HyperRAM ---------------------------------------------------------------------------------
if with_hyperram:
self.hyperram = HyperRAM(platform.request("hyperram"), sys_clk_freq=sys_clk_freq)
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8*1024*1024))
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8 * MEGABYTE))

# SD Card ----------------------------------------------------------------------------------
if with_sdcard:
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/digilent_arty_z7.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ def __init__(self, variant="z7-20", toolchain="vivado", sys_clk_freq=125e6,

self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 512 * 1024 * 1024 - self.cpu.mem_map["sram"])
size = 512 * MEGABYTE - self.cpu.mem_map["sram"])
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 256 * 1024 * 1024 // 8,
size = 256 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 666666687
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/digilent_cmod_a7.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(self, variant="a7-35",
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Digilent CmodA7", **kwargs)

# Async RAM --------------------------------------------------------------------------------
addAsyncSram(self,platform,"main_ram", 0x40000000, 512*1024)
addAsyncSram(self,platform,"main_ram", 0x40000000, 512 * KILOBYTE)

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/digilent_nexys4.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, soc, platform):
########################

def addCellularRAM(soc, platform, name, origin):
size = 16*1024*1024
size = 16 * MEGABYTE
ram_bus = wishbone.Interface(data_width=soc.bus.data_width)
ram = CellularRAM(soc,platform)
soc.bus.add_slave(name, ram.bus, SoCRegion(origin=origin, size=size, mode="rw"))
Expand Down
5 changes: 2 additions & 3 deletions litex_boards/targets/digilent_zedboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def __init__(self, platform, sys_clk_freq, use_ps7_clk=False):


class BaseSoC(SoCCore):

def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):
platform = digilent_zedboard.Platform()

Expand All @@ -71,11 +70,11 @@ def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):

self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 512 * 1024 * 1024 - self.cpu.mem_map["sram"])
size = 512 * MEGABYTE - self.cpu.mem_map["sram"])
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 256 * 1024 * 1024 // 8,
size = 256 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 666666687
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/efinix_titanium_ti60_f225_dev_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def __init__(self, sys_clk_freq=200e6,
if with_hyperram:
# HyperRAM Parameters.
hyperram_device = "W958D6NW"
hyperram_size = 32*1024*1024
hyperram_cache_size = 16*1024
hyperram_size = 32 * MEGABYTE
hyperram_cache_size = 16 * KILOBYTE

# HyperRAM Bus/Slave Interface.
hyperram_bus = wishbone.Interface(data_width=32, address_width=32, addressing="word")
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/lattice_crosslink_nx_vip.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, sys_clk_freq=75e6, toolchain="radiant",
size=size))
else:
# Use HyperRAM generic PHY as SRAM -----------------------------------------------------
size = 8*1024 * KILOBYTE
size = 8 * MEGABYTE
hr_pads = platform.request("hyperram", int(hyperram))
self.hyperram = HyperRAM(hr_pads, sys_clk_freq=sys_clk_freq)
self.bus.add_slave("sram", slave=self.hyperram.bus, region=SoCRegion(origin=self.mem_map["sram"],
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/micronova_mercury2.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(self,
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on MicroNova Mercury2", **kwargs)

# Async RAM --------------------------------------------------------------------------------
addAsyncSram(self,platform,"main_ram", 0x40000000, 512*1024)
addAsyncSram(self,platform,"main_ram", 0x40000000, 512 * KILOBYTE)

# Leds -------------------------------------------------------------------------------------
if with_led_chaser:
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/quicklogic_quickfeather.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, sys_clk_freq=10e6, with_led_chaser=True, with_gpio_in=True, *
)
self.bus.add_region("rom", SoCRegion(
origin = self.mem_map["rom"],
size = 4 * 128 * 1024,
size = 4 * 128 * KILOBYTE,
linker = True)
)

Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/qwertyembedded_beaglewire.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, bios_flash_offset, sys_clk_freq=50e6, **kwargs):
self.add_sdram("sdram",
phy = self.sdrphy,
module = MT48LC32M8(sys_clk_freq, "1:1"),
l2_cache_size = kwargs.get("l2_size", 1024)
l2_cache_size = kwargs.get("l2_size", 1 * KILOBYTE)
)

# SPI Flash --------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/trenz_c10lprefkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, sys_clk_freq=50e6,

# HyperRam ---------------------------------------------------------------------------------
self.hyperram = HyperRAM(platform.request("hyperram"), sys_clk_freq=sys_clk_freq)
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8*1024*1024))
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=8 * MEGABYTE))

# SDR SDRAM --------------------------------------------------------------------------------
if not self.integrated_main_ram_size:
Expand Down
2 changes: 1 addition & 1 deletion litex_boards/targets/trenz_te0725.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on Trenz TE0725 Board", **kwargs)

# Use HyperRAM generic PHY as SRAM ---------------------------------------------------------
size = int((64*1024*1024) / 8)
size = int((64 * MEGABYTE) / 8)
hr_pads = platform.request("hyperram", 0)
self.hyperram = HyperRAM(hr_pads, sys_clk_freq=sys_clk_freq)
self.bus.add_slave("hyperram", slave=self.hyperram.bus, region=SoCRegion(origin=0x20000000, size=size))
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/xilinx_kv260.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ def __init__(self, sys_clk_freq=100e6, **kwargs):

self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 2 * 1024 * 1024 * 1024) # DDR
size = 2 * GIGABYTE) # DDR
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 512 * 1024 * 1024 // 8,
size = 512 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 1333333008
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/xilinx_zcu216.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def __init__(self, sys_clk_freq=100e6, with_led_chaser=True, **kwargs):

self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 2 * 1024 * 1024 * 1024) # DDR
size = 2 * GIGABYTE) # DDR
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 512 * 1024 * 1024 // 8,
size = 512 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 1200000000
Expand Down
4 changes: 2 additions & 2 deletions litex_boards/targets/xilinx_zybo_z7.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def __init__(self, sys_clk_freq=100e6, variant="z7-10", with_ps7=False, with_led
#TODO memory size dependend on board variant
self.bus.add_region("sram", SoCRegion(
origin = self.cpu.mem_map["sram"],
size = 512 * 1024 * 1024 - self.cpu.mem_map["sram"])
size = 512 * MEGABYTE - self.cpu.mem_map["sram"])
)
self.bus.add_region("rom", SoCRegion(
origin = self.cpu.mem_map["rom"],
size = 256 * 1024 * 1024 // 8,
size = 256 * MEGABYTE // 8,
linker = True)
)
self.constants["CONFIG_CLOCK_FREQUENCY"] = 666666687
Expand Down

0 comments on commit fd4f9ac

Please sign in to comment.