Deleted Added
sdiff udiff text old ( 12542:03cb745f9982 ) new ( 12595:b5a51007feac )
full compact
1// Copyright (c) 2010,2017-2018 ARM Limited
2// All rights reserved
3//
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

--- 62 unchanged lines hidden (view full) ---

71 }
72 return new Unknown(machInst);
73 }
74 '''
75}};
76
77def format ArmDataProcReg() {{
78 pclr = '''
79 return new %(className)ssRegPclr(machInst, %(dest)s,
80 %(op1)s, rm, imm5,
81 type);
82 '''
83 instDecode = '''
84 case %(opcode)#x:
85 if (immShift) {
86 if (setCc) {
87 if (%(dest)s == INTREG_PC) {
88 %(pclr)s
89 } else {
90 return new %(className)sRegCc(machInst, %(dest)s,
91 %(op1)s, rm, imm5, type);
92 }
93 } else {
94 return new %(className)sReg(machInst, %(dest)s, %(op1)s,
95 rm, imm5, type);
96 }
97 } else {

--- 349 unchanged lines hidden (view full) ---

447 }
448 return new Unknown(machInst);
449 }
450 '''
451}};
452
453def format ArmDataProcImm() {{
454 pclr = '''
455 return new %(className)ssImmPclr(machInst, %(dest)s,
456 %(op1)s, imm, false);
457 '''
458 adr = '''
459 return new AdrImm(machInst, %(dest)s, %(add)s,
460 imm, false);
461 '''
462 instDecode = '''
463 case %(opcode)#x:
464 if (setCc) {
465 if (%(pclrInst)s && %(dest)s == INTREG_PC) {
466 %(pclr)s
467 } else {
468 return new %(className)sImmCc(machInst, %(dest)s, %(op1)s,
469 imm, rotC);
470 }
471 } else {
472 if (%(adrInst)s && %(op1)s == INTREG_PC) {
473 %(adr)s
474 } else {
475 return new %(className)sImm(machInst, %(dest)s, %(op1)s,
476 imm, rotC);
477 }
478 }
479 break;
480 '''
481
482 def instCode(opcode, mnem, useDest = True, useOp1 = True):

--- 5 unchanged lines hidden (view full) ---

488 if useOp1:
489 op1 = "rn"
490 else:
491 op1 = "INTREG_ZERO"
492 substDict = { "className": mnem.capitalize(),
493 "opcode": opcode,
494 "dest": dest,
495 "op1": op1,
496 "adr": "",
497 "adrInst": "false" }
498 if useDest:
499 substDict["pclrInst"] = "true"
500 substDict["pclr"] = pclr % substDict
501 else:
502 substDict["pclrInst"] = "false"
503 substDict["pclr"] = ""
504 return instDecode % substDict
505
506 def adrCode(opcode, mnem, add="1"):
507 global instDecode, pclr, adr
508 substDict = { "className": mnem.capitalize(),
509 "opcode": opcode,
510 "dest": "rd",
511 "op1": "rn",
512 "add": add,
513 "pclrInst": "true",
514 "adrInst": "true" }
515 substDict["pclr"] = pclr % substDict
516 substDict["adr"] = adr % substDict
517 return instDecode % substDict
518
519 decode_block = '''
520 {
521 const bool setCc = (bits(machInst, 20) == 1);
522 const uint32_t unrotated = bits(machInst, 7, 0);

--- 83 unchanged lines hidden (view full) ---

606 return new MovRegRegCc(machInst, rd,
607 INTREG_ZERO, rn, rm, ASR);
608 case 0x6:
609 return new MovRegReg(machInst, rd,
610 INTREG_ZERO, rn, rm, ROR);
611 case 0x7:
612 return new MovRegRegCc(machInst, rd,
613 INTREG_ZERO, rn, rm, ROR);
614 }
615 } else if (bits(op2, 3) == 0) {
616 return new Unknown(machInst);
617 } else {
618 const IntRegIndex rd =
619 (IntRegIndex)(uint32_t)bits(machInst, 11, 8);
620 const IntRegIndex rm =
621 (IntRegIndex)(uint32_t)bits(machInst, 3, 0);

--- 289 unchanged lines hidden (view full) ---

911 return new AddImmCc(machInst, rd, rn, imm3, true);
912 }
913 case 0x3:
914 if (machInst.itstateMask) {
915 return new SubImm(machInst, rd, rn, imm3, true);
916 } else {
917 return new SubImmCc(machInst, rd, rn, imm3, true);
918 }
919 }
920 case 0x4:
921 if (machInst.itstateMask) {
922 return new MovImm(machInst, rd8, INTREG_ZERO, imm8, false);
923 } else {
924 return new MovImmCc(machInst, rd8, INTREG_ZERO, imm8, false);
925 }
926 case 0x5:

--- 5 unchanged lines hidden (view full) ---

932 return new AddImmCc(machInst, rd8, rd8, imm8, true);
933 }
934 case 0x7:
935 if (machInst.itstateMask) {
936 return new SubImm(machInst, rd8, rd8, imm8, true);
937 } else {
938 return new SubImmCc(machInst, rd8, rd8, imm8, true);
939 }
940 }
941 }
942 '''
943}};
944
945def format Thumb16DataProcessing() {{
946 decode_block = '''
947 {

--- 87 unchanged lines hidden (view full) ---

1035 return new BicRegCc(machInst, rdn, rdn, rm, 0, LSL);
1036 }
1037 case 0xf:
1038 if (machInst.itstateMask) {
1039 return new MvnReg(machInst, rdn, INTREG_ZERO, rm, 0, LSL);
1040 } else {
1041 return new MvnRegCc(machInst, rdn, INTREG_ZERO, rm, 0, LSL);
1042 }
1043 }
1044 }
1045 '''
1046}};
1047
1048def format Thumb16SpecDataAndBx() {{
1049 decode_block = '''
1050 {

--- 13 unchanged lines hidden (view full) ---

1064 return new BxReg(machInst,
1065 (IntRegIndex)(uint32_t)bits(machInst, 6, 3),
1066 COND_UC);
1067 } else {
1068 return new BlxReg(machInst,
1069 (IntRegIndex)(uint32_t)bits(machInst, 6, 3),
1070 COND_UC);
1071 }
1072 }
1073 }
1074 '''
1075}};
1076
1077def format Thumb16Adr() {{
1078 decode_block = '''
1079 {

--- 84 unchanged lines hidden (view full) ---

1164 case 0x0:
1165 return new Sxth(machInst, rd, 0, rm);
1166 case 0x1:
1167 return new Sxtb(machInst, rd, 0, rm);
1168 case 0x2:
1169 return new Uxth(machInst, rd, 0, rm);
1170 case 0x3:
1171 return new Uxtb(machInst, rd, 0, rm);
1172 }
1173 }
1174 case 0x1:
1175 case 0x3:
1176 return new Cbz(machInst,
1177 (bits(machInst, 9) << 6) |
1178 (bits(machInst, 7, 3) << 1),
1179 (IntRegIndex)(uint32_t)bits(machInst, 2, 0));

--- 11 unchanged lines hidden (view full) ---

1191 if (opBits == 2) {
1192 return new Setend(machInst, bits(machInst, 3));
1193 } else if (opBits == 3) {
1194 const bool enable = (bits(machInst, 4) == 0);
1195 const uint32_t mods = (bits(machInst, 2, 0) << 5) |
1196 ((enable ? 1 : 0) << 9);
1197 return new Cps(machInst, mods);
1198 }
1199 }
1200 case 0xa:
1201 {
1202 const uint8_t op1 = bits(machInst, 7, 6);
1203 if (op1 == 0x2) {
1204 return new Hlt(machInst, bits(machInst, 5, 0));
1205 } else {
1206 IntRegIndex rd =

--- 195 unchanged lines hidden (view full) ---

1402 (bits(machInst, 19, 16) << 12);
1403 return new MovtImm(machInst, rd, rd, imm, true);
1404 }
1405 case 0x12:
1406 if (!(bits(machInst, 14, 12) || bits(machInst, 7, 6))) {
1407 const uint32_t satImm = bits(machInst, 4, 0);
1408 return new Ssat16(machInst, rd, satImm + 1, rn);
1409 }
1410 // Fall through on purpose...
1411 case 0x10:
1412 {
1413 const uint32_t satImm = bits(machInst, 4, 0);
1414 const uint32_t imm = bits(machInst, 7, 6) |
1415 (bits(machInst, 14, 12) << 2);
1416 const ArmShiftType type =
1417 (ArmShiftType)(uint32_t)bits(machInst, 21, 20);
1418 return new Ssat(machInst, rd, satImm + 1, rn, imm, type);

--- 16 unchanged lines hidden (view full) ---

1435 return new Bfi(machInst, rd, rn, lsb, msb);
1436 }
1437 }
1438 case 0x1a:
1439 if (!(bits(machInst, 14, 12) || bits(machInst, 7, 6))) {
1440 const uint32_t satImm = bits(machInst, 4, 0);
1441 return new Usat16(machInst, rd, satImm, rn);
1442 }
1443 // Fall through on purpose...
1444 case 0x18:
1445 {
1446 const uint32_t satImm = bits(machInst, 4, 0);
1447 const uint32_t imm = bits(machInst, 7, 6) |
1448 (bits(machInst, 14, 12) << 2);
1449 const ArmShiftType type =
1450 (ArmShiftType)(uint32_t)bits(machInst, 21, 20);
1451 return new Usat(machInst, rd, satImm, rn, imm, type);

--- 112 unchanged lines hidden ---