cpu/vexriscv_smp: cleanup new args integration and fix cluster naming.

This commit is contained in:
Florent Kermarrec 2021-01-25 09:31:16 +01:00
parent 7fa03cb1f3
commit 17195c5e96
1 changed files with 39 additions and 40 deletions

View File

@ -37,33 +37,33 @@ class VexRiscvSMP(CPU):
nop = "nop" nop = "nop"
io_regions = {0x80000000: 0x80000000} # origin, length io_regions = {0x80000000: 0x80000000} # origin, length
cpu_count = 1 cpu_count = 1
dcache_size = 4096 dcache_size = 4096
icache_size = 4096 icache_size = 4096
dcache_ways = 1 dcache_ways = 1
icache_ways = 1 icache_ways = 1
coherent_dma = False coherent_dma = False
litedram_width = 32 litedram_width = 32
dcache_width = 32 dcache_width = 32
icache_width = 32 icache_width = 32
aes_instruction = False aes_instruction = False
out_of_order_decoder = True out_of_order_decoder = True
wishbone_memory = False wishbone_memory = False
@staticmethod @staticmethod
def args_fill(parser): def args_fill(parser):
parser.add_argument("--cpu-count", default=1, help="Number of CPU(s) in the cluster.", type=int) parser.add_argument("--cpu-count", default=1, help="Number of CPU(s) in the cluster.", type=int)
parser.add_argument("--with-coherent-dma", action='store_true', help="Enable Coherent DMA Slave interface.") parser.add_argument("--with-coherent-dma", action="store_true", help="Enable Coherent DMA Slave interface.")
parser.add_argument("--without-coherent-dma", action='store_true', help="Disable Coherent DMA Slave interface.") parser.add_argument("--without-coherent-dma", action="store_true", help="Disable Coherent DMA Slave interface.")
parser.add_argument("--dcache-width", default=None, help="L1 data cache bus width.") parser.add_argument("--dcache-width", default=None, help="L1 data cache bus width.")
parser.add_argument("--icache-width", default=None, help="L1 instruction cache bus width.") parser.add_argument("--icache-width", default=None, help="L1 instruction cache bus width.")
parser.add_argument("--dcache-size", default=None, help="L1 data cache size in byte per CPU.") parser.add_argument("--dcache-size", default=None, help="L1 data cache size in byte per CPU.")
parser.add_argument("--dcache-ways", default=None, help="L1 data cache ways per CPU.") parser.add_argument("--dcache-ways", default=None, help="L1 data cache ways per CPU.")
parser.add_argument("--icache-size", default=None, help="L1 instruction cache size in byte per CPU.") parser.add_argument("--icache-size", default=None, help="L1 instruction cache size in byte per CPU.")
parser.add_argument("--icache-ways", default=None, help="L1 instruction cache ways per CPU") parser.add_argument("--icache-ways", default=None, help="L1 instruction cache ways per CPU")
parser.add_argument("--aes-instruction", default=None, help="Enable AES instruction acceleration.") parser.add_argument("--aes-instruction", default=None, help="Enable AES instruction acceleration.")
parser.add_argument("--without-out-of-order-decoder", action='store_true', help="Reduce area at cost of peripheral access speed") parser.add_argument("--without-out-of-order-decoder", action="store_true", help="Reduce area at cost of peripheral access speed")
parser.add_argument("--with-wishbone-memory" , action='store_true', help="Disable native litedram interface") parser.add_argument("--with-wishbone-memory" , action="store_true", help="Disable native LiteDRAM interface")
@staticmethod @staticmethod
def args_read(args): def args_read(args):
@ -76,17 +76,17 @@ class VexRiscvSMP(CPU):
VexRiscvSMP.dcache_ways = 2 VexRiscvSMP.dcache_ways = 2
VexRiscvSMP.icache_ways = 2 VexRiscvSMP.icache_ways = 2
VexRiscvSMP.coherent_dma = True VexRiscvSMP.coherent_dma = True
if(args.with_coherent_dma): VexRiscvSMP.coherent_dma = bool(True) if(args.with_coherent_dma): VexRiscvSMP.coherent_dma = bool(True)
if(args.without_coherent_dma): VexRiscvSMP.coherent_dma = bool(False) if(args.without_coherent_dma): VexRiscvSMP.coherent_dma = bool(False)
if(args.dcache_width): VexRiscvSMP.dcache_width = int(args.dcache_width) if(args.dcache_width): VexRiscvSMP.dcache_width = int(args.dcache_width)
if(args.icache_width): VexRiscvSMP.icache_width = int(args.icache_width) if(args.icache_width): VexRiscvSMP.icache_width = int(args.icache_width)
if(args.dcache_size): VexRiscvSMP.dcache_size = int(args.dcache_size) if(args.dcache_size): VexRiscvSMP.dcache_size = int(args.dcache_size)
if(args.icache_size): VexRiscvSMP.icache_size = int(args.icache_size) if(args.icache_size): VexRiscvSMP.icache_size = int(args.icache_size)
if(args.dcache_ways): VexRiscvSMP.dcache_ways = int(args.dcache_ways) if(args.dcache_ways): VexRiscvSMP.dcache_ways = int(args.dcache_ways)
if(args.icache_ways): VexRiscvSMP.icache_ways = int(args.icache_ways) if(args.icache_ways): VexRiscvSMP.icache_ways = int(args.icache_ways)
if(args.aes_instruction): VexRiscvSMP.aes_instruction = bool(args.aes_instruction) if(args.aes_instruction): VexRiscvSMP.aes_instruction = bool(args.aes_instruction)
if(args.without_out_of_order_decoder): VexRiscvSMP.out_of_order_decoder = False if(args.without_out_of_order_decoder): VexRiscvSMP.out_of_order_decoder = False
if(args.with_wishbone_memory): VexRiscvSMP.wishbone_memory = True if(args.with_wishbone_memory): VexRiscvSMP.wishbone_memory = True
@property @property
@ -120,12 +120,11 @@ class VexRiscvSMP(CPU):
f"Dw{VexRiscvSMP.dcache_width}" \ f"Dw{VexRiscvSMP.dcache_width}" \
f"Ds{VexRiscvSMP.dcache_size}" \ f"Ds{VexRiscvSMP.dcache_size}" \
f"Dy{VexRiscvSMP.dcache_ways}" \ f"Dy{VexRiscvSMP.dcache_ways}" \
"_" \ f"{'_'+ldw if not VexRiscvSMP.wishbone_memory else ''}" \
f"{ldw if not VexRiscvSMP.wishbone_memory else ''}" \ f"{'_Cdma' if VexRiscvSMP.coherent_dma else ''}" \
f"{'_Cdma' if VexRiscvSMP.coherent_dma else ''}" \ f"{'_Aes' if VexRiscvSMP.aes_instruction else ''}" \
f"{'_Aes' if VexRiscvSMP.aes_instruction else ''}"\ f"{'_Ood' if VexRiscvSMP.out_of_order_decoder else ''}" \
f"{'_Ood' if VexRiscvSMP.out_of_order_decoder else ''}"\ f"{'_Wm' if VexRiscvSMP.wishbone_memory else ''}"
f"{'_Wm' if VexRiscvSMP.wishbone_memory else ''}"
@staticmethod @staticmethod
def generate_default_configs(): def generate_default_configs():
@ -205,7 +204,7 @@ class VexRiscvSMP(CPU):
gen_args.append(f"--wishbone-memory={VexRiscvSMP.wishbone_memory}") gen_args.append(f"--wishbone-memory={VexRiscvSMP.wishbone_memory}")
gen_args.append(f"--netlist-name={VexRiscvSMP.cluster_name}") gen_args.append(f"--netlist-name={VexRiscvSMP.cluster_name}")
gen_args.append(f"--netlist-directory={vdir}") gen_args.append(f"--netlist-directory={vdir}")
cmd = 'cd {path} && sbt "runMain vexriscv.demo.smp.VexRiscvLitexSmpClusterCmdGen {args}"'.format(path=os.path.join(vdir, "ext", "VexRiscv"), args=" ".join(gen_args)) cmd = 'cd {path} && sbt "runMain vexriscv.demo.smp.VexRiscvLitexSmpClusterCmdGen {args}"'.format(path=os.path.join(vdir, "ext", "VexRiscv"), args=" ".join(gen_args))
os.system(cmd) os.system(cmd)