Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soc/cores/cpu/naxriscv fix arch definition and small adjust #1874

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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