litedram/gen: add description and switch to argparse
This commit is contained in:
parent
2bdeda021b
commit
12ddc135be
|
@ -3,11 +3,28 @@
|
||||||
# This file is Copyright (c) 2018-2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
# This file is Copyright (c) 2018-2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
||||||
# License: BSD
|
# License: BSD
|
||||||
|
|
||||||
|
"""
|
||||||
|
LiteDRAM standalone core generator
|
||||||
|
|
||||||
|
LiteDRAM aims to be directly used as a python package when the SoC is created using LiteX. However,
|
||||||
|
for some use cases it could be interesting to generate a standalone verilog file of the core:
|
||||||
|
- integration of the core in a SoC using a more traditional flow.
|
||||||
|
- need to version/package the core.
|
||||||
|
- avoid Migen/LiteX dependencies.
|
||||||
|
- etc...
|
||||||
|
|
||||||
|
The standalone core is generated from a YAML configuration file that allows the user to generate
|
||||||
|
easily a custom configuration of the core.
|
||||||
|
|
||||||
|
Current version of the generator is limited to Xilinx 7-Series FPGA for DDR2/DDR3 memories.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import math
|
import math
|
||||||
import struct
|
import struct
|
||||||
import yaml
|
import yaml
|
||||||
|
import argparse
|
||||||
|
|
||||||
from migen import *
|
from migen import *
|
||||||
from migen.genlib.resetsync import AsyncResetSynchronizer
|
from migen.genlib.resetsync import AsyncResetSynchronizer
|
||||||
|
@ -355,11 +372,10 @@ class LiteDRAMCore(SoCSDRAM):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Import YAML config file
|
parser = argparse.ArgumentParser(description="LiteDRAM standalone core generator")
|
||||||
if len(sys.argv) < 2:
|
parser.add_argument("config", help="YAML config file")
|
||||||
print("missing YAML config file")
|
args = parser.parse_args()
|
||||||
exit(1)
|
core_config = yaml.load(open(args.config).read(), Loader=yaml.Loader)
|
||||||
core_config = yaml.load(open(sys.argv[1]).read(), Loader=yaml.Loader)
|
|
||||||
|
|
||||||
# Convert YAML elements to Python/LiteX
|
# Convert YAML elements to Python/LiteX
|
||||||
for k, v in core_config.items():
|
for k, v in core_config.items():
|
||||||
|
|
Loading…
Reference in New Issue