Debian Codegraph @

tests/riscv-official/code/myparse.py

raw
1 import argparse
2
3
4 def init_parser():
5 parser = argparse.ArgumentParser(
6 description="Defeault tests are RV32UI and RV64UI. No pipeline and cache.")
7 parser.add_argument('qtrvsim_cli',
8 default='',
9 help="Qtrvsim_cli to run tests. (RVxxUI is default)")
10
11 # Test selection
12 bsel = parser.add_argument_group(
13 "bit lenght selection for official tests:")
14 bsel.add_argument("--no-32",
15 action="count",
16 default=0,
17 dest="no32",
18
19 help="Disables 32-bit tests. (Only for official tests)")
20 bsel.add_argument("--no-64",
21 action="count",
22 default=0,
23 dest="no64",
24 help="Disables 64-bit tests. (Only for official tests)")
25
26 # Additional tests
27 tsel = parser.add_argument_group("additional set of tests:")
28 tsel.add_argument("-E", "--external",
29 nargs=1,
30 action="store",
31 default="",
32 help="Path to additional tests. Required to adhere to PASS,FAIL behavior of edited test enviroment.")
33 tsel.add_argument("-M", "--multiply",
34 action="count",
35 default=0,
36 help="Additional set of tests for multiplication.")
37 tsel.add_argument("-A", "--atomic",
38 action="count",
39 default=0,
40 help="Additional set of tests for atomic instructions.")
41 tsel.add_argument("--CSR",
42 action="count",
43 default=0,
44 help="Additional set of tests for control and status registers.")
45
46 # QtRVSim_cli settings
47 opts = parser.add_argument_group("QtRVSim options:")
48 opts.add_argument("--pipeline",
49 action="count",
50 default=0,
51 help="Simulator runs in pipelined configuration.")
52 opts.add_argument("--cache",
53 action="count",
54 default=0,
55 help="Simulator runs with d-cache and i-cache implemented. (d lru,2,2,2,wb ; i lru,2,2,2)")
56
57 # Test aplication output options
58 eout = parser.add_argument_group("output print options:")
59 eout.add_argument("--no-pass",
60 action="count",
61 default=0,
62 dest="nopass",
63 help="Prints only failed tests for readability.")
64 eout.add_argument("--no-dump",
65 action="count",
66 default=0,
67 dest="nodump",
68 help="Omits printing of registers in failed test.")
69 eout.add_argument("--d-regs",
70 action="count",
71 default=0,
72 dest="dregs",
73 help="Prints output of qtrvsim --d-regs param. (Higher priority than other output options.)")
74 eout.add_argument("--file",
75 action="count",
76 default=0,
77 dest="fileprt",
78 help="Removes most graphical output features.")
79
80 # Test aplication good to have features
81 gth = parser.add_argument_group("good to have:")
82 gth.add_argument("-R", "--rebuild",
83 action="count",
84 default=0,
85 help="Deletes tests and buidls them anew.")
86 gth.add_argument("-S", "--selftest",
87 action="count",
88 default=0,
89 dest="selftest",
90 help="Enable simple tests to check if tester behaves properly.")
91 gth.add_argument("--clean",
92 action="count",
93 default=0,
94 dest="clean",
95 help="Deletes all official and seftest elf files.")
96 return parser