OpenASIP  2.0
Functions
ViewBEM.cc File Reference
#include <iostream>
#include <string>
#include "BEMViewerCmdLineOptions.hh"
#include "BEMSerializer.hh"
#include "BinaryEncoding.hh"
#include "ImmediateControlField.hh"
#include "MoveSlot.hh"
#include "ImmediateSlotField.hh"
#include "LImmDstRegisterField.hh"
#include "GuardField.hh"
#include "DestinationField.hh"
#include "SourceField.hh"
#include "GPRGuardEncoding.hh"
#include "FUGuardEncoding.hh"
#include "UnconditionalGuardEncoding.hh"
#include "ImmediateEncoding.hh"
#include "BridgeEncoding.hh"
#include "NOPEncoding.hh"
#include "SocketEncoding.hh"
#include "SocketCodeTable.hh"
#include "FUPortCode.hh"
#include "RFPortCode.hh"
#include "IUPortCode.hh"
#include "Conversion.hh"
#include "FileSystem.hh"
Include dependency graph for ViewBEM.cc:

Go to the source code of this file.

Functions

static void printBEMInfo (const BinaryEncoding &bem, const std::string &bemFile)
 
static void printInstructionLayout (const BinaryEncoding &bem)
 
static void printImmediateControlField (const BinaryEncoding &bem)
 
static void printLImmDstRegisterField (const LImmDstRegisterField &field)
 
static void printMoveSlot (const MoveSlot &moveSlot)
 
static void printMoveSlotLayout (const MoveSlot &moveSlot)
 
static void printGuardFieldEncodings (const MoveSlot &moveSlot)
 
static void printSlotFieldEncodings (const SlotField &slotField)
 
static string portCodeBits (const PortCode &code)
 
static string portCodeDescription (const RFPortCode &code)
 
static string portCodeDescription (const IUPortCode &code)
 
static string portCodeDescription (const FUPortCode &code)
 
static void printSourceFieldEncodings (const MoveSlot &moveSlot)
 
static void printDestinationFieldEncodings (const MoveSlot &moveSlot)
 
static void printSeparator ()
 
static void printPattern (const std::string &pattern, int times)
 
int main (int argc, char *argv[])
 

Detailed Description

Implements the viewbem application which prints out human readable information of given binary encoding map.

Author
Lasse Laasonen 2006 (lasse.laasonen-no.spam-tut.fi)
Note
rating: red

Definition in file ViewBEM.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

The main function.

Definition at line 104 of file ViewBEM.cc.

104  {
105 
107  try {
108  options.parse(argv, argc);
109  } catch (ParserStopRequest) {
110  return EXIT_SUCCESS;
111  } catch (const IllegalCommandLine& e) {
112  cerr << e.errorMessage() << endl;
113  return EXIT_FAILURE;
114  }
115 
116  string bemFile = options.bemFile();
117  if (bemFile == "") {
118  options.printHelp();
119  return EXIT_FAILURE;
120  }
121 
122  BEMSerializer serializer;
123  serializer.setSourceFile(bemFile);
124  BinaryEncoding* bem;
125  try {
126  bem = serializer.readBinaryEncoding();
127  } catch (const Exception& e) {
128  cerr << e.errorMessage() << endl;
129  return EXIT_FAILURE;
130  }
131 
132  printBEMInfo(*bem, bemFile);
133  delete bem;
134  return EXIT_SUCCESS;
135 }

References Exception::errorMessage(), options, CmdLineOptions::parse(), printBEMInfo(), MachInfoCmdLineOptions::printHelp(), BEMSerializer::readBinaryEncoding(), and XMLSerializer::setSourceFile().

Here is the call graph for this function:

◆ portCodeBits()

static string portCodeBits ( const PortCode code)
static

Returns the bit string of the given port code.

Parameters
codeThe port code.

Definition at line 506 of file ViewBEM.cc.

506  {
507  string bits;
508  if (code.hasEncoding() && code.encodingWidth()) {
509  bits += Conversion::toBinary(
510  code.encoding(), code.encodingWidth());
511  }
512  int unusedBits = code.parent()->width() - code.width();
513  for (int i = 0; i < unusedBits; i++) {
514  bits.append("X");
515  }
516  for (int i = 0; i < code.indexWidth(); i++) {
517  bits.append("R");
518  }
519  return bits;
520 }

References PortCode::encoding(), PortCode::encodingWidth(), PortCode::hasEncoding(), PortCode::indexWidth(), PortCode::parent(), Conversion::toBinary(), PortCode::width(), and SocketCodeTable::width().

Referenced by printSlotFieldEncodings().

Here is the call graph for this function:

◆ portCodeDescription() [1/3]

static string portCodeDescription ( const FUPortCode code)
static

Returns description of the given port code.

Parameters
codeThe port code.

Definition at line 551 of file ViewBEM.cc.

551  {
552  string desc = "FU port: " + code.unitName() + ", " + code.portName();
553  if (code.hasOperation()) {
554  desc.append(", " + code.operationName());
555  }
556  return desc;
557 }

References FUPortCode::hasOperation(), FUPortCode::operationName(), FUPortCode::portName(), and PortCode::unitName().

Here is the call graph for this function:

◆ portCodeDescription() [2/3]

static string portCodeDescription ( const IUPortCode code)
static

Returns description of the given port code.

Parameters
codeThe port code.

Definition at line 540 of file ViewBEM.cc.

540  {
541  return "IU: " + code.unitName();
542 }

References PortCode::unitName().

Here is the call graph for this function:

◆ portCodeDescription() [3/3]

static string portCodeDescription ( const RFPortCode code)
static

Returns description of the given port code.

Parameters
codeThe port code.

Definition at line 529 of file ViewBEM.cc.

529  {
530  return "RF: " + code.unitName();
531 }

References PortCode::unitName().

Referenced by printSlotFieldEncodings().

Here is the call graph for this function:

◆ printBEMInfo()

static void printBEMInfo ( const BinaryEncoding bem,
const std::string &  bemFile 
)
static

Prints information of BEM to standard output.

Parameters
bemThe BEM.
bemFileName of the BEM file.

Definition at line 145 of file ViewBEM.cc.

145  {
146 
147  cout << "Binary Encoding Map: " << FileSystem::fileOfPath(bemFile)
148  << endl << endl;
149  cout << "X = unused bit" << endl;
150  cout << "I = immediate bit" << endl;
151  cout << "S = socket code bit" << endl;
152  cout << "R = register index bit" << endl << endl;
153 
154  cout << "Total instruction width: " << bem.width() << endl << endl;
155 
157  cout << endl;
159  cout << endl;
160  for (int i = 0; i < bem.longImmDstRegisterFieldCount(); i++) {
163  cout << endl;
164  }
165  for (int i = 0; i < bem.moveSlotCount(); i++) {
166  MoveSlot& slot = bem.moveSlot(i);
167  printMoveSlot(slot);
168  cout << endl;
169  }
170 }

References FileSystem::fileOfPath(), BinaryEncoding::longImmDstRegisterField(), BinaryEncoding::longImmDstRegisterFieldCount(), BinaryEncoding::moveSlot(), BinaryEncoding::moveSlotCount(), printImmediateControlField(), printInstructionLayout(), printLImmDstRegisterField(), printMoveSlot(), and BinaryEncoding::width().

Referenced by main().

Here is the call graph for this function:

◆ printDestinationFieldEncodings()

static void printDestinationFieldEncodings ( const MoveSlot moveSlot)
static

Prints the encodings of the destination field of the given move slot.

Parameters
moveSlotThe move slot.

Definition at line 622 of file ViewBEM.cc.

622  {
623 
624  if (!moveSlot.hasDestinationField()) {
625  return;
626  }
627 
628  DestinationField& dstField = moveSlot.destinationField();
629  cout << "Destination field encodings:" << endl;
630  printSlotFieldEncodings(dstField);
631 }

References MoveSlot::destinationField(), MoveSlot::hasDestinationField(), and printSlotFieldEncodings().

Referenced by printMoveSlot().

Here is the call graph for this function:

◆ printGuardFieldEncodings()

static void printGuardFieldEncodings ( const MoveSlot moveSlot)
static

Prints the encodings of the guard field of the given move slot.

Parameters
moveSlotThe move slot.

Definition at line 327 of file ViewBEM.cc.

327  {
328 
329  if (!moveSlot.hasGuardField()) {
330  return;
331  }
332 
333  GuardField& grdField = moveSlot.guardField();
334  int encodingWidth = grdField.width() - grdField.extraBits();
335  string extraBits;
336  for (int i = 0; i < grdField.extraBits(); i++) {
337  extraBits.append("X");
338  }
339 
340  cout << "Guard field encodings:" << endl;
341  if (grdField.hasUnconditionalGuardEncoding(false)) {
343  grdField.unconditionalGuardEncoding(false);
344  cout << extraBits
345  << Conversion::toBinary(enc.encoding(), encodingWidth)
346  << " : always-true" << endl;
347  }
348  if (grdField.hasUnconditionalGuardEncoding(true)) {
350  grdField.unconditionalGuardEncoding(true);
351  cout << extraBits
352  << Conversion::toBinary(enc.encoding(), encodingWidth)
353  << " : always-false" << endl;
354  }
355  for (int i = 0; i < grdField.gprGuardEncodingCount(); i++) {
356  GPRGuardEncoding& enc = grdField.gprGuardEncoding(i);
357  cout << extraBits
358  << Conversion::toBinary(enc.encoding(), encodingWidth)
359  << " : ";
360  if (enc.isGuardInverted()) {
361  cout << "inverted ";
362  } else {
363  cout << "non-inverted ";
364  }
365  cout << "GPR " << enc.registerIndex() << " of RF "
366  << enc.registerFile() << endl;
367  }
368  for (int i = 0; i < grdField.fuGuardEncodingCount(); i++) {
369  FUGuardEncoding& enc = grdField.fuGuardEncoding(i);
370  cout << extraBits
371  << Conversion::toBinary(enc.encoding(), encodingWidth) << " : ";
372  if (enc.isGuardInverted()) {
373  cout << "inverted ";
374  } else {
375  cout << "non-inverted ";
376  }
377  cout << "port " << enc.port() << " of FU " << enc.functionUnit()
378  << endl;
379  }
380 }

References GuardEncoding::encoding(), InstructionField::extraBits(), GuardField::fuGuardEncoding(), GuardField::fuGuardEncodingCount(), FUGuardEncoding::functionUnit(), GuardField::gprGuardEncoding(), GuardField::gprGuardEncodingCount(), MoveSlot::guardField(), MoveSlot::hasGuardField(), GuardField::hasUnconditionalGuardEncoding(), GuardEncoding::isGuardInverted(), FUGuardEncoding::port(), GPRGuardEncoding::registerFile(), GPRGuardEncoding::registerIndex(), Conversion::toBinary(), GuardField::unconditionalGuardEncoding(), and GuardField::width().

Referenced by printMoveSlot().

Here is the call graph for this function:

◆ printImmediateControlField()

static void printImmediateControlField ( const BinaryEncoding bem)
static

Prints information of immediate control field of the given BEM.

Parameters
bemThe BEM.

Definition at line 220 of file ViewBEM.cc.

220  {
221 
222  if (!bem.hasImmediateControlField()) {
223  return;
224  }
225 
227  printSeparator();
228  cout << "Immediate Control Field" << endl << endl;
229  cout << "Position: " << icField.bitPosition() << endl;
230  cout << "Width: " << icField.width() << endl;
231  cout << "Encodings:" << endl;
232 
233  int encodingWidth = icField.width() - icField.extraBits();
234  string extraBits;
235  for (int i = 0; i < icField.extraBits(); i++) {
236  extraBits.append("X");
237  }
238 
239  for (int i = 0; i < icField.templateCount(); i++) {
240  string iTemp = icField.instructionTemplate(i);
241  unsigned int encoding = icField.templateEncoding(iTemp);
242  cout << extraBits << Conversion::toBinary(encoding, encodingWidth)
243  << " : " << iTemp << endl;
244  }
245 }

References InstructionField::bitPosition(), InstructionField::extraBits(), BinaryEncoding::hasImmediateControlField(), BinaryEncoding::immediateControlField(), ImmediateControlField::instructionTemplate(), printSeparator(), ImmediateControlField::templateCount(), ImmediateControlField::templateEncoding(), Conversion::toBinary(), and ImmediateControlField::width().

Referenced by printBEMInfo().

Here is the call graph for this function:

◆ printInstructionLayout()

static void printInstructionLayout ( const BinaryEncoding bem)
static

Prints the instruction layout of the given BEM.

Parameters
bemThe BEM.

Definition at line 179 of file ViewBEM.cc.

179  {
180 
181  if (bem.childFieldCount() == 0) {
182  return;
183  }
184 
185  cout << "|";
186  for (int i = bem.childFieldCount() - 1; i >= 0; i--) {
187  InstructionField& field = bem.childField(i);
188  ImmediateControlField* icField =
189  dynamic_cast<ImmediateControlField*>(&field);
190  MoveSlot* moveSlot = dynamic_cast<MoveSlot*>(&field);
191  ImmediateSlotField* immSlot =
192  dynamic_cast<ImmediateSlotField*>(&field);
193  LImmDstRegisterField* dstRegField =
194  dynamic_cast<LImmDstRegisterField*>(&field);
195 
196  if (icField != NULL) {
197  cout << " limm cntrl: " << field.width();
198  } else if (moveSlot != NULL) {
199  cout << " move slot " << moveSlot->name() << ": "
200  << moveSlot->width();
201  } else if (immSlot != NULL) {
202  cout << " limm slot " << immSlot->name() << ": "
203  << immSlot->width();
204  } else {
205  assert(dstRegField != NULL);
206  cout << " dst reg field: " << dstRegField->width();
207  }
208  cout << " |";
209  }
210  cout << endl;
211 }

References assert, BinaryEncoding::childField(), BinaryEncoding::childFieldCount(), ImmediateSlotField::name(), MoveSlot::name(), ImmediateSlotField::width(), InstructionField::width(), LImmDstRegisterField::width(), and MoveSlot::width().

Referenced by printBEMInfo().

Here is the call graph for this function:

◆ printLImmDstRegisterField()

static void printLImmDstRegisterField ( const LImmDstRegisterField field)
static

Prints information of the given long immediate destination register field.

Parameters
fieldThe field.

Definition at line 254 of file ViewBEM.cc.

254  {
255 
256  printSeparator();
257  cout << "Long Immediate Destination Register Field" << endl << endl;
258  cout << "Position: " << field.bitPosition() << endl;
259  cout << "Width: " << field.width() << endl << endl;
260 
261  cout << "Usage" << endl;
262  for (int i = 0; i < field.instructionTemplateCount(); i++) {
263  string iTemp = field.instructionTemplate(i);
264  string iu = field.immediateUnit(iTemp);
265  cout << iTemp << ": " << iu << endl;
266  }
267 }

References InstructionField::bitPosition(), LImmDstRegisterField::immediateUnit(), LImmDstRegisterField::instructionTemplate(), LImmDstRegisterField::instructionTemplateCount(), printSeparator(), and LImmDstRegisterField::width().

Referenced by printBEMInfo().

Here is the call graph for this function:

◆ printMoveSlot()

static void printMoveSlot ( const MoveSlot moveSlot)
static

Prints information of the given move slot.

Parameters
moveSlotThe move slot.

Definition at line 276 of file ViewBEM.cc.

276  {
277 
278  printSeparator();
279  cout << "Move Slot: " << moveSlot.name() << endl << endl;
280  cout << "Position: " << moveSlot.bitPosition() << endl;
281  cout << "Width: " << moveSlot.width() << endl << endl;
282 
283  printMoveSlotLayout(moveSlot);
284  cout << endl;
285  printGuardFieldEncodings(moveSlot);
286  cout << endl;
287  printSourceFieldEncodings(moveSlot);
288  cout << endl;
290 }

References InstructionField::bitPosition(), MoveSlot::name(), printDestinationFieldEncodings(), printGuardFieldEncodings(), printMoveSlotLayout(), printSeparator(), printSourceFieldEncodings(), and MoveSlot::width().

Referenced by printBEMInfo().

Here is the call graph for this function:

◆ printMoveSlotLayout()

static void printMoveSlotLayout ( const MoveSlot moveSlot)
static

Prints the layout of the given move slot.

Parameters
moveSlotThe move slot.

Definition at line 299 of file ViewBEM.cc.

299  {
300  cout << "|";
301  for (int i = moveSlot.childFieldCount() - 1; i >= 0; i--) {
302  InstructionField& childField = moveSlot.childField(i);
303  GuardField* grdField = dynamic_cast<GuardField*>(&childField);
304  SourceField* srcField = dynamic_cast<SourceField*>(&childField);
305  DestinationField* dstField =
306  dynamic_cast<DestinationField*>(&childField);
307  if (grdField != NULL) {
308  cout << " grd field: " << grdField->width();
309  } else if (srcField != NULL) {
310  cout << " src field: " << srcField->width();
311  } else {
312  assert(dstField != NULL);
313  cout << " dst field: " << dstField->width();
314  }
315  cout << " |";
316  }
317  cout << endl;
318 }

References assert, MoveSlot::childField(), MoveSlot::childFieldCount(), SourceField::width(), SlotField::width(), and GuardField::width().

Referenced by printMoveSlot().

Here is the call graph for this function:

◆ printPattern()

static void printPattern ( const std::string &  pattern,
int  times 
)
static

Prints the given pattern the given times.

Parameters
patternThe pattern.
timesTimes the pattern is written.

Definition at line 651 of file ViewBEM.cc.

651  {
652  for (int i = 0; i < times; i++) {
653  cout << pattern;
654  }
655 }

Referenced by printSlotFieldEncodings(), and printSourceFieldEncodings().

◆ printSeparator()

static void printSeparator ( )
static

Prints the separator.

Definition at line 638 of file ViewBEM.cc.

638  {
639  cout << "------------------------------------------------------------"
640  << endl;
641 }

Referenced by printImmediateControlField(), printLImmDstRegisterField(), and printMoveSlot().

◆ printSlotFieldEncodings()

static void printSlotFieldEncodings ( const SlotField slotField)
static

Prints the socket and NOP encodings of the given slot field.

Parameters
slotFieldThe source or destination field.

Definition at line 389 of file ViewBEM.cc.

389  {
390 
391  if (slotField.hasNoOperationEncoding()) {
392  NOPEncoding& enc = slotField.noOperationEncoding();
393  if (slotField.componentIDPosition() == BinaryEncoding::RIGHT) {
394  printPattern("X", slotField.width() - enc.width());
395  if (enc.width()) {
396  cout << Conversion::toBinary(enc.encoding(), enc.width());
397  }
398  } else {
399  printPattern("X", slotField.extraBits());
400  if (enc.width()) {
401  cout << Conversion::toBinary(enc.encoding(), enc.width());
402  }
403  printPattern(
404  "X",
405  slotField.width() - slotField.extraBits() - enc.width());
406  }
407  cout << " : NOP" << endl;
408  }
409 
410  for (int i = 0; i < slotField.socketEncodingCount(); i++) {
411  SocketEncoding& enc = slotField.socketEncoding(i);
412  printPattern("X", slotField.extraBits());
413  if (slotField.componentIDPosition() == BinaryEncoding::RIGHT) {
414  if (enc.hasSocketCodes()) {
415  SocketCodeTable& scTable = enc.socketCodes();
416  printPattern("S", scTable.width());
417  printPattern(
418  "X",
419  slotField.width() - slotField.extraBits() -
420  scTable.width() - enc.socketIDWidth());
421  } else {
422  printPattern(
423  "X",
424  slotField.width() - slotField.extraBits() -
425  enc.socketIDWidth());
426  }
427  if (enc.socketIDWidth()) {
428  cout <<
430  }
431  } else {
432  if (enc.socketIDWidth()) {
433  cout <<
435  }
436  if (enc.hasSocketCodes()) {
437  SocketCodeTable& scTable = enc.socketCodes();
438  printPattern(
439  "X",
440  slotField.width() - slotField.extraBits() -
441  scTable.width() - enc.socketIDWidth());
442  printPattern("S", scTable.width());
443  } else {
444  printPattern(
445  "X",
446  slotField.width() - slotField.extraBits() - enc.width());
447  }
448  }
449  cout << " : socket " << enc.socketName() << endl;
450 
451  if (enc.hasSocketCodes()) {
452  SocketCodeTable& scTable = enc.socketCodes();
453  if (slotField.componentIDPosition() == BinaryEncoding::RIGHT) {
454  for (int i = 0; i < scTable.rfPortCodeCount(); i++) {
455  printPattern(" ", slotField.extraBits());
456  RFPortCode& code = scTable.rfPortCode(i);
457  cout << portCodeBits(code);
458  printPattern(" ", enc.width() - scTable.width());
459  cout << " : " << portCodeDescription(code) << endl;
460  }
461  for (int i = 0; i < scTable.iuPortCodeCount(); i++) {
462  printPattern(" ", slotField.extraBits());
463  IUPortCode& code = scTable.iuPortCode(i);
464  cout << portCodeBits(code);
465  printPattern(" ", enc.width() - scTable.width());
466  cout << " : " << portCodeDescription(code) << endl;
467  }
468  for (int i = 0; i < scTable.fuPortCodeCount(); i++) {
469  printPattern(" ", slotField.extraBits());
470  FUPortCode& code = scTable.fuPortCode(i);
471  cout << portCodeBits(code);
472  printPattern(" ", enc.width() - scTable.width());
473  cout << " : " << portCodeDescription(code) << endl;
474  }
475  } else {
476  for (int i = 0; i < scTable.rfPortCodeCount(); i++) {
477  printPattern(" ", slotField.width() - scTable.width());
478  RFPortCode& code = scTable.rfPortCode(i);
479  cout << portCodeBits(code);
480  cout << " : " << portCodeDescription(code) << endl;
481  }
482  for (int i = 0; i < scTable.iuPortCodeCount(); i++) {
483  printPattern(" ", slotField.width() - scTable.width());
484  IUPortCode& code = scTable.iuPortCode(i);
485  cout << portCodeBits(code);
486  cout << " : " << portCodeDescription(code) << endl;
487  }
488  for (int i = 0; i < scTable.fuPortCodeCount(); i++) {
489  printPattern(" ", slotField.width() - scTable.width());
490  FUPortCode& code = scTable.fuPortCode(i);
491  cout << portCodeBits(code);
492  cout << " : " << portCodeDescription(code) << endl;
493  }
494  }
495  }
496  }
497 }

References SlotField::componentIDPosition(), Encoding::encoding(), InstructionField::extraBits(), SocketCodeTable::fuPortCode(), SocketCodeTable::fuPortCodeCount(), SlotField::hasNoOperationEncoding(), SocketEncoding::hasSocketCodes(), SocketCodeTable::iuPortCode(), SocketCodeTable::iuPortCodeCount(), SlotField::noOperationEncoding(), portCodeBits(), portCodeDescription(), printPattern(), SocketCodeTable::rfPortCode(), SocketCodeTable::rfPortCodeCount(), BinaryEncoding::RIGHT, SocketEncoding::socketCodes(), SlotField::socketEncoding(), SlotField::socketEncodingCount(), SocketEncoding::socketIDWidth(), SocketEncoding::socketName(), Conversion::toBinary(), Encoding::width(), SocketEncoding::width(), SlotField::width(), and SocketCodeTable::width().

Referenced by printDestinationFieldEncodings(), and printSourceFieldEncodings().

Here is the call graph for this function:

◆ printSourceFieldEncodings()

static void printSourceFieldEncodings ( const MoveSlot moveSlot)
static

Prints the encodings of the source field of the given move slot.

Parameters
moveSlotThe move slot.

Definition at line 566 of file ViewBEM.cc.

566  {
567 
568  if (!moveSlot.hasSourceField()) {
569  return;
570  }
571 
572  SourceField& srcField = moveSlot.sourceField();
573  cout << "Source field encodings:" << endl;
574  printSlotFieldEncodings(srcField);
575 
576  if (srcField.hasImmediateEncoding()) {
577  ImmediateEncoding& enc = srcField.immediateEncoding();
578  printPattern("X", srcField.extraBits());
579  if (srcField.componentIDPosition() == BinaryEncoding::LEFT) {
580  if (enc.encodingWidth()) {
581  cout << Conversion::toBinary(
582  enc.encoding(), enc.encodingWidth());
583  }
584  printPattern(
585  "X", srcField.width() - srcField.extraBits() - enc.width());
586  printPattern("I", enc.immediateWidth());
587  } else {
588  printPattern("I", enc.immediateWidth());
589  printPattern(
590  "X", srcField.width() - srcField.extraBits() - enc.width());
591  if (enc.encodingWidth()) {
592  cout << Conversion::toBinary(
593  enc.encoding(), enc.encodingWidth());
594  }
595  }
596  cout << " : short immediate" << endl;
597  }
598 
599  for (int i = 0; i < srcField.bridgeEncodingCount(); i++) {
600  BridgeEncoding& enc = srcField.bridgeEncoding(i);
601  printPattern("X", srcField.extraBits());
602  if (srcField.componentIDPosition() == BinaryEncoding::RIGHT) {
603  printPattern(
604  "X", srcField.width() - srcField.extraBits() - enc.width());
605  cout << Conversion::toBinary(enc.encoding(), enc.width());
606  } else {
607  cout << Conversion::toBinary(enc.encoding(), enc.width());
608  printPattern(
609  "X", srcField.width() - srcField.extraBits() - enc.width());
610  }
611  cout << " : bridge " << enc.bridgeName() << endl;
612  }
613 }

References SourceField::bridgeEncoding(), SourceField::bridgeEncodingCount(), BridgeEncoding::bridgeName(), SlotField::componentIDPosition(), Encoding::encoding(), ImmediateEncoding::encodingWidth(), InstructionField::extraBits(), SourceField::hasImmediateEncoding(), MoveSlot::hasSourceField(), SourceField::immediateEncoding(), ImmediateEncoding::immediateWidth(), BinaryEncoding::LEFT, printPattern(), printSlotFieldEncodings(), BinaryEncoding::RIGHT, MoveSlot::sourceField(), Conversion::toBinary(), Encoding::width(), ImmediateEncoding::width(), and SourceField::width().

Referenced by printMoveSlot().

Here is the call graph for this function:
BinaryEncoding::childFieldCount
virtual int childFieldCount() const
Definition: BinaryEncoding.cc:681
SlotField::noOperationEncoding
NOPEncoding & noOperationEncoding() const
Definition: SlotField.cc:281
MachInfoCmdLineOptions::printHelp
virtual void printHelp() const
Definition: MachInfoCmdLineOptions.cc:89
BinaryEncoding
Definition: BinaryEncoding.hh:61
MoveSlot::name
std::string name() const
Definition: MoveSlot.cc:136
FUPortCode::operationName
std::string operationName() const
Definition: FUPortCode.cc:160
InstructionField::bitPosition
int bitPosition() const
Definition: InstructionField.cc:132
ParserStopRequest
Definition: Exception.hh:491
SocketCodeTable::rfPortCodeCount
int rfPortCodeCount() const
Definition: SocketCodeTable.cc:471
DestinationField
Definition: DestinationField.hh:44
MoveSlot
Definition: MoveSlot.hh:60
XMLSerializer::setSourceFile
void setSourceFile(const std::string &fileName)
Definition: XMLSerializer.cc:115
printSlotFieldEncodings
static void printSlotFieldEncodings(const SlotField &slotField)
Definition: ViewBEM.cc:389
GuardField::fuGuardEncoding
FUGuardEncoding & fuGuardEncoding(int index) const
Definition: GuardField.cc:387
portCodeDescription
static string portCodeDescription(const RFPortCode &code)
Definition: ViewBEM.cc:529
GPRGuardEncoding::registerFile
std::string registerFile() const
Definition: GPRGuardEncoding.cc:122
BinaryEncoding::longImmDstRegisterFieldCount
int longImmDstRegisterFieldCount() const
Definition: BinaryEncoding.cc:400
SocketCodeTable::fuPortCode
FUPortCode & fuPortCode(int index) const
Definition: SocketCodeTable.cc:308
SourceField::hasImmediateEncoding
bool hasImmediateEncoding() const
Definition: SourceField.cc:279
GuardEncoding::isGuardInverted
bool isGuardInverted() const
Definition: GuardEncoding.cc:101
LImmDstRegisterField::instructionTemplateCount
int instructionTemplateCount() const
Definition: LImmDstRegisterField.cc:148
BinaryEncoding::hasImmediateControlField
bool hasImmediateControlField() const
Definition: BinaryEncoding.cc:334
IUPortCode
Definition: IUPortCode.hh:41
BridgeEncoding
Definition: BridgeEncoding.hh:47
MoveSlot::hasGuardField
bool hasGuardField() const
Definition: MoveSlot.cc:202
SocketCodeTable::rfPortCode
RFPortCode & rfPortCode(int index) const
Definition: SocketCodeTable.cc:484
RFPortCode
Definition: RFPortCode.hh:44
FUPortCode
Definition: FUPortCode.hh:47
GuardField
Definition: GuardField.hh:55
SocketCodeTable::fuPortCodeCount
int fuPortCodeCount() const
Definition: SocketCodeTable.cc:295
ImmediateControlField::templateCount
int templateCount() const
Definition: ImmediateControlField.cc:124
IllegalCommandLine
Definition: Exception.hh:438
GuardField::unconditionalGuardEncoding
UnconditionalGuardEncoding & unconditionalGuardEncoding(bool inverted) const
Definition: GuardField.cc:490
SlotField::hasNoOperationEncoding
bool hasNoOperationEncoding() const
Definition: SlotField.cc:267
SocketEncoding::width
virtual int width() const
Definition: SocketEncoding.cc:276
BEMSerializer
Definition: BEMSerializer.hh:43
FUGuardEncoding
Definition: FUGuardEncoding.hh:47
SlotField::socketEncoding
SocketEncoding & socketEncoding(int index) const
Definition: SlotField.cc:170
ImmediateEncoding::width
virtual int width() const
Definition: ImmediateEncoding.cc:207
FileSystem::fileOfPath
static std::string fileOfPath(const std::string pathName)
Definition: FileSystem.cc:101
printMoveSlotLayout
static void printMoveSlotLayout(const MoveSlot &moveSlot)
Definition: ViewBEM.cc:299
ImmediateSlotField
Definition: ImmediateSlotField.hh:44
InstructionField
Definition: InstructionField.hh:43
SocketCodeTable
Definition: SocketCodeTable.hh:68
PortCode::unitName
std::string unitName() const
Definition: PortCode.cc:140
assert
#define assert(condition)
Definition: Application.hh:86
printPattern
static void printPattern(const std::string &pattern, int times)
Definition: ViewBEM.cc:651
GuardField::gprGuardEncoding
GPRGuardEncoding & gprGuardEncoding(int index) const
Definition: GuardField.cc:290
Encoding::width
virtual int width() const
Definition: Encoding.cc:130
MoveSlot::hasSourceField
bool hasSourceField() const
Definition: MoveSlot.cc:264
Conversion::toBinary
static std::string toBinary(unsigned int source, unsigned int stringWidth=0)
Definition: Conversion.cc:155
FUGuardEncoding::functionUnit
std::string functionUnit() const
Definition: FUGuardEncoding.cc:121
LImmDstRegisterField::instructionTemplate
std::string instructionTemplate(int index) const
Definition: LImmDstRegisterField.cc:162
ImmediateControlField
Definition: ImmediateControlField.hh:57
ImmediateControlField::width
virtual int width() const
Definition: ImmediateControlField.cc:243
PortCode::indexWidth
int indexWidth() const
Definition: PortCode.cc:215
PortCode::width
int width() const
Definition: PortCode.cc:188
MoveSlot::guardField
GuardField & guardField() const
Definition: MoveSlot.cc:215
printImmediateControlField
static void printImmediateControlField(const BinaryEncoding &bem)
Definition: ViewBEM.cc:220
SourceField::immediateEncoding
ImmediateEncoding & immediateEncoding() const
Definition: SourceField.cc:293
MoveSlot::hasDestinationField
bool hasDestinationField() const
Definition: MoveSlot.cc:327
InstructionField::width
virtual int width() const =0
SocketCodeTable::iuPortCode
IUPortCode & iuPortCode(int index) const
Definition: SocketCodeTable.cc:600
BinaryEncoding::width
virtual int width(const TCEString &templateName) const
Definition: BinaryEncoding.cc:768
SocketEncoding::socketName
std::string socketName() const
Definition: SocketEncoding.cc:145
BinaryEncoding::LEFT
@ LEFT
Definition: BinaryEncoding.hh:64
printLImmDstRegisterField
static void printLImmDstRegisterField(const LImmDstRegisterField &field)
Definition: ViewBEM.cc:254
printMoveSlot
static void printMoveSlot(const MoveSlot &moveSlot)
Definition: ViewBEM.cc:276
LImmDstRegisterField::immediateUnit
std::string immediateUnit(const std::string &instructionTemplate) const
Definition: LImmDstRegisterField.cc:197
SlotField::width
virtual int width() const
Definition: SlotField.cc:307
SocketEncoding::hasSocketCodes
bool hasSocketCodes() const
Definition: SocketEncoding.cc:177
printSeparator
static void printSeparator()
Definition: ViewBEM.cc:638
SourceField::width
virtual int width() const
Definition: SourceField.cc:308
BridgeEncoding::bridgeName
std::string bridgeName() const
Definition: BridgeEncoding.cc:134
Encoding::encoding
unsigned int encoding() const
Definition: Encoding.cc:108
GuardField::hasUnconditionalGuardEncoding
bool hasUnconditionalGuardEncoding(bool inverted) const
Definition: GuardField.cc:471
SlotField::componentIDPosition
BinaryEncoding::Position componentIDPosition() const
Definition: SlotField.cc:296
LImmDstRegisterField::width
virtual int width() const
Definition: LImmDstRegisterField.cc:213
Exception
Definition: Exception.hh:54
GuardEncoding::encoding
unsigned int encoding() const
Definition: GuardEncoding.cc:112
MoveSlot::width
virtual int width() const
Definition: MoveSlot.cc:406
MoveSlot::sourceField
SourceField & sourceField() const
Definition: MoveSlot.cc:277
ImmediateSlotField::width
virtual int width() const
Definition: ImmediateSlotField.cc:167
NOPEncoding
Definition: NOPEncoding.hh:44
printBEMInfo
static void printBEMInfo(const BinaryEncoding &bem, const std::string &bemFile)
Definition: ViewBEM.cc:145
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
CmdLineOptions::parse
void parse(char *argv[], int argc)
Definition: CmdLineOptions.cc:107
PortCode::encodingWidth
int encodingWidth() const
Definition: PortCode.cc:204
options
static MachInfoCmdLineOptions options
Definition: MachInfo.cc:46
ImmediateEncoding::immediateWidth
int immediateWidth() const
Definition: ImmediateEncoding.cc:144
GuardField::gprGuardEncodingCount
int gprGuardEncodingCount() const
Definition: GuardField.cc:276
ImmediateControlField::instructionTemplate
std::string instructionTemplate(int index) const
Definition: ImmediateControlField.cc:138
ImmediateSlotField::name
std::string name() const
Definition: ImmediateSlotField.cc:123
InstructionField::extraBits
int extraBits() const
Definition: InstructionField.cc:229
ImmediateEncoding::encodingWidth
int encodingWidth() const
Definition: ImmediateEncoding.cc:155
SocketEncoding::socketIDWidth
int socketIDWidth() const
Definition: SocketEncoding.cc:264
SocketCodeTable::iuPortCodeCount
int iuPortCodeCount() const
Definition: SocketCodeTable.cc:587
GuardField::fuGuardEncodingCount
int fuGuardEncodingCount() const
Definition: GuardField.cc:373
MoveSlot::childField
virtual InstructionField & childField(int position) const
Definition: MoveSlot.cc:380
BinaryEncoding::RIGHT
@ RIGHT
Definition: BinaryEncoding.hh:65
FUPortCode::hasOperation
bool hasOperation() const
Definition: FUPortCode.cc:176
SourceField::bridgeEncodingCount
int bridgeEncodingCount() const
Definition: SourceField.cc:209
LImmDstRegisterField
Definition: LImmDstRegisterField.hh:47
SlotField::socketEncodingCount
int socketEncodingCount() const
Definition: SlotField.cc:156
FUGuardEncoding::port
std::string port() const
Definition: FUGuardEncoding.cc:132
printInstructionLayout
static void printInstructionLayout(const BinaryEncoding &bem)
Definition: ViewBEM.cc:179
BinaryEncoding::immediateControlField
ImmediateControlField & immediateControlField() const
Definition: BinaryEncoding.cc:348
printDestinationFieldEncodings
static void printDestinationFieldEncodings(const MoveSlot &moveSlot)
Definition: ViewBEM.cc:622
BinaryEncoding::moveSlot
MoveSlot & moveSlot(int index) const
Definition: BinaryEncoding.cc:121
PortCode::hasEncoding
bool hasEncoding() const
Definition: PortCode.cc:151
BinaryEncoding::childField
virtual InstructionField & childField(int position) const
Definition: BinaryEncoding.cc:704
MoveSlot::destinationField
DestinationField & destinationField() const
Definition: MoveSlot.cc:341
SourceField::bridgeEncoding
BridgeEncoding & bridgeEncoding(const std::string &bridge) const
Definition: SourceField.cc:191
ImmediateControlField::templateEncoding
unsigned int templateEncoding(const std::string &name) const
Definition: ImmediateControlField.cc:182
PortCode::parent
SocketCodeTable * parent() const
Definition: PortCode.cc:226
ImmediateEncoding
Definition: ImmediateEncoding.hh:44
BinaryEncoding::moveSlotCount
int moveSlotCount() const
Definition: BinaryEncoding.cc:104
GPRGuardEncoding::registerIndex
int registerIndex() const
Definition: GPRGuardEncoding.cc:133
printGuardFieldEncodings
static void printGuardFieldEncodings(const MoveSlot &moveSlot)
Definition: ViewBEM.cc:327
SocketEncoding::socketCodes
SocketCodeTable & socketCodes() const
Definition: SocketEncoding.cc:191
SocketEncoding
Definition: SocketEncoding.hh:51
GPRGuardEncoding
Definition: GPRGuardEncoding.hh:47
PortCode::encoding
unsigned int encoding() const
Definition: PortCode.cc:164
BinaryEncoding::longImmDstRegisterField
LImmDstRegisterField & longImmDstRegisterField(int index) const
Definition: BinaryEncoding.cc:415
UnconditionalGuardEncoding
Definition: UnconditionalGuardEncoding.hh:47
SocketCodeTable::width
int width() const
Definition: SocketCodeTable.cc:200
MoveSlot::childFieldCount
virtual int childFieldCount() const
Definition: MoveSlot.cc:357
GuardField::width
virtual int width() const
Definition: GuardField.cc:533
printSourceFieldEncodings
static void printSourceFieldEncodings(const MoveSlot &moveSlot)
Definition: ViewBEM.cc:566
BEMViewerCmdLineOptions
Definition: BEMViewerCmdLineOptions.hh:41
FUPortCode::portName
std::string portName() const
Definition: FUPortCode.cc:147
BEMSerializer::readBinaryEncoding
BinaryEncoding * readBinaryEncoding()
Definition: BEMSerializer.cc:258
portCodeBits
static string portCodeBits(const PortCode &code)
Definition: ViewBEM.cc:506
SourceField
Definition: SourceField.hh:48