1 # Copyright (c) 2014-2017 ARM Limited
4 # The license below extends only to copyright in the software and shall
5 # not be construed as granting a license to any other intellectual
6 # property including but not limited to intellectual property relating
7 # to a hardware implementation of the functionality of the software
8 # licensed hereunder. You may use the software subject to the license
9 # terms below provided that you ensure that this notice is replicated
10 # unmodified and in its entirety in all distributions of the software,
11 # modified or unmodified, in source code or in binary form.
13 # Redistribution and use in source and binary forms, with or without
14 # modification, are permitted provided that the following conditions are
15 # met: redistributions of source code must retain the above copyright
16 # notice, this list of conditions and the following disclaimer;
17 # redistributions in binary form must reproduce the above copyright
18 # notice, this list of conditions and the following disclaimer in the
19 # documentation and/or other materials provided with the distribution;
20 # neither the name of the copyright holders nor the names of its
21 # contributors may be used to endorse or promote products derived from
22 # this software without specific prior written permission.
24 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 # Authors: Andrew Bardsley
39 """The High-Performance In-order (HPI) CPU timing model is tuned to be
40 representative of a modern in-order ARMv8-A implementation. The HPI
41 core and its supporting simulation scripts, namely starter_se.py and
42 starter_fs.py (under /configs/example/arm/) are part of the ARM
43 Research Starter Kit on System Modeling. More information can be found
44 at: http://www.arm.com/ResearchEnablement/SystemModeling
48 from __future__
import print_function
50 from m5
.objects
import *
52 # Simple function to allow a string of [01x_] to be converted into a
53 # mask and value for use with MinorFUTiming
54 def make_implicant(implicant_string
):
59 for char
in implicant_string
:
76 print("Can't parse implicant character", char
)
78 return (ret_mask
, ret_match
)
83 a64_inst
= make_implicant('0_01xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
84 a32_inst
= make_implicant('0_00xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
85 t32_inst
= make_implicant('1_10xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
86 t16_inst
= make_implicant('1_00xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
87 any_inst
= make_implicant('x_xxxx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
90 make_implicant('x_x1xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
92 make_implicant('x_x0xx__xxxx_xxxx_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
94 def encode_opcode(pattern
):
95 def encode(opcode_string
):
96 a64_mask
, a64_match
= pattern
97 mask
, match
= make_implicant(opcode_string
)
98 return (a64_mask | mask
), (a64_match | match
)
101 a64_opcode
= encode_opcode(a64_inst
)
102 a32_opcode
= encode_opcode(a32_inst
)
103 t32_opcode
= encode_opcode(t32_inst
)
104 t16_opcode
= encode_opcode(t16_inst
)
106 # These definitions (in some form) should probably be part of TimingExpr
110 ret
= TimingExprLiteral()
115 def bin(op
, left
, right
):
117 ret
= TimingExprBin()
118 ret
.op
= 'timingExpr' + op
120 ret
.right
= right(env
)
127 ret
.op
= 'timingExpr' + op
135 ret
= TimingExprRef()
136 ret
.index
= env
[name
]
138 print("Invalid expression name", name
)
139 ret
= TimingExprNull()
143 def if_expr(cond
, true_expr
, false_expr
):
147 ret
.trueExpr
= true_expr(env
)
148 ret
.falseExpr
= false_expr(env
)
154 ret
= TimingExprSrcReg()
161 ret
= TimingExprReadIntReg()
166 def let(bindings
, expr
):
168 ret
= TimingExprLet()
173 # Make the sub-expression as null to start with
174 for name
, binding
in bindings
:
179 # Then apply them to the produced new env
180 for i
in xrange(0, len(bindings
)):
181 name
, binding_expr
= bindings
[i
]
182 defns
.append(binding_expr(new_env
))
185 ret
.expr
= expr(new_env
)
193 class HPI_DefaultInt(MinorFUTiming
):
194 description
= 'HPI_DefaultInt'
195 mask
, match
= any_non_a64_inst
196 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
198 class HPI_DefaultA64Int(MinorFUTiming
):
199 description
= 'HPI_DefaultA64Int'
200 mask
, match
= any_a64_inst
202 srcRegsRelativeLats
= [2, 2, 2, 0]
204 class HPI_DefaultMul(MinorFUTiming
):
205 description
= 'HPI_DefaultMul'
206 mask
, match
= any_non_a64_inst
208 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 0]
210 class HPI_DefaultA64Mul(MinorFUTiming
):
211 description
= 'HPI_DefaultA64Mul'
212 mask
, match
= any_a64_inst
213 # a (zr for mul), l, r
214 srcRegsRelativeLats
= [0, 0, 0, 0]
217 class HPI_DefaultVfp(MinorFUTiming
):
218 description
= 'HPI_DefaultVfp'
219 mask
, match
= any_non_a64_inst
220 # cpsr, z, z, z, cpacr, fpexc, l_lo, r_lo, l_hi, r_hi (from vadd2h)
221 srcRegsRelativeLats
= [5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 0]
223 class HPI_DefaultA64Vfp(MinorFUTiming
):
224 description
= 'HPI_DefaultA64Vfp'
225 mask
, match
= any_a64_inst
226 # cpsr, cpacr_el1, fpscr_exc, ...
227 srcRegsRelativeLats
= [5, 5, 5, 2]
229 class HPI_FMADD_A64(MinorFUTiming
):
230 description
= 'HPI_FMADD_A64'
231 mask
, match
= a64_opcode('0001_1111_0x0x_xxxx__0xxx_xxxx_xxxx_xxxx')
233 # cpsr, cpacr_el1, fpscr_exc, 1, 1, 2, 2, 3, 3, fpscr_exc, d, d, d, d
234 srcRegsRelativeLats
= [5, 5, 5, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]
236 class HPI_FMSUB_D_A64(MinorFUTiming
):
237 description
= 'HPI_FMSUB_D_A64'
238 mask
, match
= a64_opcode('0001_1111_0x0x_xxxx__1xxx_xxxx_xxxx_xxxx')
240 # cpsr, cpacr_el1, fpscr_exc, 1, 1, 2, 2, 3, 3, fpscr_exc, d, d, d, d
241 srcRegsRelativeLats
= [5, 5, 5, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]
243 class HPI_FMOV_A64(MinorFUTiming
):
244 description
= 'HPI_FMOV_A64'
245 mask
, match
= a64_opcode('0001_1110_0x10_0000__0100_00xx_xxxx_xxxx')
246 # cpsr, cpacr_el1, fpscr_exc, 1, 1, 2, 2, 3, 3, fpscr_exc, d, d, d, d
247 srcRegsRelativeLats
= [5, 5, 5, 0]
249 class HPI_ADD_SUB_vector_scalar_A64(MinorFUTiming
):
250 description
= 'HPI_ADD_SUB_vector_scalar_A64'
251 mask
, match
= a64_opcode('01x1_1110_xx1x_xxxx__1000_01xx_xxxx_xxxx')
252 # cpsr, z, z, z, cpacr, fpexc, l0, r0, l1, r1, l2, r2, l3, r3 (for vadd2h)
253 srcRegsRelativeLats
= [5, 5, 5, 4]
256 class HPI_ADD_SUB_vector_vector_A64(MinorFUTiming
):
257 description
= 'HPI_ADD_SUB_vector_vector_A64'
258 mask
, match
= a64_opcode('0xx0_1110_xx1x_xxxx__1000_01xx_xxxx_xxxx')
259 # cpsr, z, z, z, cpacr, fpexc, l0, r0, l1, r1, l2, r2, l3, r3 (for vadd2h)
260 srcRegsRelativeLats
= [5, 5, 5, 4]
262 class HPI_FDIV_scalar_32_A64(MinorFUTiming
):
263 description
= 'HPI_FDIV_scalar_32_A64'
264 mask
, match
= a64_opcode('0001_1110_001x_xxxx__0001_10xx_xxxx_xxxx')
266 srcRegsRelativeLats
= [0, 0, 0, 20, 4]
268 class HPI_FDIV_scalar_64_A64(MinorFUTiming
):
269 description
= 'HPI_FDIV_scalar_64_A64'
270 mask
, match
= a64_opcode('0001_1110_011x_xxxx__0001_10xx_xxxx_xxxx')
272 srcRegsRelativeLats
= [0, 0, 0, 20, 4]
274 # CINC CINV CSEL CSET CSETM CSINC CSINC CSINV CSINV CSNEG
275 class HPI_Cxxx_A64(MinorFUTiming
):
276 description
= 'HPI_Cxxx_A64'
277 mask
, match
= a64_opcode('xx01_1010_100x_xxxx_xxxx__0xxx_xxxx_xxxx')
278 srcRegsRelativeLats
= [3, 3, 3, 2, 2]
280 class HPI_DefaultMem(MinorFUTiming
):
281 description
= 'HPI_DefaultMem'
282 mask
, match
= any_non_a64_inst
283 srcRegsRelativeLats
= [1, 1, 1, 1, 1, 2]
284 # Assume that LDR/STR take 2 cycles for resolving dependencies
288 class HPI_DefaultMem64(MinorFUTiming
):
289 description
= 'HPI_DefaultMem64'
290 mask
, match
= any_a64_inst
291 srcRegsRelativeLats
= [2]
292 # Assume that LDR/STR take 2 cycles for resolving dependencies
296 class HPI_DataProcessingMovShiftr(MinorFUTiming
):
297 description
= 'HPI_DataProcessingMovShiftr'
298 mask
, match
= a32_opcode('xxxx_0001_101x_xxxx__xxxx_xxxx_xxx1_xxxx')
299 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
301 class HPI_DataProcessingMayShift(MinorFUTiming
):
302 description
= 'HPI_DataProcessingMayShift'
303 mask
, match
= a32_opcode('xxxx_000x_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
304 srcRegsRelativeLats
= [3, 3, 2, 2, 1, 1, 0]
306 class HPI_DataProcessingNoShift(MinorFUTiming
):
307 description
= 'HPI_DataProcessingNoShift'
308 mask
, match
= a32_opcode('xxxx_000x_xxxx_xxxx__xxxx_0000_0xx0_xxxx')
309 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
311 class HPI_DataProcessingAllowShifti(MinorFUTiming
):
312 description
= 'HPI_DataProcessingAllowShifti'
313 mask
, match
= a32_opcode('xxxx_000x_xxxx_xxxx__xxxx_xxxx_xxx0_xxxx')
314 srcRegsRelativeLats
= [3, 3, 2, 2, 1, 1, 0]
316 class HPI_DataProcessingSuppressShift(MinorFUTiming
):
317 description
= 'HPI_DataProcessingSuppressShift'
318 mask
, match
= a32_opcode('xxxx_000x_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
319 srcRegsRelativeLats
= []
322 class HPI_DataProcessingSuppressBranch(MinorFUTiming
):
323 description
= 'HPI_DataProcessingSuppressBranch'
324 mask
, match
= a32_opcode('xxxx_1010_xxxx_xxxx__xxxx_xxxx_xxxx_xxxx')
325 srcRegsRelativeLats
= []
328 class HPI_BFI_T1(MinorFUTiming
):
329 description
= 'HPI_BFI_T1'
330 mask
, match
= t32_opcode('1111_0x11_0110_xxxx__0xxx_xxxx_xxxx_xxxx')
331 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
333 class HPI_BFI_A1(MinorFUTiming
):
334 description
= 'HPI_BFI_A1'
335 mask
, match
= a32_opcode('xxxx_0111_110x_xxxx__xxxx_xxxx_x001_xxxx')
337 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
339 class HPI_CLZ_T1(MinorFUTiming
):
340 description
= 'HPI_CLZ_T1'
341 mask
, match
= t32_opcode('1111_1010_1011_xxxx__1111_xxxx_1000_xxxx')
342 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
344 class HPI_CLZ_A1(MinorFUTiming
):
345 description
= 'HPI_CLZ_A1'
346 mask
, match
= a32_opcode('xxxx_0001_0110_xxxx__xxxx_xxxx_0001_xxxx')
347 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
349 class HPI_CMN_immediate_A1(MinorFUTiming
):
350 description
= 'HPI_CMN_immediate_A1'
351 mask
, match
= a32_opcode('xxxx_0011_0111_xxxx__xxxx_xxxx_xxxx_xxxx')
352 srcRegsRelativeLats
= [3, 3, 3, 2, 2, 3, 3, 3, 0]
354 class HPI_CMN_register_A1(MinorFUTiming
):
355 description
= 'HPI_CMN_register_A1'
356 mask
, match
= a32_opcode('xxxx_0001_0111_xxxx__xxxx_xxxx_xxx0_xxxx')
357 srcRegsRelativeLats
= [3, 3, 3, 2, 2, 3, 3, 3, 0]
359 class HPI_CMP_immediate_A1(MinorFUTiming
):
360 description
= 'HPI_CMP_immediate_A1'
361 mask
, match
= a32_opcode('xxxx_0011_0101_xxxx__xxxx_xxxx_xxxx_xxxx')
362 srcRegsRelativeLats
= [3, 3, 3, 2, 2, 3, 3, 3, 0]
364 class HPI_CMP_register_A1(MinorFUTiming
):
365 description
= 'HPI_CMP_register_A1'
366 mask
, match
= a32_opcode('xxxx_0001_0101_xxxx__xxxx_xxxx_xxx0_xxxx')
367 srcRegsRelativeLats
= [3, 3, 3, 2, 2, 3, 3, 3, 0]
369 class HPI_MLA_T1(MinorFUTiming
):
370 description
= 'HPI_MLA_T1'
371 mask
, match
= t32_opcode('1111_1011_0000_xxxx__xxxx_xxxx_0000_xxxx')
373 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
375 class HPI_MLA_A1(MinorFUTiming
):
376 description
= 'HPI_MLA_A1'
377 mask
, match
= a32_opcode('xxxx_0000_001x_xxxx__xxxx_xxxx_1001_xxxx')
379 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
381 class HPI_MADD_A64(MinorFUTiming
):
382 description
= 'HPI_MADD_A64'
383 mask
, match
= a64_opcode('x001_1011_000x_xxxx__0xxx_xxxx_xxxx_xxxx')
385 srcRegsRelativeLats
= [1, 1, 1, 0]
388 class HPI_MLS_T1(MinorFUTiming
):
389 description
= 'HPI_MLS_T1'
390 mask
, match
= t32_opcode('1111_1011_0000_xxxx__xxxx_xxxx_0001_xxxx')
392 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
394 class HPI_MLS_A1(MinorFUTiming
):
395 description
= 'HPI_MLS_A1'
396 mask
, match
= a32_opcode('xxxx_0000_0110_xxxx__xxxx_xxxx_1001_xxxx')
398 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
400 class HPI_MOVT_A1(MinorFUTiming
):
401 description
= 'HPI_MOVT_A1'
402 mask
, match
= t32_opcode('xxxx_0010_0100_xxxx__xxxx_xxxx_xxxx_xxxx')
404 class HPI_MUL_T1(MinorFUTiming
):
405 description
= 'HPI_MUL_T1'
406 mask
, match
= t16_opcode('0100_0011_01xx_xxxx')
407 class HPI_MUL_T2(MinorFUTiming
):
408 description
= 'HPI_MUL_T2'
409 mask
, match
= t32_opcode('1111_1011_0000_xxxx_1111_xxxx_0000_xxxx')
411 class HPI_PKH_T1(MinorFUTiming
):
412 description
= 'HPI_PKH_T1'
413 mask
, match
= t32_opcode('1110_1010_110x_xxxx__xxxx_xxxx_xxxx_xxxx')
414 srcRegsRelativeLats
= [0, 0, 0, 2, 1, 0]
416 class HPI_PKH_A1(MinorFUTiming
):
417 description
= 'HPI_PKH_A1'
418 mask
, match
= a32_opcode('xxxx_0110_1000_xxxx__xxxx_xxxx_xx01_xxxx')
419 srcRegsRelativeLats
= [0, 0, 0, 2, 1, 0]
421 class HPI_QADD_QSUB_T1(MinorFUTiming
):
422 description
= 'HPI_QADD_QSUB_T1'
423 mask
, match
= t32_opcode('1111_1010_1000_xxxx__1111_xxxx_10x0_xxxx')
424 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
426 class HPI_QADD_QSUB_A1(MinorFUTiming
):
427 description
= 'HPI_QADD_QSUB_A1'
428 mask
, match
= a32_opcode('xxxx_0001_00x0_xxxx__xxxx_xxxx_0101_xxxx')
429 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
431 # T1 QADD16 QADD8 QSUB16 QSUB8 UQADD16 UQADD8 UQSUB16 UQSUB8
432 class HPI_QADD_ETC_T1(MinorFUTiming
):
433 description
= 'HPI_QADD_ETC_T1'
434 mask
, match
= t32_opcode('1111_1010_1x0x_xxxx__1111_xxxx_0x01_xxxx')
435 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
437 # A1 QADD16 QADD8 QSAX QSUB16 QSUB8 UQADD16 UQADD8 UQASX UQSAX UQSUB16 UQSUB8
438 class HPI_QADD_ETC_A1(MinorFUTiming
):
439 description
= 'HPI_QADD_ETC_A1'
440 mask
, match
= a32_opcode('xxxx_0110_0x10_xxxx__xxxx_xxxx_xxx1_xxxx')
441 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
443 class HPI_QASX_QSAX_UQASX_UQSAX_T1(MinorFUTiming
):
444 description
= 'HPI_QASX_QSAX_UQASX_UQSAX_T1'
445 mask
, match
= t32_opcode('1111_1010_1x10_xxxx__1111_xxxx_0x01_xxxx')
446 srcRegsRelativeLats
= [0, 0, 0, 1, 1, 0]
448 class HPI_QDADD_QDSUB_T1(MinorFUTiming
):
449 description
= 'HPI_QDADD_QDSUB_T1'
450 mask
, match
= t32_opcode('1111_1010_1000_xxxx__1111_xxxx_10x1_xxxx')
451 srcRegsRelativeLats
= [0, 0, 0, 0, 1, 0]
453 class HPI_QDADD_QDSUB_A1(MinorFUTiming
):
454 description
= 'HPI_QDADD_QSUB_A1'
455 mask
, match
= a32_opcode('xxxx_0001_01x0_xxxx__xxxx_xxxx_0101_xxxx')
456 srcRegsRelativeLats
= [0, 0, 0, 0, 1, 0]
458 class HPI_RBIT_A1(MinorFUTiming
):
459 description
= 'HPI_RBIT_A1'
460 mask
, match
= a32_opcode('xxxx_0110_1111_xxxx__xxxx_xxxx_0011_xxxx')
461 srcRegsRelativeLats
= [0, 0, 0, 1, 0]
463 class HPI_REV_REV16_A1(MinorFUTiming
):
464 description
= 'HPI_REV_REV16_A1'
465 mask
, match
= a32_opcode('xxxx_0110_1011_xxxx__xxxx_xxxx_x011_xxxx')
466 srcRegsRelativeLats
= [0, 0, 0, 1, 0]
468 class HPI_REVSH_A1(MinorFUTiming
):
469 description
= 'HPI_REVSH_A1'
470 mask
, match
= a32_opcode('xxxx_0110_1111_xxxx__xxxx_xxxx_1011_xxxx')
471 srcRegsRelativeLats
= [0, 0, 0, 1, 0]
473 class HPI_ADD_ETC_A1(MinorFUTiming
):
474 description
= 'HPI_ADD_ETC_A1'
475 mask
, match
= a32_opcode('xxxx_0110_0xx1_xxxx__xxxx_xxxx_x001_xxxx')
476 srcRegsRelativeLats
= [0, 0, 0, 2, 2, 0]
478 class HPI_ADD_ETC_T1(MinorFUTiming
):
479 description
= 'HPI_ADD_ETC_A1'
480 mask
, match
= t32_opcode('1111_1010_100x_xxxx__1111_xxxx_0xx0_xxxx')
481 srcRegsRelativeLats
= [0, 0, 0, 2, 2, 0]
483 class HPI_SASX_SHASX_UASX_UHASX_A1(MinorFUTiming
):
484 description
= 'HPI_SASX_SHASX_UASX_UHASX_A1'
485 mask
, match
= a32_opcode('xxxx_0110_0xx1_xxxx__xxxx_xxxx_0011_xxxx')
486 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
488 class HPI_SBFX_UBFX_A1(MinorFUTiming
):
489 description
= 'HPI_SBFX_UBFX_A1'
490 mask
, match
= a32_opcode('xxxx_0111_1x1x_xxxx__xxxx_xxxx_x101_xxxx')
491 srcRegsRelativeLats
= [0, 0, 0, 1, 0]
495 sdiv_lat_expr
= expr_top(let([
496 ('left', un('SignExtend32To64', int_reg(src(4)))),
497 ('right', un('SignExtend32To64', int_reg(src(3)))),
498 ('either_signed', bin('Or',
499 bin('SLessThan', ref('left'), literal(0)),
500 bin('SLessThan', ref('right'), literal(0)))),
501 ('left_size', un('SizeInBits', un('Abs', ref('left')))),
502 ('signed_adjust', if_expr(ref('either_signed'), literal(1), literal(0))),
503 ('right_size', un('SizeInBits',
504 bin('UDiv', un('Abs', ref('right')),
505 if_expr(ref('either_signed'), literal(4), literal(2))))),
506 ('left_minus_right', if_expr(
507 bin('SLessThan', ref('left_size'), ref('right_size')),
509 bin('Sub', ref('left_size'), ref('right_size'))))
512 ref('signed_adjust'),
513 if_expr(bin('Equal', ref('right'), literal(0)),
515 bin('UDiv', ref('left_minus_right'), literal(4))))
518 sdiv_lat_expr64
= expr_top(let([
519 ('left', un('SignExtend32To64', int_reg(src(0)))),
520 ('right', un('SignExtend32To64', int_reg(src(1)))),
521 ('either_signed', bin('Or',
522 bin('SLessThan', ref('left'), literal(0)),
523 bin('SLessThan', ref('right'), literal(0)))),
524 ('left_size', un('SizeInBits', un('Abs', ref('left')))),
525 ('signed_adjust', if_expr(ref('either_signed'), literal(1), literal(0))),
526 ('right_size', un('SizeInBits',
527 bin('UDiv', un('Abs', ref('right')),
528 if_expr(ref('either_signed'), literal(4), literal(2))))),
529 ('left_minus_right', if_expr(
530 bin('SLessThan', ref('left_size'), ref('right_size')),
532 bin('Sub', ref('left_size'), ref('right_size'))))
535 ref('signed_adjust'),
536 if_expr(bin('Equal', ref('right'), literal(0)),
538 bin('UDiv', ref('left_minus_right'), literal(4))))
541 class HPI_SDIV_A1(MinorFUTiming
):
542 description
= 'HPI_SDIV_A1'
543 mask
, match
= a32_opcode('xxxx_0111_0001_xxxx__xxxx_xxxx_0001_xxxx')
545 srcRegsRelativeLats
= []
546 extraCommitLatExpr
= sdiv_lat_expr
548 class HPI_SDIV_A64(MinorFUTiming
):
549 description
= 'HPI_SDIV_A64'
550 mask
, match
= a64_opcode('x001_1010_110x_xxxx__0000_11xx_xxxx_xxxx')
552 srcRegsRelativeLats
= []
553 extraCommitLatExpr
= sdiv_lat_expr64
557 class HPI_SEL_A1(MinorFUTiming
):
558 description
= 'HPI_SEL_A1'
559 mask
, match
= a32_opcode('xxxx_0110_1000_xxxx__xxxx_xxxx_1011_xxxx')
560 srcRegsRelativeLats
= [0, 0, 0, 0, 2, 2, 0]
562 class HPI_SEL_A1_Suppress(MinorFUTiming
):
563 description
= 'HPI_SEL_A1_Suppress'
564 mask
, match
= a32_opcode('xxxx_0110_1000_xxxx__xxxx_xxxx_1011_xxxx')
565 srcRegsRelativeLats
= []
568 class HPI_SHSAX_SSAX_UHSAX_USAX_A1(MinorFUTiming
):
569 description
= 'HPI_SHSAX_SSAX_UHSAX_USAX_A1'
570 mask
, match
= a32_opcode('xxxx_0110_0xx1_xxxx__xxxx_xxxx_0101_xxxx')
572 srcRegsRelativeLats
= [3, 3, 2, 2, 2, 1, 0]
574 class HPI_USUB_ETC_A1(MinorFUTiming
):
575 description
= 'HPI_USUB_ETC_A1'
576 mask
, match
= a32_opcode('xxxx_0110_0xx1_xxxx__xxxx_xxxx_x111_xxxx')
577 srcRegsRelativeLats
= [0, 0, 0, 2, 2, 0]
579 class HPI_SMLABB_T1(MinorFUTiming
):
580 description
= 'HPI_SMLABB_T1'
581 mask
, match
= t32_opcode('1111_1011_0001_xxxx__xxxx_xxxx_00xx_xxxx')
582 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
584 class HPI_SMLABB_A1(MinorFUTiming
):
585 description
= 'HPI_SMLABB_A1'
586 mask
, match
= a32_opcode('xxxx_0001_0000_xxxx__xxxx_xxxx_1xx0_xxxx')
587 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
589 class HPI_SMLAD_T1(MinorFUTiming
):
590 description
= 'HPI_SMLAD_T1'
591 mask
, match
= t32_opcode('1111_1011_0010_xxxx__xxxx_xxxx_000x_xxxx')
592 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
594 class HPI_SMLAD_A1(MinorFUTiming
):
595 description
= 'HPI_SMLAD_A1'
596 mask
, match
= a32_opcode('xxxx_0111_0000_xxxx__xxxx_xxxx_00x1_xxxx')
598 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
600 class HPI_SMLAL_T1(MinorFUTiming
):
601 description
= 'HPI_SMLAL_T1'
602 mask
, match
= t32_opcode('1111_1011_1100_xxxx__xxxx_xxxx_0000_xxxx')
603 class HPI_SMLAL_A1(MinorFUTiming
):
604 description
= 'HPI_SMLAL_A1'
605 mask
, match
= a32_opcode('xxxx_0000_111x_xxxx__xxxx_xxxx_1001_xxxx')
607 class HPI_SMLALBB_T1(MinorFUTiming
):
608 description
= 'HPI_SMLALBB_T1'
609 mask
, match
= t32_opcode('1111_1011_1100_xxxx__xxxx_xxxx_10xx_xxxx')
610 class HPI_SMLALBB_A1(MinorFUTiming
):
611 description
= 'HPI_SMLALBB_A1'
612 mask
, match
= a32_opcode('xxxx_0001_0100_xxxx__xxxx_xxxx_1xx0_xxxx')
614 class HPI_SMLALD_T1(MinorFUTiming
):
615 description
= 'HPI_SMLALD_T1'
616 mask
, match
= t32_opcode('1111_1011_1100_xxxx__xxxx_xxxx_110x_xxxx')
617 class HPI_SMLALD_A1(MinorFUTiming
):
618 description
= 'HPI_SMLALD_A1'
619 mask
, match
= a32_opcode('xxxx_0111_0100_xxxx__xxxx_xxxx_00x1_xxxx')
621 class HPI_SMLAWB_T1(MinorFUTiming
):
622 description
= 'HPI_SMLAWB_T1'
623 mask
, match
= t32_opcode('1111_1011_0011_xxxx__xxxx_xxxx_000x_xxxx')
624 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
626 class HPI_SMLAWB_A1(MinorFUTiming
):
627 description
= 'HPI_SMLAWB_A1'
628 mask
, match
= a32_opcode('xxxx_0001_0010_xxxx__xxxx_xxxx_1x00_xxxx')
629 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
631 class HPI_SMLSD_A1(MinorFUTiming
):
632 description
= 'HPI_SMLSD_A1'
633 mask
, match
= a32_opcode('xxxx_0111_0000_xxxx__xxxx_xxxx_01x1_xxxx')
635 class HPI_SMLSLD_T1(MinorFUTiming
):
636 description
= 'HPI_SMLSLD_T1'
637 mask
, match
= t32_opcode('1111_1011_1101_xxxx__xxxx_xxxx_110x_xxxx')
638 class HPI_SMLSLD_A1(MinorFUTiming
):
639 description
= 'HPI_SMLSLD_A1'
640 mask
, match
= a32_opcode('xxxx_0111_0100_xxxx__xxxx_xxxx_01x1_xxxx')
642 class HPI_SMMLA_T1(MinorFUTiming
):
643 description
= 'HPI_SMMLA_T1'
644 mask
, match
= t32_opcode('1111_1011_0101_xxxx__xxxx_xxxx_000x_xxxx')
646 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
648 class HPI_SMMLA_A1(MinorFUTiming
):
649 description
= 'HPI_SMMLA_A1'
650 # Note that this must be after the encoding for SMMUL
651 mask
, match
= a32_opcode('xxxx_0111_0101_xxxx__xxxx_xxxx_00x1_xxxx')
653 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
655 class HPI_SMMLS_T1(MinorFUTiming
):
656 description
= 'HPI_SMMLS_T1'
657 mask
, match
= t32_opcode('1111_1011_0110_xxxx__xxxx_xxxx_000x_xxxx')
658 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
660 class HPI_SMMLS_A1(MinorFUTiming
):
661 description
= 'HPI_SMMLS_A1'
662 mask
, match
= a32_opcode('xxxx_0111_0101_xxxx__xxxx_xxxx_11x1_xxxx')
663 srcRegsRelativeLats
= [0, 0, 0, 2, 0, 0, 0]
665 class HPI_SMMUL_T1(MinorFUTiming
):
666 description
= 'HPI_SMMUL_T1'
667 mask
, match
= t32_opcode('1111_1011_0101_xxxx__1111_xxxx_000x_xxxx')
668 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0]
670 class HPI_SMMUL_A1(MinorFUTiming
):
671 description
= 'HPI_SMMUL_A1'
672 mask
, match
= a32_opcode('xxxx_0111_0101_xxxx__1111_xxxx_00x1_xxxx')
673 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0]
675 class HPI_SMUAD_T1(MinorFUTiming
):
676 description
= 'HPI_SMUAD_T1'
677 mask
, match
= t32_opcode('1111_1011_0010_xxxx__1111_xxxx_000x_xxxx')
678 class HPI_SMUAD_A1(MinorFUTiming
):
679 description
= 'HPI_SMUAD_A1'
680 mask
, match
= a32_opcode('xxxx_0111_0000_xxxx__1111_xxxx_00x1_xxxx')
682 class HPI_SMULBB_T1(MinorFUTiming
):
683 description
= 'HPI_SMULBB_T1'
684 mask
, match
= t32_opcode('1111_1011_0001_xxxx__1111_xxxx_00xx_xxxx')
685 class HPI_SMULBB_A1(MinorFUTiming
):
686 description
= 'HPI_SMULBB_A1'
687 mask
, match
= a32_opcode('xxxx_0001_0110_xxxx__xxxx_xxxx_1xx0_xxxx')
689 class HPI_SMULL_T1(MinorFUTiming
):
690 description
= 'HPI_SMULL_T1'
691 mask
, match
= t32_opcode('1111_1011_1000_xxxx__xxxx_xxxx_0000_xxxx')
692 class HPI_SMULL_A1(MinorFUTiming
):
693 description
= 'HPI_SMULL_A1'
694 mask
, match
= a32_opcode('xxxx_0000_110x_xxxx__xxxx_xxxx_1001_xxxx')
696 class HPI_SMULWB_T1(MinorFUTiming
):
697 description
= 'HPI_SMULWB_T1'
698 mask
, match
= t32_opcode('1111_1011_0011_xxxx__1111_xxxx_000x_xxxx')
699 class HPI_SMULWB_A1(MinorFUTiming
):
700 description
= 'HPI_SMULWB_A1'
701 mask
, match
= a32_opcode('xxxx_0001_0010_xxxx__xxxx_xxxx_1x10_xxxx')
703 class HPI_SMUSD_T1(MinorFUTiming
):
704 description
= 'HPI_SMUSD_T1'
705 mask
, match
= t32_opcode('1111_1011_0100_xxxx__1111_xxxx_000x_xxxx')
706 class HPI_SMUSD_A1(MinorFUTiming
):
707 description
= 'HPI_SMUSD_A1'
708 mask
, match
= a32_opcode('xxxx_0111_0000_xxxx__1111_xxxx_01x1_xxxx')
710 class HPI_SSAT_USAT_no_shift_A1(MinorFUTiming
):
711 description
= 'HPI_SSAT_USAT_no_shift_A1'
712 # Order *before* shift
713 mask
, match
= a32_opcode('xxxx_0110_1x1x_xxxx__xxxx_0000_0001_xxxx')
714 srcRegsRelativeLats
= [0, 0, 0, 2, 0]
716 class HPI_SSAT_USAT_shift_A1(MinorFUTiming
):
717 description
= 'HPI_SSAT_USAT_shift_A1'
719 mask
, match
= a32_opcode('xxxx_0110_1x1x_xxxx__xxxx_xxxx_xx01_xxxx')
720 srcRegsRelativeLats
= [0, 0, 0, 1, 0]
722 class HPI_SSAT16_USAT16_A1(MinorFUTiming
):
723 description
= 'HPI_SSAT16_USAT16_A1'
724 mask
, match
= a32_opcode('xxxx_0110_1x10_xxxx__xxxx_xxxx_0011_xxxx')
725 srcRegsRelativeLats
= [0, 0, 0, 2, 0]
727 class HPI_SXTAB_T1(MinorFUTiming
):
728 description
= 'HPI_SXTAB_T1'
729 mask
, match
= t32_opcode('1111_1010_0100_xxxx__1111_xxxx_1xxx_xxxx')
730 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
732 class HPI_SXTAB_SXTAB16_SXTAH_UXTAB_UXTAB16_UXTAH_A1(MinorFUTiming
):
733 description
= 'HPI_SXTAB_SXTAB16_SXTAH_UXTAB_UXTAB16_UXTAH_A1'
734 # Place AFTER HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1
735 # e6[9d][^f]0070 are undefined
736 mask
, match
= a32_opcode('xxxx_0110_1xxx_xxxx__xxxx_xxxx_0111_xxxx')
737 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
739 class HPI_SXTAB16_T1(MinorFUTiming
):
740 description
= 'HPI_SXTAB16_T1'
741 mask
, match
= t32_opcode('1111_1010_0010_xxxx__1111_xxxx_1xxx_xxxx')
742 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
744 class HPI_SXTAH_T1(MinorFUTiming
):
745 description
= 'HPI_SXTAH_T1'
746 mask
, match
= t32_opcode('1111_1010_0000_xxxx__1111_xxxx_1xxx_xxxx')
747 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
749 class HPI_SXTB_T1(MinorFUTiming
):
750 description
= 'HPI_SXTB_T1'
751 mask
, match
= t16_opcode('1011_0010_01xx_xxxx')
752 class HPI_SXTB_T2(MinorFUTiming
):
753 description
= 'HPI_SXTB_T2'
754 mask
, match
= t32_opcode('1111_1010_0100_1111__1111_xxxx_1xxx_xxxx')
755 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
757 class HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1(MinorFUTiming
):
758 description
= 'HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1'
759 # e6[9d]f0070 are undefined
760 mask
, match
= a32_opcode('xxxx_0110_1xxx_1111__xxxx_xxxx_0111_xxxx')
761 srcRegsRelativeLats
= [0, 0, 0, 2, 0]
763 class HPI_SXTB16_T1(MinorFUTiming
):
764 description
= 'HPI_SXTB16_T1'
765 mask
, match
= t32_opcode('1111_1010_0010_1111__1111_xxxx_1xxx_xxxx')
766 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
768 class HPI_SXTH_T1(MinorFUTiming
):
769 description
= 'HPI_SXTH_T1'
770 mask
, match
= t16_opcode('1011_0010_00xx_xxxx')
771 class HPI_SXTH_T2(MinorFUTiming
):
772 description
= 'HPI_SXTH_T2'
773 mask
, match
= t32_opcode('1111_1010_0000_1111__1111_xxxx_1xxx_xxxx')
774 srcRegsRelativeLats
= [0, 0, 0, 1, 2, 0]
776 class HPI_UDIV_T1(MinorFUTiming
):
777 description
= 'HPI_UDIV_T1'
778 mask
, match
= t32_opcode('1111_1011_1011_xxxx__xxxx_xxxx_1111_xxxx')
780 udiv_lat_expr
= expr_top(let([
781 ('left', int_reg(src(4))),
782 ('right', int_reg(src(3))),
783 ('left_size', un('SizeInBits', ref('left'))),
784 ('right_size', un('SizeInBits',
785 bin('UDiv', ref('right'), literal(2)))),
786 ('left_minus_right', if_expr(
787 bin('SLessThan', ref('left_size'), ref('right_size')),
789 bin('Sub', ref('left_size'), ref('right_size'))))
791 if_expr(bin('Equal', ref('right'), literal(0)),
793 bin('UDiv', ref('left_minus_right'), literal(4)))
796 class HPI_UDIV_A1(MinorFUTiming
):
797 description
= 'HPI_UDIV_A1'
798 mask
, match
= a32_opcode('xxxx_0111_0011_xxxx__xxxx_xxxx_0001_xxxx')
800 srcRegsRelativeLats
= []
801 extraCommitLatExpr
= udiv_lat_expr
803 class HPI_UMAAL_T1(MinorFUTiming
):
804 description
= 'HPI_UMAAL_T1'
805 mask
, match
= t32_opcode('1111_1011_1110_xxxx__xxxx_xxxx_0110_xxxx')
806 # z, z, z, dlo, dhi, l, r
808 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 0, 0]
810 class HPI_UMAAL_A1(MinorFUTiming
):
811 description
= 'HPI_UMAAL_A1'
812 mask
, match
= a32_opcode('xxxx_0000_0100_xxxx__xxxx_xxxx_1001_xxxx')
813 # z, z, z, dlo, dhi, l, r
815 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 0, 0]
817 class HPI_UMLAL_T1(MinorFUTiming
):
818 description
= 'HPI_UMLAL_T1'
819 mask
, match
= t32_opcode('1111_1011_1110_xxxx__xxxx_xxxx_0000_xxxx')
821 class HPI_UMLAL_A1(MinorFUTiming
):
822 description
= 'HPI_UMLAL_A1'
823 mask
, match
= t32_opcode('xxxx_0000_101x_xxxx__xxxx_xxxx_1001_xxxx')
825 class HPI_UMULL_T1(MinorFUTiming
):
826 description
= 'HPI_UMULL_T1'
827 mask
, match
= t32_opcode('1111_1011_1010_xxxx__xxxx_xxxx_0000_xxxx')
829 class HPI_UMULL_A1(MinorFUTiming
):
830 description
= 'HPI_UMULL_A1'
831 mask
, match
= a32_opcode('xxxx_0000_100x_xxxx__xxxx_xxxx_1001_xxxx')
833 class HPI_USAD8_USADA8_A1(MinorFUTiming
):
834 description
= 'HPI_USAD8_USADA8_A1'
835 mask
, match
= a32_opcode('xxxx_0111_1000_xxxx__xxxx_xxxx_0001_xxxx')
836 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 2, 0]
838 class HPI_USAD8_USADA8_A1_Suppress(MinorFUTiming
):
839 description
= 'HPI_USAD8_USADA8_A1_Suppress'
840 mask
, match
= a32_opcode('xxxx_0111_1000_xxxx__xxxx_xxxx_0001_xxxx')
841 srcRegsRelativeLats
= []
844 class HPI_VMOV_immediate_A1(MinorFUTiming
):
845 description
= 'HPI_VMOV_register_A1'
846 mask
, match
= a32_opcode('1111_0010_0x10_xxxx_xxxx_0001_xxx1_xxxx')
847 # cpsr, z, z, z, hcptr, nsacr, cpacr, fpexc, scr
848 srcRegsRelativeLats
= [5, 5, 5, 5, 5, 5, 5, 5, 5, 0]
850 class HPI_VMRS_A1(MinorFUTiming
):
851 description
= 'HPI_VMRS_A1'
852 mask
, match
= a32_opcode('xxxx_1110_1111_0001_xxxx_1010_xxx1_xxxx')
853 # cpsr,z,z,z,hcptr,nsacr,cpacr,scr,r42
854 srcRegsRelativeLats
= [5, 5, 5, 5, 5, 5, 5, 5, 5, 0]
856 class HPI_VMOV_register_A2(MinorFUTiming
):
857 description
= 'HPI_VMOV_register_A2'
858 mask
, match
= a32_opcode('xxxx_1110_1x11_0000_xxxx_101x_01x0_xxxx')
859 # cpsr, z, r39, z, hcptr, nsacr, cpacr, fpexc, scr, f4, f5, f0, f1
860 srcRegsRelativeLats
= \
861 [5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 0]
863 # VADD.I16 D/VADD.F32 D/VADD.I8 D/VADD.I32 D
864 class HPI_VADD2H_A32(MinorFUTiming
):
865 description
= 'Vadd2hALU'
866 mask
, match
= a32_opcode('1111_0010_0xxx_xxxx__xxxx_1000_xxx0_xxxx')
867 # cpsr, z, z, z, cpacr, fpexc, l0, r0, l1, r1, l2, r2, l3, r3 (for vadd2h)
868 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
870 # VAQQHN.I16 Q/VAQQHN.I32 Q/VAQQHN.I64 Q
871 class HPI_VADDHN_A32(MinorFUTiming
):
872 description
= 'VaddhnALU'
873 mask
, match
= a32_opcode('1111_0010_1xxx_xxxx__xxxx_0100_x0x0_xxxx')
874 # cpsr, z, z, z, cpacr, fpexc, l0, l1, l2, l3, r0, r1, r2, r3
875 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
877 class HPI_VADDL_A32(MinorFUTiming
):
878 description
= 'VaddlALU'
879 mask
, match
= a32_opcode('1111_001x_1xxx_xxxx__xxxx_0000_x0x0_xxxx')
880 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
882 class HPI_VADDW_A32(MinorFUTiming
):
883 description
= 'HPI_VADDW_A32'
884 mask
, match
= a32_opcode('1111_001x_1xxx_xxxx__xxxx_0001_x0x0_xxxx')
885 # cpsr, z, z, z, cpacr, fpexc, l0, l1, l2, l3, r0, r1
886 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 3, 3, 0]
888 # VHADD/VHSUB S8,S16,S32,U8,U16,U32 Q and D
889 class HPI_VHADD_A32(MinorFUTiming
):
890 description
= 'HPI_VHADD_A32'
891 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_00x0_xxx0_xxxx')
892 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
894 class HPI_VPADAL_A32(MinorFUTiming
):
895 description
= 'VpadalALU'
896 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_0110_xxx0_xxxx')
897 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0]
900 class HPI_VPADDH_A32(MinorFUTiming
):
901 description
= 'VpaddhALU'
902 mask
, match
= a32_opcode('1111_0010_0xxx_xxxx__xxxx_1011_xxx1_xxxx')
903 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
906 class HPI_VPADDS_A32(MinorFUTiming
):
907 description
= 'VpaddsALU'
908 mask
, match
= a32_opcode('1111_0011_0x0x_xxxx__xxxx_1101_xxx0_xxxx')
909 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0]
912 class HPI_VPADDL_A32(MinorFUTiming
):
913 description
= 'VpaddlALU'
914 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_0010_xxx0_xxxx')
915 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
918 class HPI_VRADDHN_A32(MinorFUTiming
):
919 description
= 'HPI_VRADDHN_A32'
920 mask
, match
= a32_opcode('1111_0011_1xxx_xxxx__xxxx_0100_x0x0_xxxx')
921 # cpsr, z, z, z, cpacr, fpexc, l0, l1, l2, l3, r0, r1, r2, r3
922 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
924 class HPI_VRHADD_A32(MinorFUTiming
):
925 description
= 'VrhaddALU'
926 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_0001_xxx0_xxxx')
927 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
929 class HPI_VQADD_A32(MinorFUTiming
):
930 description
= 'VqaddALU'
931 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_0000_xxx1_xxxx')
932 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
934 class HPI_VANDQ_A32(MinorFUTiming
):
935 description
= 'VandqALU'
936 mask
, match
= a32_opcode('1111_0010_0x00_xxxx__xxxx_0001_xxx1_xxxx')
937 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0]
940 class HPI_VMULI_A32(MinorFUTiming
):
941 description
= 'VmuliALU'
942 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_1001_xxx1_xxxx')
943 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0]
946 class HPI_VBIC_A32(MinorFUTiming
):
947 description
= 'VbicALU'
948 mask
, match
= a32_opcode('1111_0010_0x01_xxxx__xxxx_0001_xxx1_xxxx')
949 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0]
952 class HPI_VBIF_ETC_A32(MinorFUTiming
):
953 description
= 'VbifALU'
954 mask
, match
= a32_opcode('1111_0011_0xxx_xxxx__xxxx_0001_xxx1_xxxx')
955 srcRegsRelativeLats
= \
956 [0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0]
958 class HPI_VACGE_A32(MinorFUTiming
):
959 description
= 'VacgeALU'
960 mask
, match
= a32_opcode('1111_0011_0xxx_xxxx__xxxx_1110_xxx1_xxxx')
961 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
964 class HPI_VCEQ_A32(MinorFUTiming
):
965 description
= 'VceqALU'
966 mask
, match
= a32_opcode('1111_0010_0x0x_xxxx__xxxx_1110_xxx0_xxxx')
967 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
969 # VCEQ.[IS]... register
970 class HPI_VCEQI_A32(MinorFUTiming
):
971 description
= 'VceqiALU'
972 mask
, match
= a32_opcode('1111_0011_0xxx_xxxx__xxxx_1000_xxx1_xxxx')
973 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
975 # VCEQ.[IS]... immediate
976 class HPI_VCEQII_A32(MinorFUTiming
):
977 description
= 'HPI_VCEQII_A32'
978 mask
, match
= a32_opcode('1111_0011_1x11_xx01__xxxx_0x01_0xx0_xxxx')
979 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
981 class HPI_VTST_A32(MinorFUTiming
):
982 description
= 'HPI_VTST_A32'
983 mask
, match
= a32_opcode('1111_0010_0xxx_xxxx__xxxx_1000_xxx1_xxxx')
984 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0]
986 class HPI_VCLZ_A32(MinorFUTiming
):
987 description
= 'HPI_VCLZ_A32'
988 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_0100_1xx0_xxxx')
989 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
991 class HPI_VCNT_A32(MinorFUTiming
):
992 description
= 'HPI_VCNT_A32'
993 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_0101_0xx0_xxxx')
994 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
996 class HPI_VEXT_A32(MinorFUTiming
):
997 description
= 'HPI_VCNT_A32'
998 mask
, match
= a32_opcode('1111_0010_1x11_xxxx__xxxx_xxxx_xxx0_xxxx')
999 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1002 class HPI_VMAXI_A32(MinorFUTiming
):
1003 description
= 'HPI_VMAXI_A32'
1004 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_0110_xxxx_xxxx')
1005 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1008 class HPI_VMAXS_A32(MinorFUTiming
):
1009 description
= 'HPI_VMAXS_A32'
1010 mask
, match
= a32_opcode('1111_0010_0xxx_xxxx__xxxx_1111_xxx0_xxxx')
1011 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0]
1014 class HPI_VNEGI_A32(MinorFUTiming
):
1015 description
= 'HPI_VNEGI_A32'
1016 mask
, match
= a32_opcode('1111_0011_1x11_xx01__xxxx_0x11_1xx0_xxxx')
1017 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1020 class HPI_VNEGF_A32(MinorFUTiming
):
1021 description
= 'HPI_VNEGF_A32'
1022 mask
, match
= a32_opcode('xxxx_1110_1x11_0001__xxxx_101x_01x0_xxxx')
1023 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0]
1025 # VREV16 VREV32 VREV64
1026 class HPI_VREVN_A32(MinorFUTiming
):
1027 description
= 'HPI_VREVN_A32'
1028 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_000x_xxx0_xxxx')
1029 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1031 class HPI_VQNEG_A32(MinorFUTiming
):
1032 description
= 'HPI_VQNEG_A32'
1033 mask
, match
= a32_opcode('1111_0011_1x11_xx00__xxxx_0111_1xx0_xxxx')
1034 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0]
1036 class HPI_VSWP_A32(MinorFUTiming
):
1037 description
= 'HPI_VSWP_A32'
1038 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0000_0xx0_xxxx')
1039 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1041 class HPI_VTRN_A32(MinorFUTiming
):
1042 description
= 'HPI_VTRN_A32'
1043 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0000_1xx0_xxxx')
1044 # cpsr, z, z, z, cpact, fpexc, o0, d0, o1, d1, o2, d2, o3, d3
1045 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0]
1048 class HPI_VQMOVN_A32(MinorFUTiming
):
1049 description
= 'HPI_VQMOVN_A32'
1050 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0010_xxx0_xxxx')
1051 # cpsr, z, z, z, cpact, fpexc, o[0], o[1], o[2], o[3], fpscr
1052 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 0]
1055 class HPI_VUZP_A32(MinorFUTiming
):
1056 description
= 'HPI_VUZP_A32'
1057 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0001_00x0_xxxx')
1058 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 3, 3, 0]
1061 class HPI_VDIV32_A32(MinorFUTiming
):
1062 description
= 'HPI_VDIV32_A32'
1063 mask
, match
= a32_opcode('xxxx_1110_1x00_xxxx__xxxx_1010_x0x0_xxxx')
1064 # cpsr, z, z, z, cpact, fpexc, fpscr_exc, l, r
1066 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 20, 4, 4, 0]
1069 class HPI_VDIV64_A32(MinorFUTiming
):
1070 description
= 'HPI_VDIV64_A32'
1071 mask
, match
= a32_opcode('xxxx_1110_1x00_xxxx__xxxx_1011_x0x0_xxxx')
1072 # cpsr, z, z, z, cpact, fpexc, fpscr_exc, l, r
1074 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 20, 4, 4, 0]
1076 class HPI_VZIP_A32(MinorFUTiming
):
1077 description
= 'HPI_VZIP_A32'
1078 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0001_1xx0_xxxx')
1079 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0]
1082 class HPI_VPMAX_A32(MinorFUTiming
):
1083 description
= 'HPI_VPMAX_A32'
1084 mask
, match
= a32_opcode('1111_001x_0xxx_xxxx__xxxx_1010_xxxx_xxxx')
1085 # cpsr, z, z, z, cpact, fpexc, l0, r0, l1, r1, fpscr
1086 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 0]
1089 class HPI_VPMAXF_A32(MinorFUTiming
):
1090 description
= 'HPI_VPMAXF_A32'
1091 mask
, match
= a32_opcode('1111_0011_0xxx_xxxx__xxxx_1111_xxx0_xxxx')
1092 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 0]
1094 class HPI_VMOVN_A32(MinorFUTiming
):
1095 description
= 'HPI_VMOVN_A32'
1096 mask
, match
= a32_opcode('1111_0011_1x11_xx10__xxxx_0010_00x0_xxxx')
1097 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0]
1099 class HPI_VMOVL_A32(MinorFUTiming
):
1100 description
= 'HPI_VMOVL_A32'
1101 mask
, match
= a32_opcode('1111_001x_1xxx_x000__xxxx_1010_00x1_xxxx')
1102 srcRegsRelativeLats
= [0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0]
1105 class HPI_VSQRT64_A32(MinorFUTiming
):
1106 description
= 'HPI_VSQRT64_A32'
1107 mask
, match
= a32_opcode('xxxx_1110_1x11_0001__xxxx_1011_11x0_xxxx')
1109 srcRegsRelativeLats
= []
1112 class HPI_VSQRT32_A32(MinorFUTiming
):
1113 description
= 'HPI_VSQRT32_A32'
1114 mask
, match
= a32_opcode('xxxx_1110_1x11_0001__xxxx_1010_11x0_xxxx')
1116 srcRegsRelativeLats
= []
1118 class HPI_FloatSimdFU(MinorFU
):
1119 opClasses
= minorMakeOpClassSet([
1120 'FloatAdd', 'FloatCmp', 'FloatCvt', 'FloatMult', 'FloatDiv',
1121 'FloatSqrt', 'FloatMisc', 'FloatMultAcc',
1122 'SimdAdd', 'SimdAddAcc', 'SimdAlu', 'SimdCmp', 'SimdCvt',
1123 'SimdMisc', 'SimdMult', 'SimdMultAcc', 'SimdShift', 'SimdShiftAcc',
1124 'SimdSqrt', 'SimdFloatAdd', 'SimdFloatAlu', 'SimdFloatCmp',
1125 'SimdFloatCvt', 'SimdFloatDiv', 'SimdFloatMisc', 'SimdFloatMult',
1126 'SimdFloatMultAcc', 'SimdFloatSqrt'])
1129 # VUZP and VZIP must be before VADDW/L
1130 HPI_VUZP_A32(), HPI_VZIP_A32(),
1131 HPI_VADD2H_A32(), HPI_VADDHN_A32(),
1132 HPI_VADDL_A32(), HPI_VADDW_A32(),
1133 HPI_VHADD_A32(), HPI_VPADAL_A32(),
1134 HPI_VPADDH_A32(), HPI_VPADDS_A32(),
1135 HPI_VPADDL_A32(), HPI_VRADDHN_A32(),
1136 HPI_VRHADD_A32(), HPI_VQADD_A32(),
1137 HPI_VANDQ_A32(), HPI_VBIC_A32(),
1138 HPI_VBIF_ETC_A32(), HPI_VACGE_A32(),
1139 HPI_VCEQ_A32(), HPI_VCEQI_A32(),
1140 HPI_VCEQII_A32(), HPI_VTST_A32(),
1141 HPI_VCLZ_A32(), HPI_VCNT_A32(),
1142 HPI_VEXT_A32(), HPI_VMAXI_A32(),
1143 HPI_VMAXS_A32(), HPI_VNEGI_A32(),
1144 HPI_VNEGF_A32(), HPI_VREVN_A32(),
1145 HPI_VQNEG_A32(), HPI_VSWP_A32(),
1146 HPI_VTRN_A32(), HPI_VPMAX_A32(),
1147 HPI_VPMAXF_A32(), HPI_VMOVN_A32(),
1149 HPI_VMOV_immediate_A1(),
1150 HPI_VMOV_register_A2(),
1151 HPI_VQMOVN_A32(), HPI_VMOVL_A32(),
1152 HPI_VDIV32_A32(), HPI_VDIV64_A32(),
1153 HPI_VSQRT32_A32(), HPI_VSQRT64_A32(),
1159 HPI_ADD_SUB_vector_scalar_A64(),
1160 HPI_ADD_SUB_vector_vector_A64(),
1161 HPI_FDIV_scalar_32_A64(), HPI_FDIV_scalar_64_A64(),
1162 HPI_DefaultA64Vfp(),
1167 class HPI_IntFU(MinorFU
):
1168 opClasses
= minorMakeOpClassSet(['IntAlu'])
1169 # IMPORTANT! Keep the order below, add new entries *at the head*
1171 HPI_SSAT_USAT_no_shift_A1(),
1172 HPI_SSAT_USAT_shift_A1(),
1173 HPI_SSAT16_USAT16_A1(),
1177 HPI_QASX_QSAX_UQASX_UQSAX_T1(),
1182 HPI_QDADD_QDSUB_A1(),
1183 HPI_QDADD_QDSUB_T1(),
1184 HPI_SASX_SHASX_UASX_UHASX_A1(),
1185 HPI_SHSAX_SSAX_UHSAX_USAX_A1(),
1186 HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1(),
1188 # Must be after HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1
1189 HPI_SXTAB_SXTAB16_SXTAH_UXTAB_UXTAB16_UXTAH_A1(),
1205 HPI_USAD8_USADA8_A1(),
1209 HPI_CMN_register_A1(),
1210 HPI_CMN_immediate_A1(),
1211 HPI_CMP_register_A1(),
1212 HPI_CMP_immediate_A1(),
1214 HPI_DataProcessingNoShift(),
1215 HPI_DataProcessingMovShiftr(),
1216 HPI_DataProcessingMayShift(),
1220 HPI_DefaultA64Int(),
1224 class HPI_Int2FU(MinorFU
):
1225 opClasses
= minorMakeOpClassSet(['IntAlu'])
1226 # IMPORTANT! Keep the order below, add new entries *at the head*
1228 HPI_SSAT_USAT_no_shift_A1(),
1229 HPI_SSAT_USAT_shift_A1(),
1230 HPI_SSAT16_USAT16_A1(),
1234 HPI_QASX_QSAX_UQASX_UQSAX_T1(),
1239 HPI_QDADD_QDSUB_A1(),
1240 HPI_QDADD_QDSUB_T1(),
1241 HPI_SASX_SHASX_UASX_UHASX_A1(),
1242 HPI_SHSAX_SSAX_UHSAX_USAX_A1(),
1243 HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1(),
1245 # Must be after HPI_SXTB_SXTB16_SXTH_UXTB_UXTB16_UXTH_A1
1246 HPI_SXTAB_SXTAB16_SXTAH_UXTAB_UXTAB16_UXTAH_A1(),
1258 HPI_SEL_A1_Suppress(),
1262 HPI_USAD8_USADA8_A1_Suppress(),
1266 HPI_CMN_register_A1(), # Need to check for shift
1267 HPI_CMN_immediate_A1(),
1268 HPI_CMP_register_A1(), # Need to check for shift
1269 HPI_CMP_immediate_A1(),
1271 HPI_DataProcessingNoShift(),
1272 HPI_DataProcessingAllowShifti(),
1273 # HPI_DataProcessingAllowMovShiftr(),
1275 # Data processing ops that match SuppressShift but are *not*
1276 # to be suppressed here
1279 HPI_DataProcessingSuppressShift(),
1280 # Can you dual issue a branch?
1281 # HPI_DataProcessingSuppressBranch(),
1284 HPI_DefaultA64Int(),
1288 class HPI_IntMulFU(MinorFU
):
1289 opClasses
= minorMakeOpClassSet(['IntMult'])
1291 HPI_MLA_A1(), HPI_MLA_T1(),
1292 HPI_MLS_A1(), HPI_MLS_T1(),
1293 HPI_SMLABB_A1(), HPI_SMLABB_T1(),
1294 HPI_SMLAWB_A1(), HPI_SMLAWB_T1(),
1295 HPI_SMLAD_A1(), HPI_SMLAD_T1(),
1296 HPI_SMMUL_A1(), HPI_SMMUL_T1(),
1297 # SMMUL_A1 must be before SMMLA_A1
1298 HPI_SMMLA_A1(), HPI_SMMLA_T1(),
1299 HPI_SMMLS_A1(), HPI_SMMLS_T1(),
1300 HPI_UMAAL_A1(), HPI_UMAAL_T1(),
1303 HPI_DefaultA64Mul(),
1306 cantForwardFromFUIndices
= [0, 1, 5] # Int1, Int2, Mem
1308 class HPI_IntDivFU(MinorFU
):
1309 opClasses
= minorMakeOpClassSet(['IntDiv'])
1310 timings
= [HPI_SDIV_A1(), HPI_UDIV_A1(),
1315 class HPI_MemFU(MinorFU
):
1316 opClasses
= minorMakeOpClassSet(['MemRead', 'MemWrite', 'FloatMemRead',
1318 timings
= [HPI_DefaultMem(), HPI_DefaultMem64()]
1320 cantForwardFromFUIndices
= [5] # Mem (this FU)
1322 class HPI_MiscFU(MinorFU
):
1323 opClasses
= minorMakeOpClassSet(['IprAccess', 'InstPrefetch'])
1326 class HPI_FUPool(MinorFUPool
):
1327 funcUnits
= [HPI_IntFU(), # 0
1331 HPI_FloatSimdFU(), # 4
1336 class HPI_DTB(ArmTLB
):
1339 class HPI_ITB(ArmTLB
):
1342 class HPI_WalkCache(Cache
):
1345 response_latency
= 4
1352 class HPI_BP(TournamentBP
):
1353 localPredictorSize
= 64
1355 localHistoryTableSize
= 64
1356 globalPredictorSize
= 1024
1358 choicePredictorSize
= 1024
1365 class HPI_ICache(Cache
):
1368 response_latency
= 1
1373 # No prefetcher, this is handled by the core
1375 class HPI_DCache(Cache
):
1378 response_latency
= 1
1384 prefetcher
= StridePrefetcher(
1388 class HPI_L2(Cache
):
1391 response_latency
= 5
1399 class HPI(MinorCPU
):
1400 # Inherit the doc string from the module to avoid repeating it
1404 fetch1LineSnapWidth
= 0
1406 fetch1FetchLimit
= 1
1407 fetch1ToFetch2ForwardDelay
= 1
1408 fetch1ToFetch2BackwardDelay
= 1
1410 fetch2InputBufferSize
= 2
1411 fetch2ToDecodeForwardDelay
= 1
1412 fetch2CycleInput
= True
1414 decodeInputBufferSize
= 3
1415 decodeToExecuteForwardDelay
= 1
1416 decodeInputWidth
= 2
1417 decodeCycleInput
= True
1419 executeInputWidth
= 2
1420 executeCycleInput
= True
1421 executeIssueLimit
= 2
1423 # Only allow one ld/st to be issued but the second ld/st FU allows
1424 # back-to-back loads
1425 executeMemoryIssueLimit
= 1
1427 executeCommitLimit
= 2
1428 executeMemoryCommitLimit
= 1
1429 executeInputBufferSize
= 7
1431 executeMaxAccessesInMemory
= 2
1433 executeLSQMaxStoreBufferStoresPerCycle
= 2
1434 executeLSQRequestsQueueSize
= 1
1435 executeLSQTransfersQueueSize
= 2
1436 executeLSQStoreBufferSize
= 5
1437 executeBranchDelay
= 1
1438 executeFuncUnits
= HPI_FUPool()
1439 executeSetTraceTimeOnCommit
= True
1440 executeSetTraceTimeOnIssue
= False
1442 executeAllowEarlyMemoryIssue
= True
1446 branchPred
= HPI_BP()
1453 "HPI_ITB", "HPI_DTB", "HPI_WalkCache",
1454 "HPI_ICache", "HPI_DCache", "HPI_L2",