init: define SDRAM_PHY_SUPPORTED_MEMORY

To use as a default value when one can't read SDRAM size from the SPD.

Signed-off-by: Michal Sieron <msieron@antmicro.com>
This commit is contained in:
Michal Sieron 2023-01-09 16:03:09 +01:00
parent 4c9f184566
commit 8fa325310a
1 changed files with 7 additions and 1 deletions

View File

@ -875,7 +875,7 @@ class CGenerator(list):
self.append("}")
def get_sdram_phy_c_header(phy_settings, timing_settings):
def get_sdram_phy_c_header(phy_settings, timing_settings, geom_settings):
r = CGenerator()
r.header_guard("__GENERATED_SDRAM_PHY_H")
r.include("<hw/common.h>")
@ -942,6 +942,12 @@ def get_sdram_phy_c_header(phy_settings, timing_settings):
assert phy_settings.memtype == "DDR4"
r.define("SDRAM_PHY_DDR4_RDIMM")
# litedram doesn't support multiple ranks
supported_memory = 2 ** (geom_settings.bankbits +
geom_settings.rowbits +
geom_settings.colbits) * phy_settings.databits // 8
r.define("SDRAM_PHY_SUPPORTED_MEMORY", f"0x{supported_memory:016x}ULL")
r.newline()
r += "void cdelay(int i);"