Skip to content

Commit

Permalink
Merge pull request enjoy-digital#320 from antmicro/msieron/sdram-spd
Browse files Browse the repository at this point in the history
init: Define `SDRAM_PHY_[DDR3|DDR4|...]` and `SDRAM_PHY_SUPPORTED_MEMORY`
  • Loading branch information
enjoy-digital authored Jan 10, 2023
2 parents 8339f54 + 8fa3253 commit d17b021
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion litedram/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ def block(self, head=None, newline=True):
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>")
Expand Down Expand Up @@ -937,10 +937,17 @@ def get_sdram_phy_c_header(phy_settings, timing_settings):
if phy_settings.bitslips > 0:
r.define("SDRAM_PHY_BITSLIPS", phy_settings.bitslips)

r.define(f"SDRAM_PHY_{phy_settings.memtype}")
if phy_settings.is_rdimm:
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);"
Expand Down

0 comments on commit d17b021

Please sign in to comment.