regop.isa (6453:1d4dbb357560) regop.isa (6454:755cf9b6185f)
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

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

757 DestReg, psrc1, op2);
758 }
759 '''
760
761 class Rcr(RegOp):
762 code = '''
763 uint8_t shiftAmt =
764 (op2 & ((dataSize == 8) ? mask(6) : mask(5)));
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

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

757 DestReg, psrc1, op2);
758 }
759 '''
760
761 class Rcr(RegOp):
762 code = '''
763 uint8_t shiftAmt =
764 (op2 & ((dataSize == 8) ? mask(6) : mask(5)));
765 if(shiftAmt)
765 uint8_t realShiftAmt = shiftAmt % (dataSize * 8 + 1);
766 if(realShiftAmt)
766 {
767 CCFlagBits flags = ccFlagBits;
767 {
768 CCFlagBits flags = ccFlagBits;
768 uint64_t top = flags.cf << (dataSize * 8 - shiftAmt);
769 if(shiftAmt > 1)
770 top |= psrc1 << (dataSize * 8 - shiftAmt + 1);
771 uint64_t bottom = bits(psrc1, dataSize * 8 - 1, shiftAmt);
769 uint64_t top = flags.cf << (dataSize * 8 - realShiftAmt);
770 if (realShiftAmt > 1)
771 top |= psrc1 << (dataSize * 8 - realShiftAmt + 1);
772 uint64_t bottom = bits(psrc1, dataSize * 8 - 1, realShiftAmt);
772 DestReg = merge(DestReg, top | bottom, dataSize);
773 }
774 else
775 DestReg = merge(DestReg, DestReg, dataSize);
776 '''
777 flag_code = '''
778 // If the shift amount is zero, no flags should be modified.
779 if (shiftAmt) {
780 int origCFBit = (ccFlagBits & CFBit) ? 1 : 0;
781 //Zero out any flags we might modify. This way we only have to
782 //worry about setting them.
783 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
784 //Figure out what the OF bit should be.
785 if ((ext & OFBit) && (origCFBit ^
786 bits(SrcReg1, dataSize * 8 - 1))) {
787 ccFlagBits = ccFlagBits | OFBit;
788 }
789 //If some combination of the CF bits need to be set, set them.
773 DestReg = merge(DestReg, top | bottom, dataSize);
774 }
775 else
776 DestReg = merge(DestReg, DestReg, dataSize);
777 '''
778 flag_code = '''
779 // If the shift amount is zero, no flags should be modified.
780 if (shiftAmt) {
781 int origCFBit = (ccFlagBits & CFBit) ? 1 : 0;
782 //Zero out any flags we might modify. This way we only have to
783 //worry about setting them.
784 ccFlagBits = ccFlagBits & ~(ext & (CFBit | ECFBit | OFBit));
785 //Figure out what the OF bit should be.
786 if ((ext & OFBit) && (origCFBit ^
787 bits(SrcReg1, dataSize * 8 - 1))) {
788 ccFlagBits = ccFlagBits | OFBit;
789 }
790 //If some combination of the CF bits need to be set, set them.
790 if ((ext & (CFBit | ECFBit)) && bits(SrcReg1, shiftAmt - 1))
791 if ((ext & (CFBit | ECFBit)) &&
792 (realShiftAmt == 0) ? origCFBit :
793 bits(SrcReg1, realShiftAmt - 1)) {
791 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
794 ccFlagBits = ccFlagBits | (ext & (CFBit | ECFBit));
795 }
792 //Use the regular mechanisms to calculate the other flags.
793 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit),
794 DestReg, psrc1, op2);
795 }
796 '''
797
798 class Rol(RegOp):
799 code = '''

--- 514 unchanged lines hidden ---
796 //Use the regular mechanisms to calculate the other flags.
797 ccFlagBits = genFlags(ccFlagBits, ext & ~(CFBit | ECFBit | OFBit),
798 DestReg, psrc1, op2);
799 }
800 '''
801
802 class Rol(RegOp):
803 code = '''

--- 514 unchanged lines hidden ---