regop.isa (6462:209c3818a863) regop.isa (6463:fe6165923529)
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

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

531 ((psrc1_l * psrc2_l) / shifter)) /shifter) +
532 psrc1_h * psrc2_h;
533 if (bits(psrc1, dataSize * 8 - 1))
534 hiResult -= op2;
535 if (bits(op2, dataSize * 8 - 1))
536 hiResult -= psrc1;
537 ProdHi = hiResult;
538 '''
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

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

531 ((psrc1_l * psrc2_l) / shifter)) /shifter) +
532 psrc1_h * psrc2_h;
533 if (bits(psrc1, dataSize * 8 - 1))
534 hiResult -= op2;
535 if (bits(op2, dataSize * 8 - 1))
536 hiResult -= psrc1;
537 ProdHi = hiResult;
538 '''
539 flag_code = '''
540 if ((-ProdHi & mask(dataSize * 8)) !=
541 bits(ProdLow, dataSize * 8 - 1)) {
542 ccFlagBits = ccFlagBits | (ext & (CFBit | OFBit | ECFBit));
543 } else {
544 ccFlagBits = ccFlagBits & ~(ext & (CFBit | OFBit | ECFBit));
545 }
546 '''
539
540 class Mul1u(WrRegOp):
541 code = '''
542 ProdLow = psrc1 * op2;
543 int halfSize = (dataSize * 8) / 2;
544 uint64_t shifter = (1ULL << halfSize);
545 uint64_t psrc1_h = psrc1 / shifter;
546 uint64_t psrc1_l = psrc1 & mask(halfSize);
547 uint64_t psrc2_h = (op2 / shifter) & mask(halfSize);
548 uint64_t psrc2_l = op2 & mask(halfSize);
549 ProdHi = ((psrc1_l * psrc2_h + psrc1_h * psrc2_l +
550 ((psrc1_l * psrc2_l) / shifter)) / shifter) +
551 psrc1_h * psrc2_h;
552 '''
547
548 class Mul1u(WrRegOp):
549 code = '''
550 ProdLow = psrc1 * op2;
551 int halfSize = (dataSize * 8) / 2;
552 uint64_t shifter = (1ULL << halfSize);
553 uint64_t psrc1_h = psrc1 / shifter;
554 uint64_t psrc1_l = psrc1 & mask(halfSize);
555 uint64_t psrc2_h = (op2 / shifter) & mask(halfSize);
556 uint64_t psrc2_l = op2 & mask(halfSize);
557 ProdHi = ((psrc1_l * psrc2_h + psrc1_h * psrc2_l +
558 ((psrc1_l * psrc2_l) / shifter)) / shifter) +
559 psrc1_h * psrc2_h;
560 '''
561 flag_code = '''
562 if (ProdHi) {
563 ccFlagBits = ccFlagBits | (ext & (CFBit | OFBit | ECFBit));
564 } else {
565 ccFlagBits = ccFlagBits & ~(ext & (CFBit | OFBit | ECFBit));
566 }
567 '''
553
554 class Mulel(RdRegOp):
555 code = 'DestReg = merge(SrcReg1, ProdLow, dataSize);'
556
557 class Muleh(RdRegOp):
558 def __init__(self, dest, src1=None, flags=None, dataSize="env.dataSize"):
559 if not src1:
560 src1 = dest
561 super(RdRegOp, self).__init__(dest, src1, \
562 "InstRegIndex(NUM_INTREGS)", flags, dataSize)
563 code = 'DestReg = merge(SrcReg1, ProdHi, dataSize);'
568
569 class Mulel(RdRegOp):
570 code = 'DestReg = merge(SrcReg1, ProdLow, dataSize);'
571
572 class Muleh(RdRegOp):
573 def __init__(self, dest, src1=None, flags=None, dataSize="env.dataSize"):
574 if not src1:
575 src1 = dest
576 super(RdRegOp, self).__init__(dest, src1, \
577 "InstRegIndex(NUM_INTREGS)", flags, dataSize)
578 code = 'DestReg = merge(SrcReg1, ProdHi, dataSize);'
564 flag_code = '''
565 if (ProdHi)
566 ccFlagBits = ccFlagBits | (ext & (CFBit | OFBit | ECFBit));
567 else
568 ccFlagBits = ccFlagBits & ~(ext & (CFBit | OFBit | ECFBit));
569 '''
570
571 # One or two bit divide
572 class Div1(WrRegOp):
573 code = '''
574 //These are temporaries so that modifying them later won't make
575 //the ISA parser think they're also sources.
576 uint64_t quotient = 0;
577 uint64_t remainder = psrc1;

--- 742 unchanged lines hidden ---
579
580 # One or two bit divide
581 class Div1(WrRegOp):
582 code = '''
583 //These are temporaries so that modifying them later won't make
584 //the ISA parser think they're also sources.
585 uint64_t quotient = 0;
586 uint64_t remainder = psrc1;

--- 742 unchanged lines hidden ---