Skip to content

Commit

Permalink
Merge pull request #1874 from trabucayre/naxriscv_arch
Browse files Browse the repository at this point in the history
soc/cores/cpu/naxriscv fix arch definition and small adjust
  • Loading branch information
enjoy-digital authored Jan 19, 2024
2 parents b19d992 + 854541d commit 4c07d72
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion litex/soc/cores/cpu/naxriscv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def get_abi():
# Arch.
@staticmethod
def get_arch():
arch = f"rv{NaxRiscv.xlen}ima"
arch = f"rv{NaxRiscv.xlen}i2p0_ma"
if NaxRiscv.with_fpu:
arch += "fd"
if NaxRiscv.with_rvc:
Expand Down Expand Up @@ -115,6 +115,7 @@ def args_fill(parser):
cpu_group.add_argument("--update-repo", default="recommended", choices=["latest","wipe+latest","recommended","wipe+recommended","no"], help="Specify how the NaxRiscv & SpinalHDL repo should be updated (latest: update to HEAD, recommended: Update to known compatible version, no: Don't update, wipe+*: Do clean&reset before checkout)")
cpu_group.add_argument("--no-netlist-cache", action="store_true", help="Always (re-)build the netlist.")
cpu_group.add_argument("--with-fpu", action="store_true", help="Enable the F32/F64 FPU.")
cpu_group.add_argument("--with-rvc", action="store_true", help="Enable the Compress ISA extension.")
cpu_group.add_argument("--l2-bytes", default=128*1024, help="NaxRiscv L2 bytes, default 128 KB.")
cpu_group.add_argument("--l2-ways", default=8, help="NaxRiscv L2 ways, default 8.")

Expand All @@ -127,6 +128,7 @@ def args_read(args):
NaxRiscv.update_repo = args.update_repo
NaxRiscv.no_netlist_cache = args.no_netlist_cache
NaxRiscv.with_fpu = args.with_fpu
NaxRiscv.with_rvc = args.with_rvc
if args.scala_file:
NaxRiscv.scala_files = args.scala_file
if args.scala_args:
Expand Down Expand Up @@ -302,10 +304,12 @@ def git_setup(name, dir, repo, branch, hash):
), shell=True)
# Use specific SHA1 (Optional).
print(f"Updating {name} Git repository...")
cwd = os.getcwd()
os.chdir(os.path.join(dir))
wipe_cmd = "&& git clean --force -d -x && git reset --hard" if "wipe" in NaxRiscv.update_repo else ""
checkout_cmd = f"&& git checkout {hash}" if hash is not None else ""
subprocess.check_call(f"cd {dir} {wipe_cmd} && git checkout {branch} && git submodule init && git pull --recurse-submodules {checkout_cmd}", shell=True)
os.chdir(cwd)

# Netlist Generation.
@staticmethod
Expand Down Expand Up @@ -342,6 +346,8 @@ def generate_netlist(reset_address):
gen_args.append(f"--scala-file={file}")
if(NaxRiscv.with_fpu):
gen_args.append(f"--scala-args=rvf=true,rvd=true")
if(NaxRiscv.with_rvc):
gen_args.append(f"--scala-args=rvc=true")

cmd = f"""cd {ndir} && sbt "runMain naxriscv.platform.litex.NaxGen {" ".join(gen_args)}\""""
print("NaxRiscv generation command :")
Expand Down

0 comments on commit 4c07d72

Please sign in to comment.