Go to the documentation of this file.
34 #include <boost/format.hpp>
101 for (
int i = 0; i < busNav.
count(); i++) {
109 for (
int i = 0; i < immSlotNav.
count(); i++) {
122 string errorMsg(
"Error: Couldn't find GCU from machine");
207 format errorMsg(
"BEM does not contain move slot for bus %1%.");
208 errorMsg % bus.
name();
231 typedef std::set<Socket*> SocketSet;
232 SocketSet outputSockets;
240 outputSockets.insert(socket);
248 "Move slot of bus %1% does not contain source field.");
249 errorMsg % bus.
name();
254 for (SocketSet::const_iterator iter = outputSockets.begin();
255 iter != outputSockets.end(); iter++) {
259 "Source field of move slot of bus %1% does not"
260 "have an encoding for socket %2%.");
261 errorMsg % bus.
name() % socket->
name();
269 "Encoding of socket %1% in source "
270 "field of move slot %2% does not refer to "
271 "any socket code table.");
272 errorMsg % socket->
name() % bus.
name();
283 for (
int i = 0; i < bridgeNav.
count(); i++) {
289 "Source field of bus %1% does not have encoding "
291 errorMsg % bus.
name() % bridge->
name();
300 "Source field of bus %1% does not have an immediate "
302 errorMsg % bus.
name();
322 typedef std::set<Socket*> SocketSet;
323 SocketSet inputSockets;
331 inputSockets.insert(socket);
337 if (inputSockets.size() > 1) {
340 "Move slot of bus %1% does not contain destination field.");
341 errorMsg % bus.
name();
345 for (SocketSet::const_iterator iter = inputSockets.begin();
346 iter != inputSockets.end(); iter++) {
350 "Destination field of move slot of bus %1% does not"
351 "have an encoding for socket %2%.");
352 errorMsg % bus.
name() % socket->
name();
360 "Encoding of socket %1% in destination "
361 "field of move slot %2% does not refer to "
362 "any socket code table.");
363 errorMsg % socket->
name() % bus.
name();
392 format errorMsg(
"Move slot %1% does not contain guard field.");
393 errorMsg % bus.
name();
406 if (ucGuard != NULL &&
409 "Guard field of move slot %1% does not have encoding "
410 "for always-%2% guard.");
411 errorMsg % bus.
name();
419 }
else if (portGuard != NULL) {
425 "Guard field of move slot %1% does not have encoding "
426 "for %2% FU port guard of port %3% of FU %4%.");
427 errorMsg % bus.
name();
429 errorMsg %
"inverted";
431 errorMsg %
"non-inverted";
433 errorMsg % port->
name() % fu->
name();
436 }
else if (regGuard != NULL) {
442 "Guard field of move slot %1% does not have encoding "
443 "for %2% GPR guard of register %3% of register file "
445 errorMsg % bus.
name();
447 errorMsg %
"inverted";
449 errorMsg %
"non-inverted";
471 bool srcField = (
dynamic_cast<SourceField*
>(slotField) != NULL);
481 for (
int i = 0; i < socket->
portCount(); i++) {
497 "Socket code table of socket %1% in %2% field "
498 "of move slot %3% does not contain FU port code "
499 "for operation %4% for port %5% of FU %6%.");
504 errorMsg %
"destination";
506 errorMsg % busName % operation->
name() %
514 "Socket code table of socket %1% in %2% field of "
515 "move slot %3% does not contain FU port code for "
516 "port %4% of FU %5%.");
521 errorMsg %
"destination";
523 errorMsg % busName % port->
name() % fu->
name();
528 }
else if (rf != NULL && iu == NULL
531 "Socket code table of socket %1% in %2% field of move "
532 "slot %3% does not contain RF port code for RF %4%.");
533 errorMsg % socketName;
537 errorMsg %
"destination";
539 errorMsg % busName % rf->
name();
543 "Socket code table of socket %1% in %2% field of move slot "
544 "%3% does not contain IU port code for IU %4%.");
545 errorMsg % socketName;
549 errorMsg %
"destination";
551 errorMsg % busName % iu->
name();
570 if (immSlot.
width() == 0) {
576 "BEM does not contain field for immediate slot %1%.");
577 errorMsg % immSlot.
name();
582 format errorMsg(
"Immediate slot %1% is too narrow in BEM.");
599 if (iTempNav.
count() > 1) {
601 string errorMsg(
"BEM does not contain immediate control field.");
605 for (
int i = 0; i < iTempNav.
count(); i++) {
609 "Immediate control field does not have encoding "
610 "for instruction template %1%.");
611 errorMsg % iTemp->
name();
635 for (
int i = 0; i < itNav.
count(); i++) {
638 typedef std::set<std::string> StringSet;
640 StringSet iTempDestinations;
641 for (
int i = 0; i < iuNav.
count(); i++) {
645 iTempDestinations.insert(iu->
name());
649 StringSet destinationsInBEM;
654 destinationsInBEM.insert(dstIU);
659 if (field.
width() < regIndexWidth) {
661 "Long immediate destination register field is "
662 "too narrow for destination %1% in instruction "
664 errorMsg % dstIU % iTemp->
name();
671 StringSet intersection;
673 iTempDestinations, destinationsInBEM, intersection);
674 if (intersection.size() < iTempDestinations.size()) {
676 "Long immediate destination register fields do not "
677 "cover all the destinations of instruction template %1%.");
678 errorMsg % iTemp->
name();
696 string errorMsg(
"GCU does not have an address space");
701 if (imemWidth < instructionWidth) {
703 "Warning: Instruction width is greater than the instruction "
718 string busName = slot.
name();
721 Bus* bus = busNav.
item(busName);
int immediateWidth() const
ImmediateSlotField & immediateSlot(int index) const
void checkDestinationField(const TTAMachine::Bus &bus)
void checkImmediateControlField()
Port * port(int index) const
BEMValidator(const BinaryEncoding &bem, const TTAMachine::Machine &machine)
bool hasMoveSlot(const std::string &name) const
Bus * destinationBus() const
bool hasFUGuardEncoding(const std::string &fu, const std::string &port, bool inverted) const
virtual TCEString name() const
void checkMoveSlot(const TTAMachine::Bus &bus)
virtual bool hasAddressSpace() const
TTAMachine::Machine * machine
the architecture definition of the estimated processor
int registerIndex() const
FunctionUnit * parentUnit() const
int longImmDstRegisterFieldCount() const
bool hasSocketEncoding(const std::string &socket) const
bool hasImmediateEncoding() const
bool hasRFPortCode(const std::string ®File) const
bool hasImmediateControlField() const
bool hasGuardField() const
virtual AddressSpace * addressSpace() const
Direction direction() const
virtual Segment * segment(int index) const
SocketEncoding & socketEncoding(int index) const
virtual bool hasPreviousBus() const
void checkGuardField(const TTAMachine::Bus &bus)
virtual bool isOpcodeSetting() const =0
virtual int numberOfRegisters() const
StringVector warningMessages_
Contains the warning messages.
#define assert(condition)
int connectionCount() const
bool hasSourceField() const
bool needsSourceField(const MoveSlot &slot) const
bool hasBridgeEncoding(const std::string &bridge) const
virtual ControlUnit * controlUnit() const
virtual bool canRead(const Bus &bus) const
const std::string & name() const
const TTAMachine::Machine & machine_
The machine.
virtual BridgeNavigator bridgeNavigator() const
GuardField & guardField() const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
bool hasDestinationField() const
bool needsSocketCodeTable(const SocketEncoding &socketEnc) const
bool hasItem(const std::string &name) const
void checkImmediateSlot(const TTAMachine::ImmediateSlot &immSlot)
virtual int width(const TCEString &templateName) const
std::string socketName() const
bool hasGPRGuardEncoding(const std::string ®File, int index, bool inverted) const
std::string immediateUnit(const std::string &instructionTemplate) const
virtual int operationCount() const
bool hasSocketCodes() const
bool hasFUPortCode(const std::string &fu, const std::string &port) const
bool hasUnconditionalGuardEncoding(bool inverted) const
virtual int width() const
bool hasIUPortCode(const std::string &immediateUnit) const
virtual SocketNavigator socketNavigator() const
SourceField & sourceField() const
virtual bool isOneOfDestinations(const ImmediateUnit &dstUnit) const
const Connection & connection(const Socket &socket) const
virtual ImmediateSlotNavigator immediateSlotNavigator() const
Guard * guard(int index) const
void checkSocketCodeTable(const SocketEncoding &socketEnc)
virtual int width() const
bool usedByInstructionTemplate(const std::string &instructionTemplate) const
virtual bool hasNextBus() const
StringVector errorMessages_
Contains the error messages.
bool hasImmediateSlot(const std::string &name) const
virtual bool isInverted() const
virtual Bus * previousBus() const
virtual std::string name() const
std::string errorMessage(int index) const
SlotField * parent() const
virtual BusNavigator busNavigator() const
const BinaryEncoding & bem_
The binary encoding map.
ImmediateControlField & immediateControlField() const
MoveSlot & moveSlot(int index) const
ComponentType * item(int index) const
DestinationField & destinationField() const
virtual HWOperation * operation(const std::string &name) const
virtual Bus * nextBus() const
SocketCodeTable & socketCodes() const
MoveSlot * parent() const
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
LImmDstRegisterField & longImmDstRegisterField(int index) const
const RegisterFile * registerFile() const
virtual int segmentCount() const
void checkLImmDstRegisterFields()
void checkImemMauWidth(TTAMachine::ControlUnit &gcu)
std::string warningMessage(int index) const
void checkSourceField(const TTAMachine::Bus &bus)
Unit * parentUnit() const