75 unsigned int encoding,
76 unsigned int extraBits) {
82 for (
int i = 0; i < socketEncodings; i++) {
87 encoding, extraBits, existingEnc.
encoding(),
90 +
static_cast<int>(extraBits) ||
99 for (
int i = 0; i < bridgeEncodings; i++) {
102 encodingWidth, existingEnc.
width(), field);
104 encoding, extraBits, existingEnc.
encoding(),
106 if (commonBits ==
static_cast<int>(
108 static_cast<int>(extraBits) ||
109 commonBits == existingEnc.
width()) {
117 encodingWidth, immEnc.
width(), field);
123 static_cast<int>(extraBits) ||
124 commonBits == immEnc.
width()) {
132 encodingWidth, nopEnc.
width(), field);
136 if (commonBits ==
static_cast<int>(
138 static_cast<int>(extraBits) ||
139 commonBits == nopEnc.
width()) {
181 MoveSlot& slot,
unsigned int encoding,
unsigned int extraBits,
185 unsigned truncatedEnc;
186 unsigned truncatedWidth;
189 if (encWidth + offset > slot.
width()) {
198 std::tie(truncatedEnc, truncatedWidth, offsetInField) =
splitEncoding(
204 truncatedWidth, offsetInField);
209 std::tie(truncatedEnc, truncatedWidth, offsetInField) =
splitEncoding(
214 field, truncatedEnc, truncatedWidth, offsetInField);
219 std::tie(truncatedEnc, truncatedWidth, offsetInField) =
splitEncoding(
224 field, truncatedEnc, truncatedWidth, offsetInField);
249 unsigned int encoding,
250 unsigned int extraBits) {
255 for (
int i = 0; i < fuPortEncodings; i++) {
260 if (commonBits == encodingWidth ||
267 for (
int i = 0; i < rfPortEncodings; i++) {
272 if (commonBits == encodingWidth ||
279 for (
int i = 0; i < iuPortEncodings; i++) {
284 if (commonBits == encodingWidth ||
311 unsigned int extraBits1,
313 unsigned int extraBits2,
322 enc2Offset = alignment;
323 }
else if (alignment < 0) {
324 enc1Offset = alignment * (-1);
330 while (enc1Offset <= maxEnc1Offset && enc2Offset <= maxEnc2Offset) {
353 unsigned int enc1Width,
354 unsigned int enc2Width,
360 return enc2Width - enc1Width;
408 unsigned width1,
int pos1,
unsigned width2,
int pos2) {
411 pos1 +
static_cast<int>(width1),
412 pos2 +
static_cast<int>(width2)) -
413 std::max(pos1, pos2)) > 0;
431 const GuardField& field,
unsigned int encoding,
unsigned int ,
489 const SourceField& field,
unsigned int encoding,
unsigned int width,
491 unsigned truncatedEncoding;
492 unsigned truncatedWidth;
493 unsigned truncatedOffset;
501 std::tie(truncatedEncoding, truncatedWidth, truncatedOffset) =
504 socketEnc.
encoding(), truncatedOffset, truncatedEncoding, 0,
509 std::tie(truncatedEncoding, truncatedWidth, truncatedOffset) =
511 encoding, width, scTable.
width(),
513 bool socketCodeOverlap = truncatedWidth > 0;
515 scTable, truncatedEncoding, truncatedWidth, truncatedOffset);
517 if (socketIDOverlap) {
518 if (socketCodeMatch && socketIDMatch && socketCodeMatch) {
520 }
else if (!socketCodeOverlap && socketIDMatch) {
523 }
else if (socketCodeOverlap && socketCodeMatch) {
531 std::tie(truncatedEncoding, truncatedWidth, truncatedOffset) =
537 simmEnc.
encoding(), truncatedOffset, truncatedEncoding, 0,
563 unsigned truncatedEncoding;
564 unsigned truncatedWidth;
565 unsigned truncatedOffset;
569 std::tie(truncatedEncoding, truncatedWidth, truncatedOffset) =
576 socketEnc.
encoding(), truncatedOffset, truncatedEncoding, 0,
581 std::tie(truncatedEncoding, truncatedWidth, truncatedOffset) =
583 encoding, width, scTable.
width(),
586 bool socketCodeOverlap = truncatedWidth > 0;
588 scTable, truncatedEncoding, truncatedWidth, truncatedOffset);
590 if (socketIDOverlap) {
591 if (socketCodeOverlap && socketIDMatch && socketCodeMatch) {
593 }
else if (!socketCodeOverlap && socketIDMatch) {
596 }
else if (socketCodeOverlap && socketCodeMatch) {
619 const SocketCodeTable& scTable,
unsigned int encoding,
unsigned int width,
676 std::tuple<unsigned, unsigned, int>
678 unsigned encoding,
unsigned encodingWidth,
unsigned targetWidth,
679 int offsetToTarget) {
680 long int resultWidth =
682 static_cast<int>(targetWidth),
683 offsetToTarget +
static_cast<int>(encodingWidth)) -
684 std::max(0, offsetToTarget);
686 if (offsetToTarget >
static_cast<int>(targetWidth) || resultWidth <= 0) {
687 return std::make_tuple(0, 0, 0);
690 unsigned resultEncoding = encoding;
691 int resultOffset = offsetToTarget;
693 if (offsetToTarget < 0) {
694 assert(-offsetToTarget < 32 &&
"Invalid shift amount.");
695 resultEncoding = resultEncoding >> -offsetToTarget;
698 assert(resultWidth < 32 &&
"Invalid shift amount.");
699 unsigned mask = ~(~(0u) << resultWidth);
700 resultEncoding &= mask;
701 return std::make_tuple(resultEncoding, resultWidth, resultOffset);
712 std::tuple<unsigned, unsigned, int>
715 unsigned encodingWidth,
int offsetToTarget) {