tools/litex_sim: update copyrights and cosmetic changes

This commit is contained in:
Florent Kermarrec 2020-01-24 13:58:49 +01:00
parent b280bb2ff2
commit 52765488b5

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
# This file is Copyright (c) 2015-2020 Florent Kermarrec <florent@enjoy-digital.fr>
# This file is Copyright (c) 2020 Piotr Binkowski <pbinkowski@antmicro.com>
# This file is Copyright (c) 2017 Pierre-Olivier Vauboin <po@lambdaconcept>
# License: BSD
@ -75,8 +76,8 @@ sdram_module_nphases = {
def get_sdram_phy_settings(memtype, data_width, clk_freq):
nphases = sdram_module_nphases[memtype]
# Default litex_sim settings
if memtype == "SDR":
# Settings from gensdrphy
rdphase = 0
wrphase = 0
rdcmdphase = 0
@ -85,8 +86,8 @@ def get_sdram_phy_settings(memtype, data_width, clk_freq):
cwl = None
read_latency = 4
write_latency = 0
# Settings taken from s6ddrphy
elif memtype in ["DDR", "LPDDR"]:
# Settings from s6ddrphy
rdphase = 0
wrphase = 1
rdcmdphase = 1
@ -95,8 +96,8 @@ def get_sdram_phy_settings(memtype, data_width, clk_freq):
cwl = None
read_latency = 5
write_latency = 0
# Settings taken from s7ddrphy
elif memtype in ["DDR2", "DDR3"]:
# Settings from s7ddrphy
tck = 2/(2*nphases*clk_freq)
cmd_latency = 0
cl, cwl = get_cl_cw(memtype, tck)
@ -168,7 +169,10 @@ class SimSoC(SoCSDRAM):
sdram_module_cls = getattr(litedram_modules, sdram_module)
sdram_rate = "1:{}".format(sdram_module_nphases[sdram_module_cls.memtype])
sdram_module = sdram_module_cls(sdram_clk_freq, sdram_rate)
phy_settings = get_sdram_phy_settings(sdram_module.memtype, sdram_data_width, sdram_clk_freq)
phy_settings = get_sdram_phy_settings(
memtype = sdram_module.memtype,
data_width = sdram_data_width,
clk_freq = sdram_clk_freq)
self.submodules.sdrphy = SDRAMPHYModel(sdram_module, phy_settings)
self.register_sdram(
self.sdrphy,