Go to the documentation of this file.
74 for (
int i = 0; i < fuNav.
count(); i++) {
119 const std::string& operationStr) {
126 for (
int i = 0; i < fuNav.
count(); i++) {
140 bindedPorts.push_back(NULL);
143 bindedPorts.push_back(operation->
port(i));
158 const std::string& opName,
int operandIndex) {
162 if (hwOp->
isBound(operandIndex)) {
163 return hwOp->
port(operandIndex);
182 int asCount = asNav.
count();
183 for (
int i = 0; i < asCount; i++) {
188 if (asNav.
item(i)->hasNumericalId(0))
return asNav.
item(i);
190 if (asNav.
item(i) != &instrAS)
return asNav.
item(i);
197 "Target machine has no data address space");
209 for (
int i = 0; i < busNav.
count(); i++) {
218 return ggLatency + 1;
221 if (
dynamic_cast<PortGuard*
>(guard) != NULL) {
222 return ggLatency + 1;
251 int opndIndex = hwOp.
io(port);
262 int byteAlignment = 4;
267 for (
int i = 0; i < fuNav.
count(); i++) {
275 assert(fu &&
"Didn't find the LSU with local AS");
280 if (opName.length() > 2 && isdigit(opName[2])) {
288 size_t xpos = opName.find(
"x", 3);
289 if (xpos == std::string::npos) {
290 for (
size_t pos = 2; pos < opName.size(); ++pos)
291 if (!isdigit(opName[pos]))
continue;
295 if (loadByteWidth > byteAlignment) {
296 byteAlignment = loadByteWidth;
300 if (storeByteWidth > byteAlignment) {
301 byteAlignment = storeByteWidth;
305 for (
size_t pos = xpos + 1; pos < opName.size(); ++pos)
306 if (!isdigit(opName[pos]))
continue;
310 if (loadByteWidth > byteAlignment) {
311 byteAlignment = loadByteWidth;
315 if (storeByteWidth > byteAlignment) {
316 byteAlignment = storeByteWidth;
323 if (!(byteAlignment > 1 && !(byteAlignment & (byteAlignment - 1)))) {
324 std::cerr <<
"Stack alignment: " << byteAlignment << std::endl;
325 assert(
false &&
"Error: stack alignment must be a power of 2.");
328 return byteAlignment;
341 const std::string& slotName) {
343 std::set<InstructionTemplate*> affectingInstTemplates;
346 for (
int i = 0; i < itNav.
count(); i++) {
364 std::set<TTAMachine::InstructionTemplate*>
367 const std::string& slotName) {
368 std::set<InstructionTemplate*> affectingInstTemplates;
371 for (
int i = 0; i < itNav.
count(); i++) {
374 affectingInstTemplates.insert(iTemp);
377 return affectingInstTemplates;
386 return opNames.find(operation.
upper()) != opNames.end();
393 size_t requiredBitsSigned =
395 size_t requiredBitsUnsigned =
399 requiredBitsSigned : requiredBitsUnsigned;
412 requiredBitsSigned < requiredBits)
413 requiredBits = requiredBitsSigned;
450 for (
int bi = 0; bi < busNav.
count(); ++bi) {
451 const Bus& bus = *busNav.
item(bi);
452 if (canEncodeImmediateInteger(bus, imm, destWidth))
458 if (canEncodeImmediateInteger(*temp, imm, destWidth))
467 unsigned destWidth) {
468 size_t requiredBitsSigned =
470 static_cast<SLongWord>(imm)), destWidth);
471 size_t requiredBitsUnsigned =
473 static_cast<ULongWord>(imm)), destWidth);
479 size_t requiredBits = iu->signExtends() ?
480 requiredBitsSigned : requiredBitsUnsigned;
487 std::set<const TTAMachine::Bus*> buses;
490 for (
auto bus: buses) {
491 if (
static_cast<size_t>(bus->width()) > maxBusW)
492 maxBusW = bus->width();
495 if (supportedW == maxBusW &&
496 requiredBitsSigned < requiredBits)
497 requiredBits = requiredBitsSigned;
498 if (supportedW >= requiredBits)
515 return hwop->
io(*port);
538 for (
int i = 0; i < nav.
count(); i++) {
540 int curIndex = triggerIndex(*fu, op);
542 if (index > 0 && curIndex != index) {
551 if (index > 0 && curIndex != index) {
570 unsigned widestOperand = 0;
577 for (TCETools::CIStringSet::iterator it = opNames.begin();
578 it != opNames.end(); ++it) {
587 return widestOperand;
597 unsigned numRegisters = 0;
602 for (
int i = 0; i < RFNavigator.
count(); i++) {
604 if ((
unsigned)(rf->
width()) == width) {
605 numRegisters += rf->
size();
627 const FUPort* jumpPort = getBoundPort(*cu,
"jump", 1);
628 if (jumpPort ==
nullptr) {
632 std::vector<const Bus*> guardedBuses;
634 for (
int i = 0; i < bus->guardCount(); i++) {
639 guardedBuses.push_back(bus);
645 for (
const Bus* bus : guardedBuses) {
673 const FUPort* jumpPort = getBoundPort(*cu,
"jump", 1);
674 if (jumpPort ==
nullptr) {
678 std::vector<const Bus*> guardedBuses;
680 for (
int i = 0; i < bus->guardCount(); i++) {
685 guardedBuses.push_back(bus);
690 for (
const Bus* bus : guardedBuses) {
715 const FUPort* jumpPort = getBoundPort(*cu,
"jump", 1);
716 if (jumpPort ==
nullptr) {
720 std::vector<const Bus*> guardedBuses;
722 for (
int i = 0; i < bus->guardCount(); i++) {
724 if (guard->
isInverted() != inverted)
continue;
730 if (fu->hasOperation(opName)) {
732 guardedBuses.push_back(bus);
738 for (
const Bus* bus : guardedBuses) {
758 std::vector<const TTAMachine::FunctionUnit*>
760 std::vector<TCEString> requiredOperations;
761 requiredOperations.push_back(LOCK_READ_);
762 requiredOperations.push_back(TRY_LOCK_ADDR_);
763 requiredOperations.push_back(UNLOCK_ADDR_);
765 std::vector<const FunctionUnit*> lockUnits;
767 for (
int i = 0; i < fuNav.
count(); i++) {
769 bool hasCorrectOperations =
true;
770 for (
unsigned int i = 0; i < requiredOperations.size(); i++) {
772 hasCorrectOperations =
false;
776 if (hasCorrectOperations) {
779 msg <<
"Lock Unit " << fu->
name() <<
" has no address space";
782 lockUnits.push_back(fu);
800 "Operation '" + hwOp.
name() +
"' was not found in OSAL.");
809 if (fu->hasOperation(opName)) {
810 const auto op = fu->operation(opName);
811 maxl = std::max(maxl, op->latency());
816 maxl = std::max(maxl, op->latency());
int immediateWidth() const
static std::set< TTAMachine::InstructionTemplate * > templatesUsingSlot(const TTAMachine::Machine &mach, const std::string &slotName)
static bool busConnectedToPort(const TTAMachine::Bus &bus, const TTAMachine::Port &port)
Operation & operation(const char *name)
static int maxMemoryAlignment(const TTAMachine::Machine &mach)
virtual TCEString name() const
virtual bool hasAddressSpace() const
TTAMachine::Machine * machine
the architecture definition of the estimated processor
bool startsWith(const std::string &str) const
static bool supportsOperation(const TTAMachine::Machine &mach, TCEString operation)
FunctionUnit * parentUnit() const
virtual bool hasNumericalId(unsigned id) const
static const TCEString TRY_LOCK_ADDR_
virtual int width() const
static Operation & osalOperation(const TTAMachine::HWOperation &hwOp)
static UniversalMachine & instance()
virtual int numberOfInputs() const
static std::vector< const TTAMachine::FunctionUnit * > findLockUnits(const TTAMachine::Machine &machine)
virtual AddressSpace * addressSpace() const
static int maxLatency(const TTAMachine::Machine &mach, TCEString &opName)
virtual bool isTriggering() const
static NullOperation & instance()
virtual TCEString name() const
static TTAMachine::AddressSpace * defaultDataAddressSpace(const TTAMachine::Machine &mach)
#define assert(condition)
virtual FUPort * port(int operand) const
virtual ControlUnit * controlUnit() const
int io(const FUPort &port) const
const std::string & name() const
static bool supportsPortGuardedJump(const TTAMachine::Machine &machine, bool inverted, const TCEString &opName)
static const TCEString LOCK_READ_
virtual ImmediateUnitNavigator immediateUnitNavigator() const
#define THROW_EXCEPTION(exceptionType, message)
Exception wrapper macro that automatically includes file name, line number and function name where th...
static const TTAMachine::FUPort * getBoundPort(const TTAMachine::FunctionUnit &fu, const std::string &opName, int operandIndex)
bool isBound(const FUPort &port) const
virtual FunctionUnitNavigator functionUnitNavigator() const
static OperationSet getOpset(const TTAMachine::Machine &mach)
virtual int operationCount() const
virtual int supportedWidth() const
static unsigned findWidestOperand(const TTAMachine::Machine &machine, bool vector)
virtual bool hasOperation(const std::string &name) const
TCETools::CIStringSet OperationSet
static int longestGuardLatency(const TTAMachine::Machine &mach)
virtual AddressSpaceNavigator addressSpaceNavigator() const
static void appendConnectedDestinationBuses(const TTAMachine::Port &port, std::set< const TTAMachine::Bus * > &buses)
virtual int operationPortCount() const
static unsigned numberOfRegisters(const TTAMachine::Machine &machine, unsigned width)
Guard * guard(int index) const
static const TCEString UNLOCK_ADDR_
virtual int operandCount() const
static Operand & operandFromPort(const TTAMachine::HWOperation &hwOp, const TTAMachine::FUPort &port)
virtual Operand & operand(int id) const
virtual RegisterFileNavigator registerFileNavigator() const
virtual bool isInverted() const
virtual Machine * machine() const
virtual BusNavigator busNavigator() const
static bool supportsPortGuardedJumps(const TTAMachine::Machine &machine)
ComponentType * item(int index) const
virtual HWOperation * operation(const std::string &name) const
virtual int guardLatency() const
static int toInt(const T &source)
static ConstPortList getPortBindingsOfOperation(const TTAMachine::Machine &mach, const std::string &operation)
virtual FUPort * operationPort(const std::string &name) const
int globalGuardLatency() const
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
virtual int width() const
std::vector< const TTAMachine::FUPort * > ConstPortList
static int triggerIndex(const TTAMachine::Machine &machine, const Operation &op)
const RegisterFile * registerFile() const
static bool supportsBoolRegisterGuardedJumps(const TTAMachine::Machine &machine)
virtual bool usesSlot(const std::string &slotName) const
static bool canEncodeImmediateInteger(const TTAMachine::Machine &mach, int64_t imm, unsigned destWidth=UINT_MAX)
static bool templatesUsesSlot(const TTAMachine::Machine &mach, const std::string &slotName)