|
5 | 5 |
|
6 | 6 | Communication with OpenTitan happens over the uJSON command interface. |
7 | 7 | """ |
8 | | -import json |
9 | | -import time |
10 | | -from typing import Optional |
11 | | - |
12 | | - |
13 | 8 | from target.communication.otfi import OTFI |
| 9 | +from target.communication.otfi_test import OTFITest |
14 | 10 |
|
15 | 11 |
|
16 | 12 | class OTFIIbex(OTFI): |
| 13 | + TESTS = [ |
| 14 | + OTFITest("char_unrolled_reg_op_loop"), |
| 15 | + OTFITest("char_unrolled_mem_op_loop"), |
| 16 | + OTFITest("char_reg_op_loop"), |
| 17 | + OTFITest("char_mem_op_loop"), |
| 18 | + OTFITest("char_flash_read"), |
| 19 | + OTFITest("char_flash_write"), |
| 20 | + OTFITest("char_sram_read"), |
| 21 | + OTFITest("char_sram_write_static_unrolled"), |
| 22 | + OTFITest("char_sram_write_read"), |
| 23 | + OTFITest("char_sram_write"), |
| 24 | + OTFITest("char_sram_static"), |
| 25 | + OTFITest("char_conditional_branch_beq", "CharCondBranchBeq"), |
| 26 | + OTFITest("char_conditional_branch_bne", "CharCondBranchBne"), |
| 27 | + OTFITest("char_conditional_branch_bge", "CharCondBranchBge"), |
| 28 | + OTFITest("char_conditional_branch_bgeu", "CharCondBranchBgeu"), |
| 29 | + OTFITest("char_conditional_branch_blt", "CharCondBranchBlt"), |
| 30 | + OTFITest("char_conditional_branch_bltu", "CharCondBranchBltu"), |
| 31 | + OTFITest("char_unconditional_branch", "CharUncondBranch"), |
| 32 | + OTFITest("char_unconditional_branch_nop", "CharUncondBranchNop"), |
| 33 | + OTFITest("char_register_file"), |
| 34 | + OTFITest("char_register_file_read"), |
| 35 | + OTFITest("char_csr_write"), |
| 36 | + OTFITest("char_csr_read"), |
| 37 | + OTFITest("address_translation"), |
| 38 | + OTFITest("address_translation_config", "AddressTranslationCfg"), |
| 39 | + ] |
| 40 | + |
17 | 41 | def __init__(self, target) -> None: |
18 | 42 | super().__init__(target, "Ibex") |
19 | | - |
20 | | - def ibex_char_unrolled_reg_op_loop(self) -> None: |
21 | | - """ Starts the ibex.char.unrolled_reg_op_loop test. |
22 | | - """ |
23 | | - # IbexFi command. |
24 | | - self._ujson_fi_cmd() |
25 | | - # CharUnrolledRegOpLoop command. |
26 | | - time.sleep(0.01) |
27 | | - self.target.write(json.dumps("CharUnrolledRegOpLoop").encode("ascii")) |
28 | | - |
29 | | - def ibex_char_unrolled_mem_op_loop(self) -> None: |
30 | | - """ Starts the ibex.char.unrolled_mem_op_loop test. |
31 | | - """ |
32 | | - # IbexFi command. |
33 | | - self._ujson_fi_cmd() |
34 | | - # CharUnrolledMemOpLoop command. |
35 | | - time.sleep(0.01) |
36 | | - self.target.write(json.dumps("CharUnrolledMemOpLoop").encode("ascii")) |
37 | | - |
38 | | - def ibex_char_reg_op_loop(self) -> None: |
39 | | - """ Starts the ibex.char.reg_op_loop test. |
40 | | - """ |
41 | | - # IbexFi command. |
42 | | - self._ujson_fi_cmd() |
43 | | - # CharRegOpLoop command. |
44 | | - time.sleep(0.01) |
45 | | - self.target.write(json.dumps("CharRegOpLoop").encode("ascii")) |
46 | | - |
47 | | - def ibex_char_mem_op_loop(self) -> None: |
48 | | - """ Starts the ibex.char.mem_op_loop test. |
49 | | - """ |
50 | | - # IbexFi command. |
51 | | - self._ujson_fi_cmd() |
52 | | - # CharMemOpLoop command. |
53 | | - time.sleep(0.01) |
54 | | - self.target.write(json.dumps("CharMemOpLoop").encode("ascii")) |
55 | | - |
56 | | - def ibex_char_flash_read(self) -> None: |
57 | | - """ Starts the ibex.char.flash_read test. |
58 | | - """ |
59 | | - # IbexFi command. |
60 | | - self._ujson_fi_cmd() |
61 | | - # CharFlashRead command. |
62 | | - time.sleep(0.01) |
63 | | - self.target.write(json.dumps("CharFlashRead").encode("ascii")) |
64 | | - |
65 | | - def ibex_char_flash_write(self) -> None: |
66 | | - """ Starts the ibex.char.flash_write test. |
67 | | - """ |
68 | | - # IbexFi command. |
69 | | - self._ujson_fi_cmd() |
70 | | - # CharFlashWrite command. |
71 | | - time.sleep(0.01) |
72 | | - self.target.write(json.dumps("CharFlashWrite").encode("ascii")) |
73 | | - |
74 | | - def ibex_char_sram_read(self) -> None: |
75 | | - """ Starts the ibex.char.sram_read test. |
76 | | - """ |
77 | | - # IbexFi command. |
78 | | - self._ujson_fi_cmd() |
79 | | - # CharSramRead command. |
80 | | - time.sleep(0.01) |
81 | | - self.target.write(json.dumps("CharSramRead").encode("ascii")) |
82 | | - |
83 | | - def ibex_char_sram_write_static_unrolled(self) -> None: |
84 | | - """ Starts the ibex.char.sram_write_static_unrolled test. |
85 | | - """ |
86 | | - # IbexFi command. |
87 | | - self._ujson_fi_cmd() |
88 | | - # CharSramWriteStaticUnrolled command. |
89 | | - time.sleep(0.01) |
90 | | - self.target.write(json.dumps("CharSramWriteStaticUnrolled").encode("ascii")) |
91 | | - |
92 | | - def ibex_char_sram_write_read(self) -> None: |
93 | | - """ Starts the ibex.char.sram_write_read test. |
94 | | - """ |
95 | | - # IbexFi command. |
96 | | - self._ujson_fi_cmd() |
97 | | - # CharSramWriteRead command. |
98 | | - time.sleep(0.01) |
99 | | - self.target.write(json.dumps("CharSramWriteRead").encode("ascii")) |
100 | | - |
101 | | - def ibex_char_sram_write(self) -> None: |
102 | | - """ Starts the ibex.char.sram_write test. |
103 | | - """ |
104 | | - # IbexFi command. |
105 | | - self._ujson_fi_cmd() |
106 | | - # CharSramWrite command. |
107 | | - time.sleep(0.01) |
108 | | - self.target.write(json.dumps("CharSramWrite").encode("ascii")) |
109 | | - |
110 | | - def ibex_char_sram_static(self) -> None: |
111 | | - """ Starts the ibex.char.sram_static test. |
112 | | - """ |
113 | | - # IbexFi command. |
114 | | - self._ujson_fi_cmd() |
115 | | - # CharSramWrite command. |
116 | | - time.sleep(0.01) |
117 | | - self.target.write(json.dumps("CharSramStatic").encode("ascii")) |
118 | | - |
119 | | - def ibex_char_conditional_branch_beq(self) -> None: |
120 | | - """ Starts the ibex.char.conditional_branch_beq test. |
121 | | - """ |
122 | | - # IbexFi command. |
123 | | - self._ujson_fi_cmd() |
124 | | - # CharCondBranchBeq command. |
125 | | - time.sleep(0.01) |
126 | | - self.target.write(json.dumps("CharCondBranchBeq").encode("ascii")) |
127 | | - |
128 | | - def ibex_char_conditional_branch_bne(self) -> None: |
129 | | - """ Starts the ibex.char.conditional_branch_bne test. |
130 | | - """ |
131 | | - # IbexFi command. |
132 | | - self._ujson_fi_cmd() |
133 | | - # CharCondBranchBne command. |
134 | | - time.sleep(0.01) |
135 | | - self.target.write(json.dumps("CharCondBranchBne").encode("ascii")) |
136 | | - |
137 | | - def ibex_char_conditional_branch_bge(self) -> None: |
138 | | - """ Starts the ibex.char.conditional_branch_bge test. |
139 | | - """ |
140 | | - # IbexFi command. |
141 | | - self._ujson_fi_cmd() |
142 | | - # CharCondBranchBge command. |
143 | | - time.sleep(0.01) |
144 | | - self.target.write(json.dumps("CharCondBranchBge").encode("ascii")) |
145 | | - |
146 | | - def ibex_char_conditional_branch_bgeu(self) -> None: |
147 | | - """ Starts the ibex.char.conditional_branch_bgeu test. |
148 | | - """ |
149 | | - # IbexFi command. |
150 | | - self._ujson_fi_cmd() |
151 | | - # CharCondBranchBgeu command. |
152 | | - time.sleep(0.01) |
153 | | - self.target.write(json.dumps("CharCondBranchBgeu").encode("ascii")) |
154 | | - |
155 | | - def ibex_char_conditional_branch_blt(self) -> None: |
156 | | - """ Starts the ibex.char.conditional_branch_blt test. |
157 | | - """ |
158 | | - # IbexFi command. |
159 | | - self._ujson_fi_cmd() |
160 | | - # CharCondBranchBglt command. |
161 | | - time.sleep(0.01) |
162 | | - self.target.write(json.dumps("CharCondBranchBlt").encode("ascii")) |
163 | | - |
164 | | - def ibex_char_conditional_branch_bltu(self) -> None: |
165 | | - """ Starts the ibex.char.conditional_branch_bltu test. |
166 | | - """ |
167 | | - # IbexFi command. |
168 | | - self._ujson_fi_cmd() |
169 | | - # CharCondBranchBgltu command. |
170 | | - time.sleep(0.01) |
171 | | - self.target.write(json.dumps("CharCondBranchBltu").encode("ascii")) |
172 | | - |
173 | | - def ibex_char_unconditional_branch(self) -> None: |
174 | | - """ Starts the ibex.char.unconditional_branch test. |
175 | | - """ |
176 | | - # IbexFi command. |
177 | | - self._ujson_fi_cmd() |
178 | | - # CharUncondBranch command. |
179 | | - time.sleep(0.01) |
180 | | - self.target.write(json.dumps("CharUncondBranch").encode("ascii")) |
181 | | - |
182 | | - def ibex_char_unconditional_branch_nop(self) -> None: |
183 | | - """ Starts the ibex.char.unconditional_branch_nop test. |
184 | | - """ |
185 | | - # IbexFi command. |
186 | | - self._ujson_fi_cmd() |
187 | | - # CharUncondBranchNop command. |
188 | | - time.sleep(0.01) |
189 | | - self.target.write(json.dumps("CharUncondBranchNop").encode("ascii")) |
190 | | - |
191 | | - def ibex_char_register_file(self) -> None: |
192 | | - """ Starts the ibex.char.register_file test. |
193 | | - """ |
194 | | - # IbexFi command. |
195 | | - self._ujson_fi_cmd() |
196 | | - # CharRegisterFile command. |
197 | | - time.sleep(0.01) |
198 | | - self.target.write(json.dumps("CharRegisterFile").encode("ascii")) |
199 | | - |
200 | | - def ibex_char_register_file_read(self) -> None: |
201 | | - """ Starts the ibex.char.register_file_read test. |
202 | | - """ |
203 | | - # IbexFi command. |
204 | | - self._ujson_fi_cmd() |
205 | | - # CharRegisterFileRead command. |
206 | | - time.sleep(0.01) |
207 | | - self.target.write(json.dumps("CharRegisterFileRead").encode("ascii")) |
208 | | - |
209 | | - def ibex_char_csr_write(self) -> None: |
210 | | - """ Starts the ibex.fi.char.csr_write test. |
211 | | - """ |
212 | | - # IbexFi command. |
213 | | - self._ujson_fi_cmd() |
214 | | - # CharCsrWrite command. |
215 | | - time.sleep(0.01) |
216 | | - self.target.write(json.dumps("CharCsrWrite").encode("ascii")) |
217 | | - |
218 | | - def ibex_char_csr_read(self) -> None: |
219 | | - """ Starts the ibex.fi.char.csr_read test. |
220 | | - """ |
221 | | - # IbexFi command. |
222 | | - self._ujson_fi_cmd() |
223 | | - # CharCsrRead command. |
224 | | - time.sleep(0.01) |
225 | | - self.target.write(json.dumps("CharCsrRead").encode("ascii")) |
226 | | - |
227 | | - def ibex_address_translation_config(self) -> None: |
228 | | - """ Starts the ibex.fi.address_translation_config test. |
229 | | - """ |
230 | | - # IbexFi command. |
231 | | - self._ujson_fi_cmd() |
232 | | - # AddressTranslationCfg command. |
233 | | - time.sleep(0.01) |
234 | | - self.target.write(json.dumps("AddressTranslationCfg").encode("ascii")) |
235 | | - |
236 | | - def ibex_address_translation(self) -> None: |
237 | | - """ Starts the ibex.fi.address_translation test. |
238 | | - """ |
239 | | - # IbexFi command. |
240 | | - self._ujson_fi_cmd() |
241 | | - # AddressTranslation command. |
242 | | - time.sleep(0.01) |
243 | | - self.target.write(json.dumps("AddressTranslation").encode("ascii")) |
0 commit comments