// Chops off first four and last two bits of 32-bit immediate, as specified by MIPS J-type format private uint EncodeJumpImmediate(string input, int reqLength, uint pc) { /* * // If a number or label, convert to hex * string hex = ""; * if (!string.IsNullOrEmpty(input)) * { * if (!input.StartsWith("0x")) * { * if (ASMStringHelper.StringIsNumeric(input)) * hex = "0x" + ASMValueHelper.UnsignedToHex_WithLength(Convert.ToUInt32(input),8); * else * hex = "0x" + ValueHelper.LabelHelper.LabelToHex(input,8); * } * else * { * hex = input.Substring(0,input.Length); * } * } */ //uint uValue = ValueHelper.FindUnsignedValue(input); //string hexNum = hex.Substring(2); //hexNum = ASMValueHelper.AddLeadingZeroes(hexNum, reqLength); //hex = "0x" + hexNum; //return EncodeJumpImmediate(hex); //return ((ValueHelper.FindUnsignedValue(input) >> 2) & ASMValueHelper.JumpImmediateMask) | (pc & 0xF0000000); //return ((ValueHelper.FindUnsignedValue(input) & ASMValueHelper.JumpImmediateMask) >> 2) | (pc & 0xF0000000); return((ValueHelper.FindUnsignedValue(input) & ASMValueHelper.JumpImmediateMask) >> 2); }
private uint EncodeModifiedImmediate(string val, string addend, int length, uint mask) { return(EncodeImmediate(((int)ValueHelper.FindUnsignedValue(val) + (int)ValueHelper.FindUnsignedValue(addend) - 1), length, mask)); }
private uint EncodeDecrementedImmediate(string val, int length, uint mask) { return(EncodeImmediate(((int)ValueHelper.FindUnsignedValue(val) - 1), length, mask)); }
private uint EncodeBranchImmediate(string val, uint pc, uint mask) { return(EncodeBranchImmediate(ValueHelper.FindUnsignedValue(val), pc, mask)); }
private uint EncodeModifiedImmediate(string val, string addend, int length, uint mask, bool skipLabelAssertion = false) { return(EncodeImmediate(((int)ValueHelper.FindUnsignedValue(val, skipLabelAssertion) + (int)ValueHelper.FindUnsignedValue(addend, skipLabelAssertion) - 1), length, mask)); }
private uint EncodeDecrementedImmediate(string val, int length, uint mask, bool skipLabelAssertion = false) { return(EncodeImmediate(((int)ValueHelper.FindUnsignedValue(val, skipLabelAssertion) - 1), length, mask)); }
private uint EncodeBranchImmediate(string val, uint pc, uint mask, bool skipLabelAssertion = false) { return(EncodeBranchImmediate(ValueHelper.FindUnsignedValue(val, skipLabelAssertion), pc, mask)); }
// Chops off first four and last two bits of 32-bit immediate, as specified by MIPS J-type format private uint EncodeJumpImmediate(string input, bool skipLabelAssertion = false) { return((ValueHelper.FindUnsignedValue(input, skipLabelAssertion) & ASMValueHelper.JumpImmediateMask) >> 2); }