reverting to 0242c9e
for swerv_config_gen.py
This commit is contained in:
parent
d4e7b25f71
commit
81bff1c0d7
|
@ -1,34 +1,42 @@
|
||||||
#!/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
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
if sys.version[0] == '2':
|
||||||
|
devnull = open(os.devnull, 'w')
|
||||||
|
else:
|
||||||
|
from subprocess import DEVNULL as devnull
|
||||||
|
|
||||||
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]), '..'))
|
||||||
files = [
|
files = [
|
||||||
{"configs/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"}},
|
||||||
{"configs/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"}},
|
||||||
{"configs/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"}}]
|
||||||
|
|
||||||
tmp_dir = os.path.join(tempfile.mkdtemp(), 'core')
|
tmp_dir = os.path.join(tempfile.mkdtemp(), 'core')
|
||||||
shutil.copytree(self.files_root, tmp_dir)
|
shutil.copytree(script_root, tmp_dir)
|
||||||
|
|
||||||
cwd = tmp_dir
|
cwd = tmp_dir
|
||||||
|
|
||||||
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)
|
rc = subprocess.call(args, cwd=cwd, env=env, stdout=devnull)
|
||||||
if rc:
|
if rc:
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue