static ImmediateOrRegister getOperand2(int instruction) {
   boolean iBit = isIBitSet(instruction);
   ImmediateOrRegister operand2 = null;
   if (iBit) {
     operand2 = new Immediate(new Short((short) extractSignedIntFromNBits(instruction, 13)));
   } else {
     operand2 = SPARCRegisters.getRegister(getSourceRegister2(instruction));
   }
   return operand2;
 }
예제 #2
0
 Instruction decodeReadWrite(
     int instruction, SPARCInstructionFactory factory, int rs1Num, int rdNum) {
   Instruction instr = null;
   int specialReg = specialRegNum;
   if (rs1Num == 0) specialReg = SPARCSpecialRegisters.Y;
   if (rs1Num == 15 && rdNum == 0) {
     instr = factory.newStbarInstruction();
   } else {
     instr = factory.newReadInstruction(specialReg, rs1Num, SPARCRegisters.getRegister(rdNum));
   }
   return instr;
 }