From edef7ac86dbd70365e9f95509b2d3e76d698a790 Mon Sep 17 00:00:00 2001 From: MingZhu Yan Date: Mon, 21 Oct 2024 14:37:35 +0800 Subject: [PATCH] [CTG] Add cli param env_dir Signed-off-by: MingZhu Yan --- riscv-ctg/riscv_ctg/ctg.py | 4 ++-- riscv-ctg/riscv_ctg/main.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/riscv-ctg/riscv_ctg/ctg.py b/riscv-ctg/riscv_ctg/ctg.py index caac7a959..b2637074d 100644 --- a/riscv-ctg/riscv_ctg/ctg.py +++ b/riscv-ctg/riscv_ctg/ctg.py @@ -100,13 +100,13 @@ def gen_test(op_node, opcode): logger.info('Writing tests for csr_comb') csr_comb_gen.write_test(fprefix, node, usage_str, label, csr_comb_instr_dict) -def ctg(verbose, out, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, max_inst,inxFlag): +def ctg(verbose, out, env_dir, random ,xlen_arg,flen_arg, cgf_file,num_procs,base_isa, max_inst,inxFlag): logger.level(verbose) logger.info('****** RISC-V Compliance Test Generator {0} *******'.format(__version__ )) logger.info('Copyright (c) 2020, InCore Semiconductors Pvt. Ltd.') logger.info('All Rights Reserved.') logger.info("Copying env folder to Output directory.") - env_dir = os.path.expanduser("~/riscv-arch-test/riscv-test-suite/env") + env_dir = os.path.expanduser(env_dir) if not os.path.exists(env_dir): shutil.copytree(const.env,env_dir) xlen = int(xlen_arg) diff --git a/riscv-ctg/riscv_ctg/main.py b/riscv-ctg/riscv_ctg/main.py index 98d172e38..3b12cee21 100644 --- a/riscv-ctg/riscv_ctg/main.py +++ b/riscv-ctg/riscv_ctg/main.py @@ -12,6 +12,7 @@ @click.version_option(prog_name="RISC-V Compliance Test Generator",version=__version__) @click.option('--verbose', '-v', default='error', help='Set verbose level', type=click.Choice(['info','error','debug','warning'],case_sensitive=False)) @click.option('--out-dir', '-d', default='./', type=click.Path(resolve_path=True,writable=True), help='Output directory path') +@click.option('--env-dir', '-e', default='~/riscv-arch-test/riscv-test-suite/env', type=click.Path(resolve_path=True,writable=True), help='Env directory path') @click.option('--randomize','-r', default=False , is_flag='True', help='Randomize Outputs.') @click.option('--cgf','-cf',multiple=True,type=click.Path(exists=True,resolve_path=True,readable=True),help="Path to the cgf file(s). Multiple allowed.") @click.option('--procs','-p',type=int,default=1,help='Max number of processes to spawn') @@ -20,11 +21,11 @@ hardware.",default='32') @click.option("--inst",type=int,help="Maximum number of Macro Instances per test.") @click.option("--z-inx", '-ix', type=bool, default='False', help="If the extension is Z*inx then pass True otherwise defaulted to False") -def cli(verbose, out_dir, randomize , cgf,procs,base_isa, flen,inst,z_inx): +def cli(verbose, out_dir, env_dir, randomize , cgf,procs,base_isa, flen,inst,z_inx): if not os.path.exists(out_dir): os.mkdir(out_dir) if '32' in base_isa: xlen = 32 elif '64' in base_isa: xlen = 64 - ctg(verbose, out_dir, randomize ,xlen, int(flen), cgf,procs,base_isa,inst,z_inx) + ctg(verbose, out_dir, env_dir, randomize ,xlen, int(flen), cgf,procs,base_isa,inst,z_inx)