LiteXはSoCを半自動的に生成するための総合環境で、自作CPUのSoC生成環境もLiteXを使用している。
まずはオリジナルのmake.py
を改造してやってみようと思う。ロードするCPUを変更する。
diff --git a/make.py b/make.py index f1a72956..3a939171 100644 --- a/make.py +++ b/make.py @@ -11,7 +11,7 @@ import sys import argparse from litex.soc.integration.builder import Builder -from litex.soc.cores.cpu.vexriscv_smp import VexRiscvSMP +from litex.soc.cores.cpu.scariv import ScariV from soc_linux import SoCLinux @@ -797,7 +797,7 @@ def main(): parser.add_argument("--spi-data-width", default=8, type=int, help="SPI data width (max bits per xfer).") parser.add_argument("--spi-clk-freq", default=1e6, type=int, help="SPI clock frequency.") parser.add_argument("--fdtoverlays", default="", help="Device Tree Overlays to apply.") - VexRiscvSMP.args_fill(parser) + ScariV.args_fill(parser) args = parser.parse_args() # Board(s) selection --------------------------------------------------------------------------- @@ -826,7 +826,7 @@ def main(): if "usb_host" in board.soc_capabilities: args.with_coherent_dma = True - VexRiscvSMP.args_read(args) + ScariV.args_read(args) # SoC parameters --------------------------------------------------------------------------- if args.device is not None:
こうすると以下のエラーが出てしまうので、Pythonのサポート実装自体を変えないといけないらしいな。 VexRiscvの実装を見ると、引数でカスタマイズができる機能のようなので、これは無視しても良い気がする。
./make.py
AttributeError: type object 'ScariV' has no attribute 'args_fill'
litex/soc/cores/cpu/vexriscv_smp/core.py
# Command line configuration arguments. @staticmethod def args_fill(parser): cpu_group = parser.add_argument_group(title="CPU options") cpu_group.add_argument("--cpu-count", default=1, help="Number of CPU(s) in the cluster.", type=int) cpu_group.add_argument("--with-coherent-dma", action="store_true", help="Enable Coherent DMA Slave interface.") cpu_group.add_argument("--without-coherent-dma", action="store_true", help="Disable Coherent DMA Slave interface.") cpu_group.add_argument("--dcache-width", default=None, help="L1 data cache bus width.") cpu_group.add_argument("--icache-width", default=None, help="L1 instruction cache bus width.") cpu_group.add_argument("--dcache-size", default=None, help="L1 data cache size in byte per CPU.") cpu_group.add_argument("--dcache-ways", default=None, help="L1 data cache ways per CPU.") cpu_group.add_argument("--icache-size", default=None, help="L1 instruction cache size in byte per CPU.") cpu_group.add_argument("--icache-ways", default=None, help="L1 instruction cache ways per CPU") cpu_group.add_argument("--aes-instruction", default=None, help="Enable AES instruction acceleration.") cpu_group.add_argument("--without-out-of-order-decoder", action="store_true", help="Reduce area at cost of peripheral access speed") cpu_group.add_argument("--with-wishbone-memory", action="store_true", help="Disable native LiteDRAM interface") cpu_group.add_argument("--wishbone-force-32b", action="store_true", help="Force the wishbone bus to be 32 bits") cpu_group.add_argument("--with-fpu", action="store_true", help="Enable the F32/F64 FPU") cpu_group.add_argument("--cpu-per-fpu", default="4", help="Maximal ratio between CPU count and FPU count. Will instanciate as many FPU as necessary.") cpu_group.add_argument("--with-rvc", action="store_true", help="Enable RISC-V compressed instruction support") cpu_group.add_argument("--dtlb-size", default=4, help="Data TLB size.") cpu_group.add_argument("--itlb-size", default=4, help="Instruction TLB size.")
いくつか修正すると、ここでエラーとなる。これは文法的に間違っている気がするんだけどいいんだろうか? そしてオリジナルの実装ではここを通っていないということか。
INFO:SoC:-------------------------------------------------------------------------------- Traceback (most recent call last): File "/home/msyksphinz/work/litex/litex_scariv/./make.py", line 945, in <module> main() File "/home/msyksphinz/work/litex/litex_scariv/./make.py", line 918, in main builder.build(run=args.build, build_name=board_name) File "/home/msyksphinz/work/litex/litex_scariv/litex/soc/integration/builder.py", line 334, in build self._generate_includes(with_bios=with_bios) File "/home/msyksphinz/work/litex/litex_scariv/litex/soc/integration/builder.py", line 226, in _generate_includes sdram_contents = get_sdram_phy_c_header( TypeError: get_sdram_phy_c_header() missing 1 required positional argument: 'geom_settings'