-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2853501
commit fca53e6
Showing
6 changed files
with
2,534 additions
and
2,286 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Usage: | ||
python3 update-vexriscv.py <commit_hash> | ||
""" | ||
# SPDX-FileCopyrightText: 2022 Google LLC | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import glob | ||
import os | ||
import shutil | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
LICENSE = """ | ||
SPDX-FileCopyrightText: 2016 Spinal HDL contributors | ||
SPDX-License-Identifier: MIT | ||
""".lstrip() | ||
|
||
VEXRISCV_REPO = "https://github.com/SpinalHDL/VexRiscv.git" | ||
|
||
HERE = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
def main(commit_hash): | ||
# Remove old JAR in current directory | ||
for file in os.listdir(HERE): | ||
if file.endswith((".jar", ".jar.license")): | ||
os.remove(os.path.join(HERE, file)) | ||
|
||
with tempfile.TemporaryDirectory() as temp_dir: | ||
# Build new JAR | ||
subprocess.check_call(["git", "clone", VEXRISCV_REPO, temp_dir]) | ||
subprocess.check_call(["git", "checkout", commit_hash], cwd=temp_dir) | ||
subprocess.check_call(["sbt", "package"], cwd=temp_dir) | ||
|
||
# Find and copy new JAR | ||
jar_path = glob.glob(os.path.join(temp_dir, "target", "scala-*", "vexriscv_*.jar"))[0] | ||
jar_filename = os.path.basename(jar_path) | ||
jar_base, jar_ext = os.path.splitext(jar_filename) | ||
new_jar_filename = f"{jar_base}-{commit_hash}{jar_ext}" | ||
shutil.copyfile(jar_path, os.path.join(HERE, new_jar_filename)) | ||
|
||
# Write license file | ||
with open(os.path.join(HERE, f"{new_jar_filename}.license"), "w") as f: | ||
f.write(LICENSE) | ||
|
||
|
||
if __name__ == '__main__': | ||
main(sys.argv[1]) |
Binary file added
BIN
+6.13 MB
...vexriscv/example-cpu/lib/vexriscv_2.11-2.0.0-457ae5c7e5c8183f0ba7c51f7f0301d05eb8ced1.jar
Binary file not shown.
File renamed without changes.
Binary file not shown.