Read config data in 2 steps in core_ibex scripts

No functional change, but this means we can look at the configuration
object to do other stuff without having to reload things.
This commit is contained in:
Rupert Swarbrick 2022-04-28 12:13:28 +01:00 committed by Rupert Swarbrick
parent ecdb1e01f6
commit f6f84b0b06
5 changed files with 19 additions and 12 deletions

View file

@ -9,7 +9,8 @@ import os
import shutil
import sys
from scripts_lib import run_one, start_riscv_dv_run_cmd, get_isas_for_config
from scripts_lib import (run_one, start_riscv_dv_run_cmd,
get_config, get_isas_for_config)
def main() -> int:
@ -32,7 +33,8 @@ def main() -> int:
os.makedirs(args.output, exist_ok=True)
isa, iss_isa = get_isas_for_config(args.ibex_config)
cfg = get_config(args.ibex_config)
isa, iss_isa = get_isas_for_config(cfg)
cmd = (start_riscv_dv_run_cmd(args.verbose) +
['--co', '--steps=gen',

View file

@ -11,7 +11,7 @@ import sys
import tempfile
from scripts_lib import (read_test_dot_seed, start_riscv_dv_run_cmd,
get_isas_for_config, run_one)
get_config, get_isas_for_config, run_one)
def main() -> int:
@ -26,7 +26,8 @@ def main() -> int:
args = parser.parse_args()
isa, iss_isa = get_isas_for_config(args.ibex_config)
cfg = get_config(args.ibex_config)
isa, iss_isa = get_isas_for_config(cfg)
testname, seed = args.test_dot_seed
if not args.output.endswith('.bin'):

View file

@ -14,7 +14,7 @@ import tempfile
from typing import List
from scripts_lib import (read_test_dot_seed, start_riscv_dv_run_cmd,
get_isas_for_config, run_one)
get_config, get_isas_for_config, run_one)
def main() -> int:
@ -34,7 +34,8 @@ def main() -> int:
args = parser.parse_args()
isa, iss_isa = get_isas_for_config(args.ibex_config)
cfg = get_config(args.ibex_config)
isa, iss_isa = get_isas_for_config(cfg)
testname, seed = args.test_dot_seed

View file

@ -8,7 +8,7 @@ import argparse
import os
import sys
from scripts_lib import get_isas_for_config, run_one
from scripts_lib import get_config, get_isas_for_config, run_one
def main() -> int:
@ -21,7 +21,8 @@ def main() -> int:
args = parser.parse_args()
isa, iss_isa = get_isas_for_config(args.ibex_config)
cfg = get_config(args.ibex_config)
isa, iss_isa = get_isas_for_config(cfg)
# riscv-dv knows how to run an ISS simulation (see yaml/iss.yaml in the
# vendored directory), but it has definite (and inconvenient!) opinions

View file

@ -19,7 +19,7 @@ RISCV_DV_ROOT = os.path.normpath(os.path.join(IBEX_ROOT,
_OLD_SYS_PATH = sys.path
try:
sys.path = [os.path.join(IBEX_ROOT, 'util')] + sys.path
from ibex_config import parse_config
from ibex_config import Config, parse_config
finally:
sys.path = _OLD_SYS_PATH
@ -108,11 +108,13 @@ def read_test_dot_seed(arg: str) -> TestAndSeed:
return (match.group(1), int(match.group(2), 10))
def get_isas_for_config(ibex_cfg: str) -> Tuple[str, str]:
'''Get ISA and ISS_ISA keys for the given Ibex config'''
def get_config(cfg_name: str) -> Config:
yaml_path = os.path.join(IBEX_ROOT, "ibex_configs.yaml")
cfg = parse_config(ibex_cfg, yaml_path)
return parse_config(cfg_name, yaml_path)
def get_isas_for_config(cfg: Config) -> Tuple[str, str]:
'''Get ISA and ISS_ISA keys for the given Ibex config'''
# NOTE: This logic should match the code in the get_isa_string() function
# in core_ibex/tests/core_ibex_base_test.sv: keep them in sync!
has_multiplier = cfg.rv32m != 'ibex_pkg::RV32MNone'