mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-22 04:47:25 -04:00
Move run_rtl wrapper into scripts lib
This commit is contained in:
parent
8fd1a0df50
commit
f7863ce57c
4 changed files with 28 additions and 35 deletions
|
@ -434,17 +434,17 @@ $(rtl-sim-logs): \
|
|||
%/sim.log: \
|
||||
$(metadata)/.rtl.tb_compile.stamp \
|
||||
$(metadata)/.instr_gen.compile_tests.stamp \
|
||||
run_rtl.py
|
||||
scripts/run-rtl.py
|
||||
@echo Running RTL simulation at $@
|
||||
$(verb)mkdir -p $(@D)
|
||||
$(verb)./run_rtl.py \
|
||||
--simulator $(SIMULATOR) \
|
||||
$(cov-arg) $(wave-arg) \
|
||||
--start-seed $(SEED) \
|
||||
--sim-opts="+signature_addr=${SIGNATURE_ADDR}" \
|
||||
--test-dot-seed $(notdir $*) \
|
||||
--bin-dir $(OUT-SEED)/instr_gen/asm_test \
|
||||
--rtl-sim-dir $(OUT-SEED)/rtl_sim
|
||||
$(verb)scripts/run-rtl.py \
|
||||
--simulator $(SIMULATOR) \
|
||||
$(cov-arg) $(wave-arg) \
|
||||
--start-seed $(SEED) \
|
||||
--signature-addr $(SIGNATURE_ADDR) \
|
||||
--test-dot-seed $(notdir $*) \
|
||||
--bin-dir $(OUT-SEED)/instr_gen/asm_test \
|
||||
--rtl-sim-dir $(OUT-SEED)/rtl_sim
|
||||
|
||||
.PHONY: rtl_sim_run
|
||||
rtl_sim_run: $(rtl-sim-logs)
|
||||
|
|
|
@ -8,20 +8,10 @@ import argparse
|
|||
import os
|
||||
import sys
|
||||
|
||||
|
||||
from scripts_lib import run_one
|
||||
from scripts_lib import run_one, subst_vars
|
||||
from sim_cmd import get_simulator_cmd
|
||||
|
||||
|
||||
def subst_vars(string, var_dict):
|
||||
'''Apply substitutions in var_dict to string
|
||||
|
||||
If var_dict[K] = V, then <K> will be replaced with V in string.'''
|
||||
for key, value in var_dict.items():
|
||||
string = string.replace('<{}>'.format(key), value)
|
||||
return string
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--verbose', action='store_true')
|
||||
|
|
|
@ -7,10 +7,11 @@ import subprocess
|
|||
import sys
|
||||
from typing import Tuple
|
||||
|
||||
from scripts.sim_cmd import get_simulator_cmd
|
||||
from scripts.test_entry import get_test_entry
|
||||
from sim_cmd import get_simulator_cmd
|
||||
from scripts_lib import subst_vars
|
||||
from test_entry import get_test_entry
|
||||
|
||||
_CORE_IBEX = os.path.normpath(os.path.join(os.path.dirname(__file__)))
|
||||
_CORE_IBEX = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
_TestAndSeed = Tuple[str, int]
|
||||
|
||||
|
@ -27,15 +28,6 @@ def read_test_dot_seed(arg: str) -> _TestAndSeed:
|
|||
return (match.group(1), int(match.group(2), 10))
|
||||
|
||||
|
||||
def subst_vars(string, var_dict):
|
||||
'''Apply substitutions in var_dict to string
|
||||
|
||||
If var_dict[K] = V, then <K> will be replaced with V in string.'''
|
||||
for key, value in var_dict.items():
|
||||
string = string.replace('<{}>'.format(key), value)
|
||||
return string
|
||||
|
||||
|
||||
def get_test_sim_cmd(base_cmd, test, idx, seed, sim_dir, bin_dir, lsf_cmd):
|
||||
'''Generate the command that runs a test iteration in the simulator
|
||||
|
||||
|
@ -88,6 +80,7 @@ def main() -> int:
|
|||
parser.add_argument('--simulator', required=True)
|
||||
parser.add_argument("--en_cov", action='store_true')
|
||||
parser.add_argument("--en_wave", action='store_true')
|
||||
parser.add_argument('--signature-addr', required=True)
|
||||
parser.add_argument('--start-seed', type=int, required=True)
|
||||
parser.add_argument('--test-dot-seed',
|
||||
type=read_test_dot_seed,
|
||||
|
@ -95,7 +88,6 @@ def main() -> int:
|
|||
parser.add_argument('--lsf-cmd')
|
||||
parser.add_argument('--bin-dir', required=True)
|
||||
parser.add_argument('--rtl-sim-dir', required=True)
|
||||
parser.add_argument('--sim-opts', default='')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -117,11 +109,13 @@ def main() -> int:
|
|||
}
|
||||
_, base_cmd = get_simulator_cmd(args.simulator, enables)
|
||||
|
||||
sim_opts = f'+signature_addr={args.signature_addr}'
|
||||
|
||||
# Specialize base_cmd with the right directories and simulator options
|
||||
sim_cmd = subst_vars(base_cmd,
|
||||
{
|
||||
'out': args.rtl_sim_dir,
|
||||
'sim_opts': args.sim_opts,
|
||||
'sim_opts': sim_opts,
|
||||
'cwd': _CORE_IBEX,
|
||||
})
|
||||
|
|
@ -7,7 +7,7 @@ import os
|
|||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import List
|
||||
from typing import Dict, List
|
||||
|
||||
THIS_DIR = os.path.dirname(__file__)
|
||||
IBEX_ROOT = os.path.join(THIS_DIR, 4 * '../')
|
||||
|
@ -66,3 +66,12 @@ def start_riscv_dv_run_cmd(verbose: bool):
|
|||
cmd.append('--verbose')
|
||||
|
||||
return cmd
|
||||
|
||||
|
||||
def subst_vars(string: str, var_dict: Dict[str, str]) -> str:
|
||||
'''Apply substitutions in var_dict to string
|
||||
|
||||
If var_dict[K] = V, then <K> will be replaced with V in string.'''
|
||||
for key, value in var_dict.items():
|
||||
string = string.replace('<{}>'.format(key), value)
|
||||
return string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue