litedram_gen: Expose ControllerSettings to user (and make cmd_buffer_length optional).

This commit is contained in:
Florent Kermarrec 2021-10-06 14:30:50 +02:00
parent ce72e5b3fe
commit f3d01ce98c
1 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,7 @@ import math
import struct import struct
import yaml import yaml
import argparse import argparse
import inspect
from migen import * from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer from migen.genlib.resetsync import AsyncResetSynchronizer
@ -602,7 +603,11 @@ class LiteDRAMCore(SoCCore):
raise NotImplementedError raise NotImplementedError
# Controller Settings. # Controller Settings.
controller_settings = controller_settings = ControllerSettings(cmd_buffer_depth=core_config["cmd_buffer_depth"]) controller_kwargs = {}
for name in inspect.getfullargspec(ControllerSettings. __init__).args:
if core_config.get(name, None) is not None:
controller_kwargs[name] = core_config[name]
controller_settings = controller_settings = ControllerSettings(**controller_kwargs)
# Add LiteDRAM Core to SoC. # Add LiteDRAM Core to SoC.
self.add_sdram("sdram", self.add_sdram("sdram",