Merge pull request #76 from olofk/snapshot_dir2

Set snapshot dir to a known location in FuseSoC SweRV config generator
This commit is contained in:
Ajay Nath 2020-09-24 10:26:32 -04:00 committed by GitHub
commit 7332edc0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
from fusesoc.capi2.generator import Generator from fusesoc.capi2.generator import Generator
import os import os
import shutil import shutil
@ -12,16 +12,17 @@ else:
class SwervConfigGenerator(Generator): class SwervConfigGenerator(Generator):
def run(self): def run(self):
build_path="swerv_config"
script_root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) script_root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..'))
files = [ files = [
{"snapshots/default/common_defines.vh" : { {os.path.join(build_path, "common_defines.vh") : {
"copyto" : "config/common_defines.vh", "copyto" : "config/common_defines.vh",
"file_type" : "systemVerilogSource"}}, "file_type" : "systemVerilogSource"}},
{"snapshots/default/pic_ctrl_verilator_unroll.sv" : { {os.path.join(build_path, "pic_ctrl_verilator_unroll.sv") : {
"copyto" : "config/pic_ctrl_verilator_unroll.sv", "copyto" : "config/pic_ctrl_verilator_unroll.sv",
"is_include_file" : True, "is_include_file" : True,
"file_type" : "systemVerilogSource"}}, "file_type" : "systemVerilogSource"}},
{"snapshots/default/pic_map_auto.h" : { {os.path.join(build_path, "pic_map_auto.h") : {
"copyto" : "config/pic_map_auto.h", "copyto" : "config/pic_map_auto.h",
"is_include_file" : True, "is_include_file" : True,
"file_type" : "systemVerilogSource"}}] "file_type" : "systemVerilogSource"}}]
@ -33,6 +34,7 @@ class SwervConfigGenerator(Generator):
env = os.environ.copy() env = os.environ.copy()
env['RV_ROOT'] = tmp_dir env['RV_ROOT'] = tmp_dir
env['BUILD_PATH'] = build_path
args = ['configs/swerv.config'] + self.config.get('args', []) args = ['configs/swerv.config'] + self.config.get('args', [])
rc = subprocess.call(args, cwd=cwd, env=env, stdout=devnull) rc = subprocess.call(args, cwd=cwd, env=env, stdout=devnull)
if rc: if rc:

View File

@ -142,7 +142,7 @@ generate:
generators: generators:
swerv_config: swerv_config:
interpreter: python interpreter: python3
command: configs/swerv_config_gen.py command: configs/swerv_config_gen.py
description : Create a SweRV configuration. Note! Only supports the default config description : Create a SweRV configuration. Note! Only supports the default config