regop.isa (6464:2529aeaf1a1c) | regop.isa (6479:b9ab1b56391b) |
---|---|
1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any --- 870 unchanged lines hidden (view full) --- 879 if ((ext & OFBit) && (msb ^ CFBits)) 880 ccFlagBits = ccFlagBits | OFBit; 881 //Use the regular mechanisms to calculate the other flags. 882 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), 883 DestReg, psrc1, op2); 884 } 885 ''' 886 | 1// Copyright (c) 2007-2008 The Hewlett-Packard Development Company 2// All rights reserved. 3// 4// Redistribution and use of this software in source and binary forms, 5// with or without modification, are permitted provided that the 6// following conditions are met: 7// 8// The software must be used only for Non-Commercial Use which means any --- 870 unchanged lines hidden (view full) --- 879 if ((ext & OFBit) && (msb ^ CFBits)) 880 ccFlagBits = ccFlagBits | OFBit; 881 //Use the regular mechanisms to calculate the other flags. 882 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), 883 DestReg, psrc1, op2); 884 } 885 ''' 886 |
887 class Sld(RegOp): 888 code = ''' 889 uint8_t shiftAmt = (op2 & ((dataSize == 8) ? mask(6) : mask(5))); 890 uint8_t dataBits = dataSize * 8; 891 uint8_t realShiftAmt = shiftAmt % (2 * dataBits); 892 uint64_t result; 893 if (realShiftAmt == 0) { 894 result = psrc1; 895 } else if (realShiftAmt < dataBits) { 896 result = (psrc1 << realShiftAmt) | 897 (DoubleBits >> (dataBits - realShiftAmt)); 898 } else { 899 result = (DoubleBits << (realShiftAmt - dataBits)) | 900 (psrc1 >> (2 * dataBits - realShiftAmt)); 901 } 902 DestReg = merge(DestReg, result, dataSize); 903 ''' 904 flag_code = ''' 905 // If the shift amount is zero, no flags should be modified. 906 if (shiftAmt) { 907 //Zero out any flags we might modify. This way we only have to 908 //worry about setting them. 909 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit)); 910 int CFBits = 0; 911 //Figure out if we -would- set the CF bits if requested. 912 if ((realShiftAmt == 0 && 913 bits(DoubleBits, 0)) || 914 (realShiftAmt <= dataBits && 915 bits(SrcReg1, dataBits - realShiftAmt)) || 916 (realShiftAmt > dataBits && 917 bits(DoubleBits, 2 * dataBits - realShiftAmt))) { 918 CFBits = 1; 919 } 920 //If some combination of the CF bits need to be set, set them. 921 if ((ext & (CFBit | ECFBit)) && CFBits) 922 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit)); 923 //Figure out what the OF bit should be. 924 if ((ext & OFBit) && (bits(SrcReg1, dataBits - 1) ^ 925 bits(result, dataBits - 1))) 926 ccFlagBits = ccFlagBits | OFBit; 927 //Use the regular mechanisms to calculate the other flags. 928 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), 929 DestReg, psrc1, op2); 930 } 931 ''' 932 933 class Srd(RegOp): 934 code = ''' 935 uint8_t shiftAmt = (op2 & ((dataSize == 8) ? mask(6) : mask(5))); 936 uint8_t dataBits = dataSize * 8; 937 uint8_t realShiftAmt = shiftAmt % (2 * dataBits); 938 uint64_t result; 939 if (realShiftAmt == 0) { 940 result = psrc1; 941 } else if (realShiftAmt < dataBits) { 942 // Because what happens to the bits shift -in- on a right 943 // shift is not defined in the C/C++ standard, we have to 944 // mask them out to be sure they're zero. 945 uint64_t logicalMask = mask(dataBits - realShiftAmt); 946 result = ((psrc1 >> realShiftAmt) & logicalMask) | 947 (DoubleBits << (dataBits - realShiftAmt)); 948 } else { 949 uint64_t logicalMask = mask(2 * dataBits - realShiftAmt); 950 result = ((DoubleBits >> (realShiftAmt - dataBits)) & 951 logicalMask) | 952 (psrc1 << (2 * dataBits - realShiftAmt)); 953 } 954 DestReg = merge(DestReg, result, dataSize); 955 ''' 956 flag_code = ''' 957 // If the shift amount is zero, no flags should be modified. 958 if (shiftAmt) { 959 //Zero out any flags we might modify. This way we only have to 960 //worry about setting them. 961 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit)); 962 int CFBits = 0; 963 //If some combination of the CF bits need to be set, set them. 964 if ((realShiftAmt == 0 && 965 bits(DoubleBits, dataBits - 1)) || 966 (realShiftAmt <= dataBits && 967 bits(SrcReg1, realShiftAmt - 1)) || 968 (realShiftAmt > dataBits && 969 bits(DoubleBits, realShiftAmt - dataBits - 1))) { 970 CFBits = 1; 971 } 972 //If some combination of the CF bits need to be set, set them. 973 if ((ext & (CFBit | ECFBit)) && CFBits) 974 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit)); 975 //Figure out what the OF bit should be. 976 if ((ext & OFBit) && (bits(SrcReg1, dataBits - 1) ^ 977 bits(result, dataBits - 1))) 978 ccFlagBits = ccFlagBits | OFBit; 979 //Use the regular mechanisms to calculate the other flags. 980 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit), 981 DestReg, psrc1, op2); 982 } 983 ''' 984 985 class Mdb(WrRegOp): 986 code = 'DoubleBits = psrc1 ^ op2;' 987 |
|
887 class Wrip(WrRegOp, CondRegOp): 888 code = 'RIP = psrc1 + sop2 + CSBase' 889 else_code="RIP = RIP;" 890 891 class Wruflags(WrRegOp): 892 code = 'ccFlagBits = psrc1 ^ op2' 893 894 class Wrflags(WrRegOp): --- 434 unchanged lines hidden --- | 988 class Wrip(WrRegOp, CondRegOp): 989 code = 'RIP = psrc1 + sop2 + CSBase' 990 else_code="RIP = RIP;" 991 992 class Wruflags(WrRegOp): 993 code = 'ccFlagBits = psrc1 ^ op2' 994 995 class Wrflags(WrRegOp): --- 434 unchanged lines hidden --- |