Merge pull request #782 from enjoy-digital/vexriscv-smp-no-litedram

soc/cpu/vexriscv-smp: add args to disable out of order or direct path to LiteDRAM
This commit is contained in:
enjoy-digital 2021-01-25 08:45:03 +01:00 committed by GitHub
commit 7fa03cb1f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 34 deletions

View File

@ -47,6 +47,8 @@ class VexRiscvSMP(CPU):
dcache_width = 32 dcache_width = 32
icache_width = 32 icache_width = 32
aes_instruction = False aes_instruction = False
out_of_order_decoder = True
wishbone_memory = False
@staticmethod @staticmethod
def args_fill(parser): def args_fill(parser):
@ -60,7 +62,8 @@ class VexRiscvSMP(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("--with-wishbone-memory" , action='store_true', help="Disable native litedram interface")
@staticmethod @staticmethod
def args_read(args): def args_read(args):
@ -82,6 +85,9 @@ class VexRiscvSMP(CPU):
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.with_wishbone_memory): VexRiscvSMP.wishbone_memory = True
@property @property
def mem_map(self): def mem_map(self):
@ -103,6 +109,7 @@ class VexRiscvSMP(CPU):
@staticmethod @staticmethod
def generate_cluster_name(): def generate_cluster_name():
ldw = f"Ldw{VexRiscvSMP.litedram_width}"
VexRiscvSMP.cluster_name = f"VexRiscvLitexSmpCluster_" \ VexRiscvSMP.cluster_name = f"VexRiscvLitexSmpCluster_" \
f"Cc{VexRiscvSMP.cpu_count}" \ f"Cc{VexRiscvSMP.cpu_count}" \
"_" \ "_" \
@ -114,9 +121,11 @@ class VexRiscvSMP(CPU):
f"Ds{VexRiscvSMP.dcache_size}" \ f"Ds{VexRiscvSMP.dcache_size}" \
f"Dy{VexRiscvSMP.dcache_ways}" \ f"Dy{VexRiscvSMP.dcache_ways}" \
"_" \ "_" \
f"Ldw{VexRiscvSMP.litedram_width}" \ 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"{'_Wm' if VexRiscvSMP.wishbone_memory else ''}"
@staticmethod @staticmethod
def generate_default_configs(): def generate_default_configs():
@ -192,9 +201,11 @@ class VexRiscvSMP(CPU):
gen_args.append(f"--icache-ways={VexRiscvSMP.icache_ways}") gen_args.append(f"--icache-ways={VexRiscvSMP.icache_ways}")
gen_args.append(f"--litedram-width={VexRiscvSMP.litedram_width}") gen_args.append(f"--litedram-width={VexRiscvSMP.litedram_width}")
gen_args.append(f"--aes-instruction={VexRiscvSMP.aes_instruction}") gen_args.append(f"--aes-instruction={VexRiscvSMP.aes_instruction}")
gen_args.append(f"--out-of-order-decoder={VexRiscvSMP.out_of_order_decoder}")
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)
@ -324,37 +335,38 @@ class VexRiscvSMP(CPU):
VexRiscvSMP.generate_cluster_name() VexRiscvSMP.generate_cluster_name()
from litedram.common import LiteDRAMNativePort from litedram.common import LiteDRAMNativePort
ibus = LiteDRAMNativePort(mode="both", address_width=32, data_width=VexRiscvSMP.litedram_width) if(not VexRiscvSMP.wishbone_memory):
dbus = LiteDRAMNativePort(mode="both", address_width=32, data_width=VexRiscvSMP.litedram_width) ibus = LiteDRAMNativePort(mode="both", address_width=32, data_width=VexRiscvSMP.litedram_width)
self.memory_buses.append(ibus) dbus = LiteDRAMNativePort(mode="both", address_width=32, data_width=VexRiscvSMP.litedram_width)
self.memory_buses.append(dbus) self.memory_buses.append(ibus)
self.cpu_params.update( self.memory_buses.append(dbus)
# Instruction Memory Bus (Master) self.cpu_params.update(
o_iBridge_dram_cmd_valid = ibus.cmd.valid, # Instruction Memory Bus (Master)
i_iBridge_dram_cmd_ready = ibus.cmd.ready, o_iBridge_dram_cmd_valid = ibus.cmd.valid,
o_iBridge_dram_cmd_payload_we = ibus.cmd.we, i_iBridge_dram_cmd_ready = ibus.cmd.ready,
o_iBridge_dram_cmd_payload_addr = ibus.cmd.addr, o_iBridge_dram_cmd_payload_we = ibus.cmd.we,
o_iBridge_dram_wdata_valid = ibus.wdata.valid, o_iBridge_dram_cmd_payload_addr = ibus.cmd.addr,
i_iBridge_dram_wdata_ready = ibus.wdata.ready, o_iBridge_dram_wdata_valid = ibus.wdata.valid,
o_iBridge_dram_wdata_payload_data = ibus.wdata.data, i_iBridge_dram_wdata_ready = ibus.wdata.ready,
o_iBridge_dram_wdata_payload_we = ibus.wdata.we, o_iBridge_dram_wdata_payload_data = ibus.wdata.data,
i_iBridge_dram_rdata_valid = ibus.rdata.valid, o_iBridge_dram_wdata_payload_we = ibus.wdata.we,
o_iBridge_dram_rdata_ready = ibus.rdata.ready, i_iBridge_dram_rdata_valid = ibus.rdata.valid,
i_iBridge_dram_rdata_payload_data = ibus.rdata.data, o_iBridge_dram_rdata_ready = ibus.rdata.ready,
i_iBridge_dram_rdata_payload_data = ibus.rdata.data,
# Data Memory Bus (Master) # Data Memory Bus (Master)
o_dBridge_dram_cmd_valid = dbus.cmd.valid, o_dBridge_dram_cmd_valid = dbus.cmd.valid,
i_dBridge_dram_cmd_ready = dbus.cmd.ready, i_dBridge_dram_cmd_ready = dbus.cmd.ready,
o_dBridge_dram_cmd_payload_we = dbus.cmd.we, o_dBridge_dram_cmd_payload_we = dbus.cmd.we,
o_dBridge_dram_cmd_payload_addr = dbus.cmd.addr, o_dBridge_dram_cmd_payload_addr = dbus.cmd.addr,
o_dBridge_dram_wdata_valid = dbus.wdata.valid, o_dBridge_dram_wdata_valid = dbus.wdata.valid,
i_dBridge_dram_wdata_ready = dbus.wdata.ready, i_dBridge_dram_wdata_ready = dbus.wdata.ready,
o_dBridge_dram_wdata_payload_data = dbus.wdata.data, o_dBridge_dram_wdata_payload_data = dbus.wdata.data,
o_dBridge_dram_wdata_payload_we = dbus.wdata.we, o_dBridge_dram_wdata_payload_we = dbus.wdata.we,
i_dBridge_dram_rdata_valid = dbus.rdata.valid, i_dBridge_dram_rdata_valid = dbus.rdata.valid,
o_dBridge_dram_rdata_ready = dbus.rdata.ready, o_dBridge_dram_rdata_ready = dbus.rdata.ready,
i_dBridge_dram_rdata_payload_data = dbus.rdata.data, i_dBridge_dram_rdata_payload_data = dbus.rdata.data,
) )
def do_finalize(self): def do_finalize(self):
assert hasattr(self, "reset_address") assert hasattr(self, "reset_address")
@ -362,3 +374,4 @@ class VexRiscvSMP(CPU):
# Add verilog sources # Add verilog sources
self.add_sources(self.platform) self.add_sources(self.platform)