-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1368 from Incarnation-p-lee/master
Extend semantic for option '--with-extra-multilib-test'
- Loading branch information
Showing
3 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import sys | ||
|
||
def parse_options(argv): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--sim-name', type = str, required = True, | ||
help = 'The sim name of target board, like riscv-sim.') | ||
parser.add_argument('--build-arch-abi', type = str, required = True, | ||
help = 'The arch and abi when build, like ' + | ||
'--with-arch=rv64gcv --with-abi=lp64d' + | ||
'in riscv-gnu-toolchain configure, ' + | ||
'within format rv64gcv-lp64d.') | ||
parser.add_argument('--extra-test-arch-abi-flags-list', type=str, | ||
help = 'The arch, abi and flags list for extra test,' + | ||
'like =rv64gcv_zvl256b-lp64d:' + | ||
'--param=riscv-autovec-lmul=dynamic:' + | ||
'--param=riscv-autovec-preference=fixed-vlmax.', | ||
default = '') | ||
parser.add_argument('--cmodel', type = str, default = 'medlow', | ||
help = 'The name of the cmodel, like medlow.') | ||
|
||
options = parser.parse_args() | ||
return options | ||
|
||
# Generate only one target board like below: | ||
# riscv-sim/-march=rv64gcv_zvl256b/-mabi=lp64d/-mcmodel=medlow | ||
# From the config_string like below, --param is optional | ||
# rv64gcv_zvl128b-lp64d:--param=riscv-autovec-lmul=m1 | ||
def generate_one_target_board(config_string, options): | ||
configs = config_string.split(":") | ||
arch_and_abi = configs[0].split("-") | ||
arch = arch_and_abi[0] | ||
abi = arch_and_abi[1] | ||
|
||
if len (configs) == 1: | ||
return "{0}/-march={1}/-mabi={2}/-mcmodel={3}".format( | ||
options.sim_name, arch, abi, options.cmodel) | ||
|
||
flags = '/'.join(configs[1:]) | ||
|
||
return "{0}/-march={1}/-mabi={2}/-mcmodel={3}/{4}".format( | ||
options.sim_name, arch, abi, options.cmodel, flags) | ||
|
||
def main(argv): | ||
options = parse_options(argv) | ||
|
||
if not options.sim_name or not options.build_arch_abi: | ||
print ("The --sim-name and/or --build-arch-abi cannot be empty or null.") | ||
return | ||
|
||
target_board_list = [ | ||
generate_one_target_board(options.build_arch_abi, options) | ||
] | ||
|
||
if options.extra_test_arch_abi_flags_list: | ||
extra_test_list = options.extra_test_arch_abi_flags_list.split (";") | ||
|
||
for extra_test in extra_test_list: | ||
target_board_list.append(generate_one_target_board(extra_test, options)) | ||
|
||
print(' '.join(target_board_list)) | ||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv)) |