gem5  v21.1.0.2
integer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 The University of Edinburgh
3  * Copyright (c) 2021 IBM Corporation
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __ARCH_POWER_INSTS_INTEGER_HH__
31 #define __ARCH_POWER_INSTS_INTEGER_HH__
32 
34 #include "arch/power/regs/misc.hh"
35 #include "base/bitfield.hh"
36 #include "base/cprintf.hh"
37 
38 namespace gem5
39 {
40 
41 namespace PowerISA
42 {
43 
54 class IntOp : public PowerStaticInst
55 {
56  protected:
57 
58  bool rc;
59  bool oe;
60 
61  // Needed for srawi only
62  uint32_t sh;
63 
65  IntOp(const char *mnem, MachInst _machInst, OpClass __opClass)
66  : PowerStaticInst(mnem, _machInst, __opClass),
67  rc(machInst.rc),
68  oe(machInst.oe)
69  {
70  }
71 
72  /* Compute the CR (condition register) field using signed comparison */
73  inline uint32_t
74  makeCRFieldSigned(int64_t a, int64_t b, bool so) const
75  {
76  Cr cr = 0;
77 
78  if (a < b) { cr.cr0.lt = 1; }
79  else if (a > b) { cr.cr0.gt = 1; }
80  else { cr.cr0.eq = 1; }
81  if (so) { cr.cr0.so = 1; }
82 
83  return cr.cr0;
84  }
85 
86  /* Compute the CR (condition register) field using unsigned comparison */
87  inline uint32_t
88  makeCRFieldUnsigned(uint64_t a, uint64_t b, bool so) const
89  {
90  Cr cr = 0;
91 
92  if (a < b) { cr.cr0.lt = 1; }
93  else if (a > b) { cr.cr0.gt = 1; }
94  else { cr.cr0.eq = 1; }
95  if (so) { cr.cr0.so = 1; }
96 
97  return cr.cr0;
98  }
99 
100  std::string generateDisassembly(
101  Addr pc, const loader::SymbolTable *symtab) const override;
102 };
103 
104 
108 class IntImmOp : public IntOp
109 {
110  protected:
111 
112  int32_t si;
113  uint32_t ui;
114 
116  IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
117  : IntOp(mnem, _machInst, __opClass),
118  si(sext<16>(machInst.si)),
119  ui(machInst.si)
120  {
121  }
122 
123  std::string generateDisassembly(
124  Addr pc, const loader::SymbolTable *symtab) const override;
125 };
126 
127 
131 class IntArithOp : public IntOp
132 {
133  protected:
134 
136  IntArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
137  : IntOp(mnem, _machInst, __opClass)
138  {
139  }
140 
141  /* Compute 128-bit sum of 128-bit to 64-bit unsigned integer addition */
142  inline std::tuple<uint64_t, uint64_t>
143  add(uint64_t ralo, uint64_t rahi, uint64_t rb) const
144  {
145  uint64_t slo, shi;
146  #if defined(__SIZEOF_INT128__)
147  __uint128_t ra = ((__uint128_t)rahi << 64) | ralo;
148  __uint128_t sum = ra + rb;
149  slo = sum;
150  shi = sum >> 64;
151  #else
152  shi = rahi + ((ralo + rb) < ralo);
153  slo = ralo + rb;
154  #endif
155  return std::make_tuple(slo, shi);
156  }
157 
158  /* Compute 128-bit sum of 128-bit to 64-bit signed integer addition */
159  inline std::tuple<uint64_t, int64_t>
160  add(uint64_t ralo, int64_t rahi, int64_t rb) const
161  {
162  uint64_t slo;
163  int64_t shi;
164  #if defined(__SIZEOF_INT128__)
165  __int128_t ra = ((__int128_t)rahi << 64) | ralo;
166  __int128_t sum = (__int128_t)ra + rb;
167  slo = sum;
168  shi = sum >> 64;
169  #else
170  if (rb < 0) {
171  shi = rahi - 1;
172  slo = ralo + rb;
173  if (slo < rb) {
174  shi++;
175  }
176  } else {
177  shi = rahi;
178  slo = ralo + rb;
179  if (slo < rb) {
180  shi++;
181  }
182  }
183  #endif
184  return std::make_tuple(slo, shi);
185  }
186 
191  inline std::tuple<uint64_t, uint64_t>
192  multiply(uint64_t ra, uint64_t rb) const
193  {
194  uint64_t plo, phi;
195  #if defined(__SIZEOF_INT128__)
196  __uint128_t prod = (__uint128_t)ra * rb;
197  plo = prod;
198  phi = prod >> 64;
199  #else
200  uint64_t ralo = (uint32_t)ra, rahi = ra >> 32;
201  uint64_t rblo = (uint32_t)rb, rbhi = rb >> 32;
202  uint64_t pp0 = ralo * rblo;
203  uint64_t pp1 = rahi * rblo;
204  uint64_t pp2 = ralo * rbhi;
205  uint64_t pp3 = rahi * rbhi;
206  uint64_t c = ((uint32_t)pp1) + ((uint32_t)pp2) + (pp0 >> 32);
207  phi = pp3 + (pp2 >> 32) + (pp1 >> 32) + (c >> 32);
208  plo = (c << 32) | ((uint32_t)pp0);
209  #endif
210  return std::make_tuple(plo, phi);
211  }
212 
213  /* Compute 128-bit product of 64-bit signed integer multiplication */
214  inline std::tuple<uint64_t, int64_t>
215  multiply(int64_t ra, int64_t rb) const
216  {
217  uint64_t plo, phi;
218  #if defined(__SIZEOF_INT128__)
219  __int128_t prod = (__int128_t)ra * rb;
220  plo = prod;
221  phi = prod >> 64;
222  #else
223  std::tie(plo, phi) = multiply((uint64_t)ra, (uint64_t)rb);
224  if (rb < 0) phi -= (uint64_t)ra;
225  if (ra < 0) phi -= (uint64_t)rb;
226  #endif
227  return std::make_tuple(plo, (int64_t)phi);
228  }
229 
234  inline std::tuple<uint64_t, uint64_t>
235  multiplyAdd(uint64_t ra, uint64_t rb, uint64_t rc) const
236  {
237  uint64_t rlo, rhi;
238  #if defined(__SIZEOF_INT128__)
239  __uint128_t res = ((__uint128_t)ra * rb) + rc;
240  rlo = res;
241  rhi = res >> 64;
242  #else
243  uint64_t plo, phi;
244  std::tie(plo, phi) = multiply(ra, rb);
245  std::tie(rlo, rhi) = add(plo, phi, rc);
246  #endif
247  return std::make_tuple(rlo, rhi);
248  }
249 
254  inline std::tuple<uint64_t, int64_t>
255  multiplyAdd(int64_t ra, int64_t rb, int64_t rc) const
256  {
257  uint64_t rlo;
258  int64_t rhi;
259  #if defined(__SIZEOF_INT128__)
260  __int128_t res = (__int128_t)ra * rb + rc;
261  rlo = res;
262  rhi = res >> 64;
263  #else
264  uint64_t plo;
265  int64_t phi;
266  std::tie(plo, phi) = multiply(ra, rb);
267  std::tie(rlo, rhi) = add(plo, phi, rc);
268  #endif
269  return std::make_tuple(rlo, rhi);
270  }
271 
277  inline std::tuple<bool, uint64_t, uint64_t>
278  divide(uint64_t ralo, uint64_t rahi, uint64_t rb) const
279  {
280  bool ov;
281  uint64_t q, r;
282  #if defined(__SIZEOF_INT128__)
283  if (rb == 0) {
284  ov = true;
285  } else {
286  __uint128_t ra = ((__uint128_t)rahi << 64) | ralo;
287  __uint128_t res = ra / rb;
288  q = res;
289  r = ra % rb;
290  ov = res > UINT64_MAX;
291  }
292  #else
293  uint64_t c = 0;
294 
295  if (rb == 0) {
296  ov = true;
297  } else if (rahi == 0) {
298  q = ralo / rb;
299  r = ralo % rb;
300  ov = false;
301  } else if (rahi >= rb) {
302  ov = true;
303  } else {
304  for (int i = 0; i < 64; ++i) {
305  c = rahi >> 63;
306  rahi = (rahi << 1) | (ralo >> 63);
307  if (c || (rahi >= rb)) {
308  rahi -= rb;
309  c = 1;
310  } else {
311  c = 0;
312  }
313  ralo = (ralo << 1) | c;
314  }
315  q = ralo;
316  r = rahi;
317  ov = false;
318  }
319  #endif
320  return std::make_tuple(ov, q, r);
321  }
322 
327  inline std::tuple<bool, int64_t, int64_t>
328  divide(uint64_t ralo, int64_t rahi, int64_t rb) const
329  {
330  bool ov;
331  int64_t q, r;
332  #if defined(__SIZEOF_INT128__)
333  if (rb == 0) {
334  ov = true;
335  } else {
336  __int128_t ra = ((__int128_t)rahi << 64) | ralo;
337  __int128_t res = ra / rb;
338  q = res;
339  r = ra % rb;
340  ov = res != q;
341  }
342  #else
343  bool raneg = rahi < 0;
344  bool rbneg = rb < 0;
345 
346  if (raneg) {
347  ralo = ~(ralo);
348  rahi = ~(rahi);
349  if (ralo == -1ULL) {
350  ralo = 0;
351  rahi++;
352  } else {
353  ralo++;
354  }
355  }
356 
357  if (rbneg) rb = -rb;
358  std::tie(ov, q, r) = divide(ralo, (uint64_t)rahi, (uint64_t)rb);
359  if (raneg ^ rbneg) q = -q;
360  if (raneg) r = -r;
361  if (!ov) ov = ((q < 0) ^ (raneg ^ rbneg));
362  #endif
363  return std::make_tuple(ov, q, r);
364  }
365 
366  std::string generateDisassembly(
367  Addr pc, const Loader::SymbolTable *symtab) const override;
368 };
369 
370 
374 class IntImmArithOp : public IntArithOp
375 {
376  protected:
377 
378  int32_t si;
379 
381  IntImmArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
382  : IntArithOp(mnem, _machInst, __opClass),
383  si(sext<16>(machInst.si))
384  {
385  }
386 
387  std::string generateDisassembly(
388  Addr pc, const Loader::SymbolTable *symtab) const override;
389 };
390 
391 
396 {
397  protected:
398 
399  int64_t d;
400 
402  IntDispArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
403  : IntArithOp(mnem, _machInst, __opClass),
404  d(sext<16>((machInst.d0 << 6) | (machInst.d1 << 1) | machInst.d2))
405  {
406  }
407 
408  std::string generateDisassembly(
409  Addr pc, const Loader::SymbolTable *symtab) const override;
410 };
411 
412 
416 class IntCompOp : public IntOp
417 {
418  protected:
419 
420  bool l;
421  uint8_t bf;
422 
424  IntCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
425  : IntOp(mnem, _machInst, __opClass),
426  l(machInst.l),
427  bf(machInst.bf)
428  {
429  }
430 
431  std::string generateDisassembly(
432  Addr pc, const Loader::SymbolTable *symtab) const override;
433 };
434 
435 
439 class IntImmCompOp : public IntCompOp
440 {
441  protected:
442 
443  int32_t si;
444 
446  IntImmCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
447  : IntCompOp(mnem, _machInst, __opClass),
448  si(sext<16>(machInst.si))
449  {
450  }
451 
452  std::string generateDisassembly(
453  Addr pc, const Loader::SymbolTable *symtab) const override;
454 };
455 
456 
461 {
462  protected:
463 
464  uint32_t ui;
465 
467  IntImmCompLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
468  : IntCompOp(mnem, _machInst, __opClass),
469  ui(machInst.ui)
470  {
471  }
472 
473  std::string generateDisassembly(
474  Addr pc, const Loader::SymbolTable *symtab) const override;
475 };
476 
477 
481 class IntLogicOp : public IntOp
482 {
483  protected:
484 
486  IntLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
487  : IntOp(mnem, _machInst, __opClass)
488  {
489  }
490 
491  /* Compute the number of consecutive zero bits starting from the
492  leftmost bit and moving right in a 32-bit integer */
493  inline int
494  findLeadingZeros(uint32_t rs) const
495  {
496  if (rs) {
497  #if defined(__GNUC__) || (defined(__clang__) && \
498  __has_builtin(__builtin_clz))
499  return __builtin_clz(rs);
500  #else
501  return 31 - findMsbSet(rs);
502  #endif
503  } else {
504  return 32;
505  }
506  }
507 
508  /* Compute the number of consecutive zero bits starting from the
509  leftmost bit and moving right in a 64-bit integer */
510  inline int
511  findLeadingZeros(uint64_t rs) const
512  {
513  if (rs) {
514  #if defined(__GNUC__) || (defined(__clang__) && \
515  __has_builtin(__builtin_clzll))
516  return __builtin_clzll(rs);
517  #else
518  return 63 - findMsbSet(rs);
519  #endif
520  } else {
521  return 64;
522  }
523  }
524 
525  /* Compute the number of consecutive zero bits starting from the
526  rightmost bit and moving left in a 32-bit integer */
527  inline int
528  findTrailingZeros(uint32_t rs) const
529  {
530  if (rs) {
531  #if defined(__GNUC__) || (defined(__clang__) && \
532  __has_builtin(__builtin_ctz))
533  return __builtin_ctz(rs);
534  #else
535  return findLsbSet(rs);
536  #endif
537  } else {
538  return 32;
539  }
540  }
541 
542  /* Compute the number of consecutive zero bits starting from the
543  rightmost bit and moving left in a 64-bit integer */
544  inline int
545  findTrailingZeros(uint64_t rs) const
546  {
547  if (rs) {
548  #if defined(__GNUC__) || (defined(__clang__) && \
549  __has_builtin(__builtin_ctzll))
550  return __builtin_ctzll(rs);
551  #else
552  return findLsbSet(rs);
553  #endif
554  } else {
555  return 64;
556  }
557  }
558 
559  std::string generateDisassembly(
560  Addr pc, const Loader::SymbolTable *symtab) const override;
561 };
562 
563 
567 class IntImmLogicOp : public IntLogicOp
568 {
569  protected:
570 
571  uint32_t ui;
572 
574  IntImmLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
575  : IntLogicOp(mnem, _machInst, __opClass),
576  ui(machInst.ui)
577  {
578  }
579 
580  std::string generateDisassembly(
581  Addr pc, const Loader::SymbolTable *symtab) const override;
582 };
583 
584 
589 class IntShiftOp : public IntOp
590 {
591  protected:
592 
593  uint8_t sh;
594 
596  IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
597  : IntOp(mnem, _machInst, __opClass),
598  sh(machInst.sh)
599  {
600  }
601 
602  std::string generateDisassembly(
603  Addr pc, const loader::SymbolTable *symtab) const override;
604 };
605 
606 
611 class IntConcatShiftOp : public IntOp
612 {
613  protected:
614 
615  uint8_t sh;
616 
618  IntConcatShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
619  : IntOp(mnem, _machInst, __opClass),
620  sh((machInst.shn << 5) | machInst.sh)
621  {
622  }
623 
624  std::string generateDisassembly(
625  Addr pc, const Loader::SymbolTable *symtab) const override;
626 };
627 
628 
634 class IntRotateOp : public IntShiftOp
635 {
636  protected:
637 
638  uint8_t mb;
639  uint8_t me;
640 
642  IntRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
643  : IntShiftOp(mnem, _machInst, __opClass),
644  mb(machInst.mb),
645  me(machInst.me)
646  {
647  }
648 
649  inline uint64_t
650  rotate(uint32_t value, uint32_t shift) const
651  {
652  uint64_t res;
653  shift = shift & 0x1f;
654  res = value;
655  res = (res << 32) | res;
656  res = (res << shift) | (res >> (32 - shift));
657  return res;
658  }
659 
660  inline uint64_t
661  bitmask(uint32_t begin, uint32_t end) const
662  {
663  begin = begin & 0x1f;
664  end = end & 0x1f;
665  if (begin <= end) {
666  return mask(31 - begin, 31 - end);
667  } else {
668  return ~mask(31 - (end + 1), 31 - (begin - 1));
669  }
670  }
671 
672  std::string generateDisassembly(
673  Addr pc, const loader::SymbolTable *symtab) const override;
674 };
675 
676 
683 {
684  protected:
685 
686  uint8_t mb;
687  uint8_t me;
688 
690  IntConcatRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
691  : IntConcatShiftOp(mnem, _machInst, __opClass),
692  mb((machInst.mbn << 5) | machInst.mb),
693  me((machInst.men << 5) | machInst.mb)
694  {
695  }
696 
697  inline uint64_t
698  rotate(uint64_t value, uint32_t shift) const
699  {
700  shift = shift & 0x3f;
701  return (value << shift) | (value >> (64 - shift));
702  }
703 
704  inline uint64_t
705  bitmask(uint32_t begin, uint32_t end) const
706  {
707  begin = begin & 0x3f;
708  end = end & 0x3f;
709  if (begin <= end) {
710  return mask(63 - begin, 63 - end);
711  } else {
712  return ~mask(63 - (end + 1), 63 - (begin - 1));
713  }
714  }
715 
716  std::string generateDisassembly(
717  Addr pc, const Loader::SymbolTable *symtab) const override;
718 };
719 
720 
724 class IntTrapOp : public IntOp
725 {
726  protected:
727  uint8_t to;
728 
730  IntTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
731  : IntOp(mnem, _machInst, __opClass),
732  to(machInst.to)
733  {
734  }
735 
736  inline bool
737  checkTrap(int64_t a, int64_t b) const
738  {
739  if (((to & 0x10) && (a < b)) ||
740  ((to & 0x08) && (a > b)) ||
741  ((to & 0x04) && (a == b)) ||
742  ((to & 0x02) && ((uint64_t)a < (uint64_t)b)) ||
743  ((to & 0x01) && ((uint64_t)a > (uint64_t)b))) {
744  return true;
745  }
746 
747  return false;
748  }
749 
750  inline std::string
751  suffix() const
752  {
753  std::string str;
754 
755  switch (to) {
756  case 1: str = "lgt"; break;
757  case 2: str = "llt"; break;
758  case 4: str = "eq"; break;
759  case 5: str = "lge"; break;
760  case 6: str = "lle"; break;
761  case 8: str = "gt"; break;
762  case 12: str = "ge"; break;
763  case 16: str = "lt"; break;
764  case 20: str = "le"; break;
765  case 24: str = "ne"; break;
766  case 31: str = "u"; break;
767  }
768 
769  return str;
770  }
771 
772  std::string generateDisassembly(
773  Addr pc, const Loader::SymbolTable *symtab) const override;
774 };
775 
776 
780 class IntImmTrapOp : public IntTrapOp
781 {
782  protected:
783  int32_t si;
784 
786  IntImmTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
787  : IntTrapOp(mnem, _machInst, __opClass),
788  si(sext<16>(machInst.si))
789  {
790  }
791 
792  std::string generateDisassembly(
793  Addr pc, const Loader::SymbolTable *symtab) const override;
794 };
795 
796 } // namespace PowerISA
797 } // namespace gem5
798 
799 #endif //__ARCH_POWER_INSTS_INTEGER_HH__
gem5::PowerISA::IntArithOp::divide
std::tuple< bool, int64_t, int64_t > divide(uint64_t ralo, int64_t rahi, int64_t rb) const
Compute overflow, 64-bit quotient and 64-bit remainder of 128-bit by 64-bit signed integer division.
Definition: integer.hh:328
gem5::PowerISA::PowerStaticInst::machInst
ExtMachInst machInst
Definition: static_inst.hh:45
gem5::PowerISA::IntOp::IntOp
IntOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:65
gem5::PowerISA::IntConcatRotateOp::IntConcatRotateOp
IntConcatRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:690
gem5::PowerISA::IntLogicOp::findLeadingZeros
int findLeadingZeros(uint32_t rs) const
Definition: integer.hh:494
gem5::PowerISA::IntImmLogicOp
Class for integer immediate logical operations.
Definition: integer.hh:567
gem5::PowerISA::IntLogicOp
Class for integer logical operations.
Definition: integer.hh:481
gem5::PowerISA::IntImmCompOp
Class for integer immediate compare operations.
Definition: integer.hh:439
gem5::PowerISA::IntImmOp::IntImmOp
IntImmOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:116
gem5::PowerISA::IntOp::sh
uint32_t sh
Definition: integer.hh:62
gem5::PowerISA::IntRotateOp::mb
uint8_t mb
Definition: integer.hh:638
gem5::PowerISA::IntConcatRotateOp::me
uint8_t me
Definition: integer.hh:687
gem5::PowerISA::IntRotateOp::bitmask
uint64_t bitmask(uint32_t begin, uint32_t end) const
Definition: integer.hh:661
gem5::PowerISA::IntShiftOp::sh
uint8_t sh
Definition: integer.hh:593
gem5::PowerISA::ov
Bitfield< 30 > ov
Definition: misc.hh:61
gem5::PowerISA::IntCompOp
Class for integer compare operations.
Definition: integer.hh:416
gem5::PowerISA::IntImmArithOp::IntImmArithOp
IntImmArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:381
gem5::PowerISA::IntConcatRotateOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:753
gem5::sext
constexpr uint64_t sext(uint64_t val)
Sign-extend an N-bit value to 64 bits.
Definition: bitfield.hh:126
gem5::ArmISA::a
Bitfield< 8 > a
Definition: misc_types.hh:65
gem5::PowerISA::IntImmLogicOp::IntImmLogicOp
IntImmLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:574
gem5::PowerISA::IntArithOp::IntArithOp
IntArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:136
gem5::PowerISA::IntRotateOp::IntRotateOp
IntRotateOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:642
gem5::loader::SymbolTable
Definition: symtab.hh:65
gem5::PowerISA::IntOp::makeCRFieldUnsigned
uint32_t makeCRFieldUnsigned(uint64_t a, uint64_t b, bool so) const
Definition: integer.hh:88
gem5::PowerISA::IntImmArithOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:177
gem5::PowerISA::IntOp::makeCRFieldSigned
uint32_t makeCRFieldSigned(int64_t a, int64_t b, bool so) const
Definition: integer.hh:74
gem5::PowerISA::IntTrapOp::to
uint8_t to
Definition: integer.hh:727
gem5::PowerISA::IntImmCompLogicOp
Class for integer immediate compare logical operations.
Definition: integer.hh:460
gem5::ArmISA::i
Bitfield< 7 > i
Definition: misc_types.hh:66
gem5::PowerISA::IntImmTrapOp::IntImmTrapOp
IntImmTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:786
gem5::PowerISA::IntConcatRotateOp::rotate
uint64_t rotate(uint64_t value, uint32_t shift) const
Definition: integer.hh:698
gem5::PowerISA::men
Bitfield< 5 > men
Definition: types.hh:58
gem5::PowerISA::IntArithOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:119
gem5::mask
constexpr uint64_t mask(unsigned nbits)
Generate a 64-bit mask of 'nbits' 1s, right justified.
Definition: bitfield.hh:63
gem5::PowerISA::IntTrapOp
Class for integer trap operations.
Definition: integer.hh:724
gem5::ArmISA::shift
Bitfield< 6, 5 > shift
Definition: types.hh:117
gem5::PowerISA::IntImmCompLogicOp::ui
uint32_t ui
Definition: integer.hh:464
gem5::PowerISA::IntImmCompLogicOp::IntImmCompLogicOp
IntImmCompLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:467
gem5::PowerISA::IntConcatRotateOp::bitmask
uint64_t bitmask(uint32_t begin, uint32_t end) const
Definition: integer.hh:705
gem5::PowerISA::IntImmArithOp
Class for integer immediate arithmetic operations.
Definition: integer.hh:374
gem5::PowerISA::IntShiftOp::IntShiftOp
IntShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:596
gem5::PowerISA::IntImmCompOp::si
int32_t si
Definition: integer.hh:443
gem5::PowerISA::IntConcatShiftOp::sh
uint8_t sh
Definition: integer.hh:615
gem5::ArmISA::b
Bitfield< 7 > b
Definition: misc_types.hh:381
gem5::PowerISA::IntCompOp::bf
uint8_t bf
Definition: integer.hh:421
bitfield.hh
gem5::findLsbSet
constexpr int findLsbSet(uint64_t val)
Returns the bit position of the LSB that is set in the input.
Definition: bitfield.hh:299
gem5::PowerISA::ra
Bitfield< 20, 16 > ra
Definition: types.hh:50
gem5::PowerISA::IntArithOp::multiplyAdd
std::tuple< uint64_t, uint64_t > multiplyAdd(uint64_t ra, uint64_t rb, uint64_t rc) const
Compute 128-bit result of 64-bit unsigned integer multiplication followed by addition.
Definition: integer.hh:235
gem5::PowerISA::IntImmTrapOp
Class for integer immediate trap operations.
Definition: integer.hh:780
gem5::PowerISA::IntDispArithOp
Class for integer arithmetic operations with displacement.
Definition: integer.hh:395
gem5::PowerISA::IntImmLogicOp::ui
uint32_t ui
Definition: integer.hh:571
gem5::PowerISA::IntCompOp::l
bool l
Definition: integer.hh:420
gem5::PowerISA::IntDispArithOp::d
int64_t d
Definition: integer.hh:399
gem5::PowerISA::d1
Bitfield< 20, 16 > d1
Definition: types.hh:66
gem5::PowerISA::IntTrapOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:834
gem5::PowerISA::IntCompOp::IntCompOp
IntCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:424
gem5::PowerISA::IntArithOp
Class for integer arithmetic operations.
Definition: integer.hh:131
gem5::PowerISA::d2
Bitfield< 1, 0 > d2
Definition: types.hh:67
gem5::PowerISA::IntImmTrapOp::si
int32_t si
Definition: integer.hh:783
cprintf.hh
gem5::PowerISA::IntImmCompLogicOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:496
gem5::PowerISA::IntRotateOp::rotate
uint64_t rotate(uint32_t value, uint32_t shift) const
Definition: integer.hh:650
gem5::PowerISA::IntLogicOp::findTrailingZeros
int findTrailingZeros(uint64_t rs) const
Definition: integer.hh:545
gem5::ArmISA::c
Bitfield< 29 > c
Definition: misc_types.hh:53
gem5::PowerISA::IntDispArithOp::IntDispArithOp
IntDispArithOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:402
misc.hh
gem5::PowerISA::IntShiftOp
Class for integer operations with a shift value obtained from a register or an instruction field.
Definition: integer.hh:589
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::PowerISA::IntConcatRotateOp
Class for integer rotate operations with a shift amount obtained from a register or by concatenating ...
Definition: integer.hh:682
gem5::PowerISA::IntArithOp::multiplyAdd
std::tuple< uint64_t, int64_t > multiplyAdd(int64_t ra, int64_t rb, int64_t rc) const
Compute 128-bit result of 64-bit signed integer multiplication followed by addition.
Definition: integer.hh:255
gem5::PowerISA::IntArithOp::multiply
std::tuple< uint64_t, uint64_t > multiply(uint64_t ra, uint64_t rb) const
Compute 128-bit product of 64-bit unsigned integer multiplication based on https://stackoverflow....
Definition: integer.hh:192
gem5::PowerISA::IntRotateOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:668
gem5::PowerISA::IntConcatRotateOp::mb
uint8_t mb
Definition: integer.hh:686
gem5::PowerISA::IntTrapOp::IntTrapOp
IntTrapOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:730
gem5::PowerISA::so
Bitfield< 28 > so
Definition: misc.hh:54
gem5::PowerISA::IntImmCompOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:447
gem5::PowerISA::IntConcatShiftOp::IntConcatShiftOp
IntConcatShiftOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:618
gem5::PowerISA::IntRotateOp::me
uint8_t me
Definition: integer.hh:639
gem5::PowerISA::IntArithOp::divide
std::tuple< bool, uint64_t, uint64_t > divide(uint64_t ralo, uint64_t rahi, uint64_t rb) const
Compute overflow, 64-bit quotient and 64-bit remainder of 128-bit by 64-bit unsigned integer division...
Definition: integer.hh:278
gem5::PowerISA::IntArithOp::add
std::tuple< uint64_t, uint64_t > add(uint64_t ralo, uint64_t rahi, uint64_t rb) const
Definition: integer.hh:143
gem5::PowerISA::IntConcatShiftOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:606
gem5::PowerISA::IntLogicOp::findTrailingZeros
int findTrailingZeros(uint32_t rs) const
Definition: integer.hh:528
gem5::PowerISA::IntImmCompOp::IntImmCompOp
IntImmCompOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:446
gem5::ArmISA::q
Bitfield< 27 > q
Definition: misc_types.hh:55
gem5::PowerISA::IntImmOp::si
int32_t si
Definition: integer.hh:112
gem5::PowerISA::MachInst
uint32_t MachInst
Definition: types.hh:44
gem5::PowerISA::IntArithOp::multiply
std::tuple< uint64_t, int64_t > multiply(int64_t ra, int64_t rb) const
Definition: integer.hh:215
gem5::PowerISA::IntOp::rc
bool rc
Definition: integer.hh:58
gem5::PowerISA::IntImmOp::ui
uint32_t ui
Definition: integer.hh:113
gem5::PowerISA::IntConcatShiftOp
Class for integer shift operations with a shift value obtained from a register or by concatenating im...
Definition: integer.hh:611
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::PowerISA::IntCompOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:394
gem5::PowerISA::IntOp
We provide a base class for integer operations and then inherit for several other classes.
Definition: integer.hh:54
gem5::PowerISA::IntLogicOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:282
gem5::PowerISA::IntImmOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:94
gem5::findMsbSet
constexpr int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Definition: bitfield.hh:263
gem5::PowerISA::IntLogicOp::findLeadingZeros
int findLeadingZeros(uint64_t rs) const
Definition: integer.hh:511
gem5::MipsISA::r
r
Definition: pra_constants.hh:98
gem5::PowerISA::IntShiftOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:545
gem5::PowerISA::IntTrapOp::suffix
std::string suffix() const
Definition: integer.hh:751
gem5::PowerISA::IntImmOp
Class for integer immediate (signed and unsigned) operations.
Definition: integer.hh:108
gem5::RiscvISA::sum
Bitfield< 18 > sum
Definition: misc.hh:545
gem5::PowerISA::IntImmArithOp::si
int32_t si
Definition: integer.hh:378
gem5::PowerISA::d0
Bitfield< 15, 6 > d0
Definition: types.hh:65
gem5::PowerISA::rs
rs
Definition: types.hh:49
gem5::PowerISA::IntRotateOp
Class for integer rotate operations with a shift amount obtained from a register or an immediate and ...
Definition: integer.hh:634
gem5::PowerISA::IntOp::oe
bool oe
Definition: integer.hh:59
gem5::PowerISA::mbn
Bitfield< 5 > mbn
Definition: types.hh:56
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::PowerISA::IntArithOp::add
std::tuple< uint64_t, int64_t > add(uint64_t ralo, int64_t rahi, int64_t rb) const
Definition: integer.hh:160
gem5::PowerISA::IntDispArithOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:237
static_inst.hh
gem5::PowerISA::IntTrapOp::checkTrap
bool checkTrap(int64_t a, int64_t b) const
Definition: integer.hh:737
gem5::PowerISA::PowerStaticInst
Definition: static_inst.hh:42
gem5::PowerISA::IntOp::generateDisassembly
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: integer.cc:38
gem5::PowerISA::IntLogicOp::IntLogicOp
IntLogicOp(const char *mnem, MachInst _machInst, OpClass __opClass)
Constructor.
Definition: integer.hh:486
gem5::PowerISA::IntImmLogicOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:346
gem5::PowerISA::shn
Bitfield< 1 > shn
Definition: types.hh:54
gem5::PowerISA::IntImmTrapOp::generateDisassembly
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Definition: integer.cc:885

Generated on Tue Sep 21 2021 12:24:51 for gem5 by doxygen 1.8.17