11#include "llvm/ADT/STLExtras.h"
12#include "llvm/Support/ErrorHandling.h"
25 if (model.isShimNOCorPLTile(tile.col, tile.row))
27 if (model.isMemTile(tile.col, tile.row))
29 return isMem ? std::string(
"memory") : std::string(
"core");
35 if (model.isShimNOCorPLTile(tile.col, tile.row))
37 if (model.isMemTile(tile.col, tile.row))
40 return isMem ? std::string(
"memory") : std::string(
"core");
65 return db->lookupRegister(name, getModuleForTile(*
this, tile, isMem));
74 return db->lookupEvent(name, getModuleForTileEvents(*
this, tile, isMem));
77std::optional<uint32_t>
79 uint32_t value)
const {
83 return db->encodeFieldValue(field, value);
86std::optional<uint32_t>
89 if (width == 0 || width > 32 || field.
bit_end >= 32)
92 uint64_t mask = (width == 32) ? 0xFFFFFFFFULL : ((1ULL << width) - 1ULL);
94 if (mask > UINT32_MAX)
97 return static_cast<uint32_t
>(mask);
106 SmallVector<SmallVector<int>> validTileIds = {{15, 26, 27, 29, 30, 31},
107 {14, 21, 22, 23, 24, 25},
108 {13, 11, 17, 18, 19, 20},
109 {12, 28, 7, 8, 9, 10}};
110 if (!columnWiseUniqueIDs &&
columns() > (
int)validTileIds.size())
111 llvm::report_fatal_error(
112 "Device has " + llvm::Twine(
columns()) +
" columns but only " +
113 llvm::Twine(validTileIds.size()) +
114 " globally-unique controller ID sets are defined; "
115 "use column-wise unique IDs mode.");
116 DenseMap<TileID, int> tileIDMap;
117 for (
int col = 0; col <
columns(); col++) {
118 for (
int row = 0; row <
rows(); row++) {
119 if (columnWiseUniqueIDs)
120 tileIDMap[{col, row}] = validTileIds[0][row];
122 tileIDMap[{col, row}] = validTileIds[col][row];
129 assert(columnWiseUniqueIDs &&
130 "Device has more tiles than candidate packet ids; "
131 "use column-wise unique IDs mode.");
132 DenseMap<TileID, int> tileIDMap;
133 int unusedPacketIdFrom = 0;
134 for (
int col = 0; col <
columns(); col++) {
135 if (columnWiseUniqueIDs)
136 unusedPacketIdFrom = 0;
137 for (
int row = 0; row <
rows(); row++)
138 tileIDMap[{col, row}] = unusedPacketIdFrom++;
146 auto colonPos = value.find(
':');
147 if (colonPos == StringRef::npos)
150 StringRef portName = value.substr(0, colonPos);
151 StringRef channelStr = value.substr(colonPos + 1);
154 if (channelStr.getAsInteger(10, channel) || channel < 0)
158 if (portName.equals_insensitive(
"north")) {
159 bundle = WireBundle::North;
160 }
else if (portName.equals_insensitive(
"south")) {
161 bundle = WireBundle::South;
162 }
else if (portName.equals_insensitive(
"east")) {
163 bundle = WireBundle::East;
164 }
else if (portName.equals_insensitive(
"west")) {
165 bundle = WireBundle::West;
166 }
else if (portName.equals_insensitive(
"dma")) {
167 bundle = WireBundle::DMA;
168 }
else if (portName.equals_insensitive(
"fifo")) {
169 bundle = WireBundle::FIFO;
170 }
else if (portName.equals_insensitive(
"core")) {
171 bundle = WireBundle::Core;
172 }
else if (portName.equals_insensitive(
"ctrl")) {
173 bundle = WireBundle::TileControl;
179 static_cast<uint32_t
>(channel), master);
190 bool isEvenRow = ((src.row % 2) == 0);
191 std::optional<TileID> ret;
195 ret = {src.col - 1, src.row};
203 bool isEvenRow = (src.row % 2) == 0;
204 std::optional<TileID> ret;
206 ret = {src.col + 1, src.row};
216 std::optional<TileID> ret({src.col, src.row + 1});
223 std::optional<TileID> ret({src.col, src.row - 1});
232 bool IsEvenRow = (srcRow % 2) == 0;
233 return (IsEvenRow &&
isInternal(srcCol, srcRow, dstCol, dstRow)) ||
234 (!IsEvenRow &&
isWest(srcCol, srcRow, dstCol, dstRow));
239 bool IsEvenRow = (srcRow % 2) == 0;
240 return (!IsEvenRow &&
isInternal(srcCol, srcRow, dstCol, dstRow)) ||
241 (IsEvenRow &&
isEast(srcCol, srcRow, dstCol, dstRow));
246 return isNorth(srcCol, srcRow, dstCol, dstRow);
251 return isSouth(srcCol, srcRow, dstCol, dstRow);
256 bool IsEvenRow = ((coreRow % 2) == 0);
258 bool IsMemWest = (
isWest(coreCol, coreRow, memCol, memRow) && !IsEvenRow) ||
259 (
isInternal(coreCol, coreRow, memCol, memRow) && IsEvenRow);
261 bool IsMemEast = (
isEast(coreCol, coreRow, memCol, memRow) && IsEvenRow) ||
262 (
isInternal(coreCol, coreRow, memCol, memRow) && !IsEvenRow);
264 bool IsMemNorth =
isNorth(coreCol, coreRow, memCol, memRow);
265 bool IsMemSouth =
isSouth(coreCol, coreRow, memCol, memRow);
267 return IsMemSouth || IsMemNorth || IsMemWest || IsMemEast;
272 AIE::DMAChannelDir direction)
const {
275 offset = 0x0001D000 + (bd_id * 0x14);
277 offset = 0x0001D000 + (bd_id * 0x20);
280 "AIE1TargetModel::getDmaBdAddress called for non-DMA tile");
291 "AIE1TargetModel::getDmaBdAddressOffset called for non-DMA tile");
296 AIE::DMAChannelDir direction)
const {
299 offset = 0x0001D140 + (channel * 0x8);
301 offset = 0x0001DE00 + (channel * 0x8);
304 "AIE1TargetModel::getDmaControlAddress called for non-DMA tile");
306 if (direction == AIE::DMAChannelDir::MM2S)
315 WireBundle bundle)
const {
318 case WireBundle::FIFO:
320 case WireBundle::North:
322 case WireBundle::West: {
327 case WireBundle::South:
329 case WireBundle::East: {
334 case WireBundle::TileControl:
341 case WireBundle::Core:
342 case WireBundle::DMA:
343 case WireBundle::FIFO:
345 case WireBundle::North: {
346 if (row ==
rows() - 1)
350 case WireBundle::West: {
355 case WireBundle::South:
357 case WireBundle::East: {
362 case WireBundle::TileControl:
371 WireBundle bundle)
const {
374 case WireBundle::FIFO:
376 case WireBundle::North:
378 case WireBundle::West: {
383 case WireBundle::South:
385 case WireBundle::East: {
390 case WireBundle::Trace:
392 case WireBundle::TileControl:
399 case WireBundle::Core:
400 case WireBundle::DMA:
401 case WireBundle::FIFO:
403 case WireBundle::North: {
404 if (row ==
rows() - 1)
408 case WireBundle::West: {
413 case WireBundle::South:
415 case WireBundle::East: {
420 case WireBundle::Trace:
422 case WireBundle::TileControl:
430 WireBundle bundle)
const {
433 case WireBundle::DMA:
435 case WireBundle::NOC:
437 case WireBundle::PLIO:
439 case WireBundle::South:
448 WireBundle bundle)
const {
451 case WireBundle::DMA:
453 case WireBundle::NOC:
455 case WireBundle::PLIO:
457 case WireBundle::South:
466 WireBundle srcBundle,
int srcChan,
467 WireBundle dstBundle,
485 if (srcBundle == WireBundle::Trace)
486 return dstBundle == WireBundle::South;
491 if (srcBundle == WireBundle::Trace)
492 return dstBundle == WireBundle::South;
499std::vector<std::pair<uint32_t, uint32_t>>
501 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256)};
504std::optional<uint32_t>
517static constexpr uint32_t S_CORE_OFFSET = 0;
518static constexpr uint32_t S_CORE_SIZE = 2;
519static constexpr uint32_t S_CTRL_OFFSET = 4;
520static constexpr uint32_t S_CTRL_SIZE = 1;
521static constexpr uint32_t S_DMA_OFFSET = 2;
522static constexpr uint32_t S_DMA_SIZE = 2;
523static constexpr uint32_t S_EAST_OFFSET = 21;
524static constexpr uint32_t S_EAST_SIZE = 4;
525static constexpr uint32_t S_FIFO_OFFSET = 5;
526static constexpr uint32_t S_FIFO_SIZE = 2;
527static constexpr uint32_t S_NORTH_OFFSET = 17;
528static constexpr uint32_t S_NORTH_SIZE = 4;
529static constexpr uint32_t S_SOUTH_OFFSET = 7;
530static constexpr uint32_t S_SOUTH_SIZE = 6;
531static constexpr uint32_t S_TRACE_OFFSET = 25;
532static constexpr uint32_t S_TRACE_SIZE = 2;
533static constexpr uint32_t S_WEST_OFFSET = 13;
534static constexpr uint32_t S_WEST_SIZE = 4;
537static constexpr uint32_t M_CORE_OFFSET = 0;
538static constexpr uint32_t M_CORE_SIZE = 2;
539static constexpr uint32_t M_CTRL_OFFSET = 4;
540static constexpr uint32_t M_CTRL_SIZE = 1;
541static constexpr uint32_t M_DMA_OFFSET = 2;
542static constexpr uint32_t M_DMA_SIZE = 2;
543static constexpr uint32_t M_EAST_OFFSET = 21;
544static constexpr uint32_t M_EAST_SIZE = 4;
545static constexpr uint32_t M_FIFO_OFFSET = 5;
546static constexpr uint32_t M_FIFO_SIZE = 2;
547static constexpr uint32_t M_NORTH_OFFSET = 15;
548static constexpr uint32_t M_NORTH_SIZE = 6;
549static constexpr uint32_t M_SOUTH_OFFSET = 7;
550static constexpr uint32_t M_SOUTH_SIZE = 4;
551static constexpr uint32_t M_WEST_OFFSET = 11;
552static constexpr uint32_t M_WEST_SIZE = 4;
559static constexpr uint32_t S_CTRL_OFFSET = 0;
560static constexpr uint32_t S_CTRL_SIZE = 1;
561static constexpr uint32_t S_EAST_OFFSET = 19;
562static constexpr uint32_t S_EAST_SIZE = 4;
563static constexpr uint32_t S_FIFO_OFFSET = 1;
564static constexpr uint32_t S_FIFO_SIZE = 2;
565static constexpr uint32_t S_NORTH_OFFSET = 15;
566static constexpr uint32_t S_NORTH_SIZE = 4;
567static constexpr uint32_t S_SOUTH_OFFSET = 3;
568static constexpr uint32_t S_SOUTH_SIZE = 8;
569static constexpr uint32_t S_TRACE_OFFSET = 23;
570static constexpr uint32_t S_TRACE_SIZE = 1;
571static constexpr uint32_t S_WEST_OFFSET = 11;
572static constexpr uint32_t S_WEST_SIZE = 4;
575static constexpr uint32_t M_CTRL_OFFSET = 0;
576static constexpr uint32_t M_CTRL_SIZE = 1;
577static constexpr uint32_t M_EAST_OFFSET = 19;
578static constexpr uint32_t M_EAST_SIZE = 4;
579static constexpr uint32_t M_FIFO_OFFSET = 1;
580static constexpr uint32_t M_FIFO_SIZE = 2;
581static constexpr uint32_t M_NORTH_OFFSET = 13;
582static constexpr uint32_t M_NORTH_SIZE = 6;
583static constexpr uint32_t M_SOUTH_OFFSET = 3;
584static constexpr uint32_t M_SOUTH_SIZE = 6;
585static constexpr uint32_t M_WEST_OFFSET = 9;
586static constexpr uint32_t M_WEST_SIZE = 4;
593 int col,
int row, WireBundle bundle, uint32_t port_num,
bool master)
const {
597 case WireBundle::Core:
598 if (port_num >= aie1_port_id::core::M_CORE_SIZE)
600 return aie1_port_id::core::M_CORE_OFFSET + port_num;
601 case WireBundle::TileControl:
602 if (port_num >= aie1_port_id::core::M_CTRL_SIZE)
604 return aie1_port_id::core::M_CTRL_OFFSET + port_num;
605 case WireBundle::DMA:
606 if (port_num >= aie1_port_id::core::M_DMA_SIZE)
608 return aie1_port_id::core::M_DMA_OFFSET + port_num;
609 case WireBundle::East:
610 if (port_num >= aie1_port_id::core::M_EAST_SIZE)
612 return aie1_port_id::core::M_EAST_OFFSET + port_num;
613 case WireBundle::FIFO:
614 if (port_num >= aie1_port_id::core::M_FIFO_SIZE)
616 return aie1_port_id::core::M_FIFO_OFFSET + port_num;
617 case WireBundle::North:
618 if (port_num >= aie1_port_id::core::M_NORTH_SIZE)
620 return aie1_port_id::core::M_NORTH_OFFSET + port_num;
621 case WireBundle::South:
622 if (port_num >= aie1_port_id::core::M_SOUTH_SIZE)
624 return aie1_port_id::core::M_SOUTH_OFFSET + port_num;
625 case WireBundle::West:
626 if (port_num >= aie1_port_id::core::M_WEST_SIZE)
628 return aie1_port_id::core::M_WEST_OFFSET + port_num;
634 case WireBundle::TileControl:
635 if (port_num >= aie1_port_id::shim::M_CTRL_SIZE)
637 return aie1_port_id::shim::M_CTRL_OFFSET + port_num;
638 case WireBundle::East:
639 if (port_num >= aie1_port_id::shim::M_EAST_SIZE)
641 return aie1_port_id::shim::M_EAST_OFFSET + port_num;
642 case WireBundle::FIFO:
643 if (port_num >= aie1_port_id::shim::M_FIFO_SIZE)
645 return aie1_port_id::shim::M_FIFO_OFFSET + port_num;
646 case WireBundle::North:
647 if (port_num >= aie1_port_id::shim::M_NORTH_SIZE)
649 return aie1_port_id::shim::M_NORTH_OFFSET + port_num;
650 case WireBundle::South:
651 if (port_num >= aie1_port_id::shim::M_SOUTH_SIZE)
653 return aie1_port_id::shim::M_SOUTH_OFFSET + port_num;
654 case WireBundle::West:
655 if (port_num >= aie1_port_id::shim::M_WEST_SIZE)
657 return aie1_port_id::shim::M_WEST_OFFSET + port_num;
667 case WireBundle::Core:
668 if (port_num >= aie1_port_id::core::S_CORE_SIZE)
670 return aie1_port_id::core::S_CORE_OFFSET + port_num;
671 case WireBundle::TileControl:
672 if (port_num >= aie1_port_id::core::S_CTRL_SIZE)
674 return aie1_port_id::core::S_CTRL_OFFSET + port_num;
675 case WireBundle::DMA:
676 if (port_num >= aie1_port_id::core::S_DMA_SIZE)
678 return aie1_port_id::core::S_DMA_OFFSET + port_num;
679 case WireBundle::East:
680 if (port_num >= aie1_port_id::core::S_EAST_SIZE)
682 return aie1_port_id::core::S_EAST_OFFSET + port_num;
683 case WireBundle::FIFO:
684 if (port_num >= aie1_port_id::core::S_FIFO_SIZE)
686 return aie1_port_id::core::S_FIFO_OFFSET + port_num;
687 case WireBundle::North:
688 if (port_num >= aie1_port_id::core::S_NORTH_SIZE)
690 return aie1_port_id::core::S_NORTH_OFFSET + port_num;
691 case WireBundle::South:
692 if (port_num >= aie1_port_id::core::S_SOUTH_SIZE)
694 return aie1_port_id::core::S_SOUTH_OFFSET + port_num;
695 case WireBundle::Trace:
696 if (port_num >= aie1_port_id::core::S_TRACE_SIZE)
698 return aie1_port_id::core::S_TRACE_OFFSET + port_num;
699 case WireBundle::West:
700 if (port_num >= aie1_port_id::core::S_WEST_SIZE)
702 return aie1_port_id::core::S_WEST_OFFSET + port_num;
708 case WireBundle::TileControl:
709 if (port_num >= aie1_port_id::shim::S_CTRL_SIZE)
711 return aie1_port_id::shim::S_CTRL_OFFSET + port_num;
712 case WireBundle::East:
713 if (port_num >= aie1_port_id::shim::S_EAST_SIZE)
715 return aie1_port_id::shim::S_EAST_OFFSET + port_num;
716 case WireBundle::FIFO:
717 if (port_num >= aie1_port_id::shim::S_FIFO_SIZE)
719 return aie1_port_id::shim::S_FIFO_OFFSET + port_num;
720 case WireBundle::North:
721 if (port_num >= aie1_port_id::shim::S_NORTH_SIZE)
723 return aie1_port_id::shim::S_NORTH_OFFSET + port_num;
724 case WireBundle::South:
725 if (port_num >= aie1_port_id::shim::S_SOUTH_SIZE)
727 return aie1_port_id::shim::S_SOUTH_OFFSET + port_num;
728 case WireBundle::Trace:
729 if (port_num >= aie1_port_id::shim::S_TRACE_SIZE)
731 return aie1_port_id::shim::S_TRACE_OFFSET + port_num;
732 case WireBundle::West:
733 if (port_num >= aie1_port_id::shim::S_WEST_SIZE)
735 return aie1_port_id::shim::S_WEST_OFFSET + port_num;
749std::unique_ptr<RegisterDatabase>
758 std::optional<TileID> ret({src.col - 1, src.row});
767 std::optional ret = src;
776 std::optional<TileID> ret({src.col, src.row + 1});
783 std::optional<TileID> ret({src.col, src.row - 1});
793 return isWest(srcCol, srcRow, dstCol, dstRow);
798 return isInternal(srcCol, srcRow, dstCol, dstRow);
803 return isNorth(srcCol, srcRow, dstCol, dstRow);
808 return isSouth(srcCol, srcRow, dstCol, dstRow);
814 bool IsMemWest =
isMemWest(coreCol, coreRow, memCol, memRow);
815 bool IsMemEast =
isMemEast(coreCol, coreRow, memCol, memRow);
816 bool IsMemNorth =
isMemNorth(coreCol, coreRow, memCol, memRow);
817 bool IsMemSouth =
isMemSouth(coreCol, coreRow, memCol, memRow);
820 return isEast(coreCol, coreRow, memCol, memRow) ||
821 isInternal(coreCol, coreRow, memCol, memRow) ||
822 isWest(coreCol, coreRow, memCol, memRow);
823 return (IsMemSouth && !
isMemTile(memCol, memRow)) || IsMemNorth ||
824 IsMemWest || IsMemEast;
829 AIE::DMAChannelDir direction)
const {
837 offset = 0x0001D000 + bd_id * 0x20;
839 offset = 0x000A0000 + bd_id * 0x20;
841 offset = 0x0001D000 + bd_id * 0x20;
844 "AIE2TargetModel::getDmaBdAddress called for non-DMA tile");
886 l.enablePacket = {0, 31, 1};
887 l.packetType = {0, 28, 3};
888 l.packetId = {0, 23, 5};
889 l.outOfOrderId = {0, 17, 6};
890 l.bufferLength = {0, 0, 17};
891 l.d0ZeroBefore = {1, 26, 6};
892 l.nextBd = {1, 20, 6};
893 l.useNextBd = {1, 19, 1};
894 l.bufferOffset = {1, 0, 19};
895 l.d0Size = {2, 17, 10};
896 l.d0Stride = {2, 0, 17};
897 l.d1ZeroBefore = {3, 27, 5};
898 l.d1Size = {3, 17, 10};
899 l.d1Stride = {3, 0, 17};
900 l.d2ZeroBefore = {4, 27, 4};
901 l.d2Stride = {4, 0, 17};
902 l.d2ZeroAfter = {5, 28, 4};
903 l.d1ZeroAfter = {5, 23, 5};
904 l.d0ZeroAfter = {5, 17, 6};
905 l.iterationCurrent = {6, 23, 6};
906 l.iterationSize = {6, 17, 6};
907 l.iterationStride = {6, 0, 17};
908 l.validBd = {7, 31, 1};
909 l.lockRelValue = {7, 24, 7};
910 l.lockRelId = {7, 16, 8};
911 l.lockAcqEnable = {7, 15, 1};
912 l.lockAcqValue = {7, 8, 7};
913 l.lockAcqId = {7, 0, 8};
921 l.bufferOffset = {0, 14, 14};
922 l.bufferLength = {0, 0, 14};
923 l.enablePacket = {1, 30, 1};
924 l.outOfOrderId = {1, 24, 6};
925 l.packetId = {1, 19, 5};
926 l.packetType = {1, 16, 3};
927 l.d1Stride = {2, 13, 13};
928 l.d0Stride = {2, 0, 13};
929 l.d1Size = {3, 21, 8};
930 l.d0Size = {3, 13, 8};
931 l.d2Stride = {3, 0, 13};
932 l.iterationCurrent = {4, 19, 6};
933 l.iterationSize = {4, 13, 6};
934 l.iterationStride = {4, 0, 13};
935 l.nextBd = {5, 27, 4};
936 l.useNextBd = {5, 26, 1};
937 l.validBd = {5, 25, 1};
938 l.lockRelValue = {5, 18, 7};
939 l.lockRelId = {5, 13, 4};
940 l.lockAcqEnable = {5, 12, 1};
941 l.lockAcqValue = {5, 5, 7};
942 l.lockAcqId = {5, 0, 4};
947 static const DmaBdLayout shim = makeAIE2ShimBdLayout();
948 static const DmaBdLayout mem = makeAIE2MemTileBdLayout();
949 static const DmaBdLayout core = makeAIE2CoreTileBdLayout();
951 case AIETileType::ShimNOCTile:
953 case AIETileType::MemTile:
955 case AIETileType::CoreTile:
970 AIE::DMAChannelDir direction)
const {
973 offset = 0x0001D200 + (channel * 0x8);
974 if (direction == AIE::DMAChannelDir::MM2S)
977 offset = 0x000A0600 + (channel * 0x8);
978 if (direction == AIE::DMAChannelDir::MM2S)
981 offset = 0x0001DE00 + (channel * 0x8);
982 if (direction == AIE::DMAChannelDir::MM2S)
986 "AIE2TargetModel::getDmaControlAddress called for non-DMA tile");
993std::optional<uint32_t>
995 AIE::DMAChannelDir direction)
const {
1000 offset = 0x0001D220 + (channel * 0x4);
1001 if (direction == AIE::DMAChannelDir::MM2S)
1004 offset = 0x000A0660 + (channel * 0x4);
1005 if (direction == AIE::DMAChannelDir::MM2S)
1008 offset = 0x0001DF00 + (channel * 0x4);
1009 if (direction == AIE::DMAChannelDir::MM2S)
1012 return std::nullopt;
1021 WireBundle bundle)
const {
1024 case WireBundle::DMA:
1025 case WireBundle::North:
1027 case WireBundle::South:
1029 case WireBundle::TileControl:
1037 case WireBundle::FIFO:
1039 case WireBundle::North:
1041 case WireBundle::West: {
1046 case WireBundle::South:
1048 case WireBundle::East: {
1053 case WireBundle::TileControl:
1060 case WireBundle::Core:
1062 case WireBundle::DMA:
1064 case WireBundle::FIFO:
1066 case WireBundle::North: {
1067 if (row ==
rows() - 1)
1071 case WireBundle::West: {
1076 case WireBundle::South:
1078 case WireBundle::East: {
1083 case WireBundle::TileControl:
1092 WireBundle bundle)
const {
1095 case WireBundle::DMA:
1097 case WireBundle::North:
1099 case WireBundle::South:
1101 case WireBundle::Trace:
1102 case WireBundle::TileControl:
1110 case WireBundle::FIFO:
1112 case WireBundle::North:
1114 case WireBundle::West: {
1119 case WireBundle::South:
1121 case WireBundle::East: {
1126 case WireBundle::Trace:
1128 case WireBundle::TileControl:
1136 case WireBundle::Core:
1138 case WireBundle::DMA:
1140 case WireBundle::FIFO:
1142 case WireBundle::North: {
1143 if (row ==
rows() - 1)
1147 case WireBundle::West: {
1152 case WireBundle::South:
1154 case WireBundle::East: {
1159 case WireBundle::Trace:
1162 case WireBundle::TileControl:
1171 WireBundle bundle)
const {
1174 case WireBundle::DMA:
1176 case WireBundle::NOC:
1178 case WireBundle::PLIO:
1180 case WireBundle::South:
1191 WireBundle bundle)
const {
1194 case WireBundle::DMA:
1196 case WireBundle::NOC:
1198 case WireBundle::PLIO:
1200 case WireBundle::South:
1210 WireBundle srcBundle,
int srcChan,
1211 WireBundle dstBundle,
1212 int dstChan)
const {
1220 auto isBundleInList = [](WireBundle bundle,
1221 std::initializer_list<WireBundle> bundles) {
1222 return llvm::find(bundles, bundle) != bundles.end();
1227 if (srcBundle == WireBundle::DMA) {
1228 if (dstBundle == WireBundle::DMA)
1229 return srcChan == dstChan;
1230 if (isBundleInList(dstBundle, {WireBundle::TileControl, WireBundle::South,
1231 WireBundle::North}))
1234 if (srcBundle == WireBundle::TileControl) {
1235 if (dstBundle == WireBundle::DMA)
1236 return dstChan == 5;
1237 if (isBundleInList(dstBundle, {WireBundle::South, WireBundle::North}))
1240 if (isBundleInList(srcBundle, {WireBundle::South, WireBundle::North})) {
1241 if (isBundleInList(dstBundle, {WireBundle::DMA, WireBundle::TileControl}))
1243 if (isBundleInList(dstBundle, {WireBundle::South, WireBundle::North}))
1244 return srcChan == dstChan;
1246 if (srcBundle == WireBundle::Trace) {
1247 if (dstBundle == WireBundle::DMA)
1248 return dstChan == 5;
1249 if (dstBundle == WireBundle::South)
1255 if (srcBundle == WireBundle::TileControl)
1256 return dstBundle != WireBundle::TileControl;
1257 if (isBundleInList(srcBundle, {WireBundle::FIFO, WireBundle::South}))
1258 return isBundleInList(dstBundle,
1259 {WireBundle::TileControl, WireBundle::FIFO,
1260 WireBundle::South, WireBundle::West,
1261 WireBundle::North, WireBundle::East});
1262 if (isBundleInList(srcBundle,
1263 {WireBundle::West, WireBundle::North, WireBundle::East}))
1264 return (srcBundle == dstBundle)
1265 ? (srcChan == dstChan)
1266 : isBundleInList(dstBundle,
1267 {WireBundle::TileControl, WireBundle::FIFO,
1268 WireBundle::South, WireBundle::West,
1269 WireBundle::North, WireBundle::East});
1270 if (srcBundle == WireBundle::Trace) {
1271 if (isBundleInList(dstBundle, {WireBundle::FIFO, WireBundle::South}))
1273 if (isBundleInList(dstBundle, {WireBundle::West, WireBundle::East}))
1274 return dstChan == 0;
1279 if (isBundleInList(srcBundle,
1280 {WireBundle::DMA, WireBundle::FIFO, WireBundle::South,
1281 WireBundle::West, WireBundle::North, WireBundle::East}))
1282 if (isBundleInList(dstBundle, {WireBundle::Core, WireBundle::DMA,
1283 WireBundle::TileControl, WireBundle::FIFO,
1284 WireBundle::South, WireBundle::West,
1285 WireBundle::North, WireBundle::East}))
1286 return (srcBundle == dstBundle) ? (srcChan == dstChan) :
true;
1287 if (srcBundle == WireBundle::Core)
1288 return dstBundle != WireBundle::Core;
1289 if (srcBundle == WireBundle::TileControl)
1290 return dstBundle != WireBundle::TileControl &&
1291 dstBundle != WireBundle::DMA;
1292 if (srcBundle == WireBundle::Trace) {
1293 if (dstBundle == WireBundle::DMA)
1294 return dstChan == 0;
1295 if (isBundleInList(dstBundle, {WireBundle::FIFO, WireBundle::South}))
1302std::vector<std::pair<uint32_t, uint32_t>>
1304 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256)};
1307std::optional<uint32_t>
1309 auto computeTileBaseAddress = 0x0001F000;
1310 auto memTileBaseAddress = 0x000C0000;
1311 auto shimTileBaseAddress = 0x00014000;
1312 auto lockAddrOffset = 0x10;
1316 return computeTileBaseAddress + lockAddrOffset * lockId;
1319 return memTileBaseAddress + lockAddrOffset * lockId;
1323 return shimTileBaseAddress + lockAddrOffset * lockId;
1325 return std::nullopt;
1333static constexpr uint32_t S_CORE_OFFSET = 0;
1334static constexpr uint32_t S_CORE_SIZE = 1;
1335static constexpr uint32_t S_CTRL_OFFSET = 3;
1336static constexpr uint32_t S_CTRL_SIZE = 1;
1337static constexpr uint32_t S_DMA_OFFSET = 1;
1338static constexpr uint32_t S_DMA_SIZE = 2;
1339static constexpr uint32_t S_EAST_OFFSET = 19;
1340static constexpr uint32_t S_EAST_SIZE = 4;
1341static constexpr uint32_t S_FIFO_OFFSET = 4;
1342static constexpr uint32_t S_FIFO_SIZE = 1;
1343static constexpr uint32_t S_NORTH_OFFSET = 15;
1344static constexpr uint32_t S_NORTH_SIZE = 4;
1345static constexpr uint32_t S_SOUTH_OFFSET = 5;
1346static constexpr uint32_t S_SOUTH_SIZE = 6;
1347static constexpr uint32_t S_TRACE_OFFSET = 23;
1348static constexpr uint32_t S_TRACE_SIZE = 2;
1349static constexpr uint32_t S_WEST_OFFSET = 11;
1350static constexpr uint32_t S_WEST_SIZE = 4;
1353static constexpr uint32_t M_CORE_OFFSET = 0;
1354static constexpr uint32_t M_CORE_SIZE = 1;
1355static constexpr uint32_t M_CTRL_OFFSET = 3;
1356static constexpr uint32_t M_CTRL_SIZE = 1;
1357static constexpr uint32_t M_DMA_OFFSET = 1;
1358static constexpr uint32_t M_DMA_SIZE = 2;
1359static constexpr uint32_t M_EAST_OFFSET = 19;
1360static constexpr uint32_t M_EAST_SIZE = 4;
1361static constexpr uint32_t M_FIFO_OFFSET = 4;
1362static constexpr uint32_t M_FIFO_SIZE = 1;
1363static constexpr uint32_t M_NORTH_OFFSET = 13;
1364static constexpr uint32_t M_NORTH_SIZE = 6;
1365static constexpr uint32_t M_SOUTH_OFFSET = 5;
1366static constexpr uint32_t M_SOUTH_SIZE = 4;
1367static constexpr uint32_t M_WEST_OFFSET = 9;
1368static constexpr uint32_t M_WEST_SIZE = 4;
1375static constexpr uint32_t S_CTRL_OFFSET = 6;
1376static constexpr uint32_t S_CTRL_SIZE = 1;
1377static constexpr uint32_t S_DMA_OFFSET = 0;
1378static constexpr uint32_t S_DMA_SIZE = 6;
1379static constexpr uint32_t S_NORTH_OFFSET = 13;
1380static constexpr uint32_t S_NORTH_SIZE = 4;
1381static constexpr uint32_t S_SOUTH_OFFSET = 7;
1382static constexpr uint32_t S_SOUTH_SIZE = 6;
1383static constexpr uint32_t S_TRACE_OFFSET = 17;
1384static constexpr uint32_t S_TRACE_SIZE = 1;
1387static constexpr uint32_t M_CTRL_OFFSET = 6;
1388static constexpr uint32_t M_CTRL_SIZE = 1;
1389static constexpr uint32_t M_DMA_OFFSET = 0;
1390static constexpr uint32_t M_DMA_SIZE = 6;
1391static constexpr uint32_t M_NORTH_OFFSET = 11;
1392static constexpr uint32_t M_NORTH_SIZE = 6;
1393static constexpr uint32_t M_SOUTH_OFFSET = 7;
1394static constexpr uint32_t M_SOUTH_SIZE = 4;
1401static constexpr uint32_t S_CTRL_OFFSET = 0;
1402static constexpr uint32_t S_CTRL_SIZE = 1;
1403static constexpr uint32_t S_EAST_OFFSET = 18;
1404static constexpr uint32_t S_EAST_SIZE = 4;
1405static constexpr uint32_t S_FIFO_OFFSET = 1;
1406static constexpr uint32_t S_FIFO_SIZE = 1;
1407static constexpr uint32_t S_NORTH_OFFSET = 14;
1408static constexpr uint32_t S_NORTH_SIZE = 4;
1409static constexpr uint32_t S_SOUTH_OFFSET = 2;
1410static constexpr uint32_t S_SOUTH_SIZE = 8;
1411static constexpr uint32_t S_TRACE_OFFSET = 22;
1412static constexpr uint32_t S_TRACE_SIZE = 2;
1413static constexpr uint32_t S_WEST_OFFSET = 10;
1414static constexpr uint32_t S_WEST_SIZE = 4;
1417static constexpr uint32_t M_CTRL_OFFSET = 0;
1418static constexpr uint32_t M_CTRL_SIZE = 1;
1419static constexpr uint32_t M_EAST_OFFSET = 18;
1420static constexpr uint32_t M_EAST_SIZE = 4;
1421static constexpr uint32_t M_FIFO_OFFSET = 1;
1422static constexpr uint32_t M_FIFO_SIZE = 1;
1423static constexpr uint32_t M_NORTH_OFFSET = 12;
1424static constexpr uint32_t M_NORTH_SIZE = 6;
1425static constexpr uint32_t M_SOUTH_OFFSET = 2;
1426static constexpr uint32_t M_SOUTH_SIZE = 6;
1427static constexpr uint32_t M_WEST_OFFSET = 8;
1428static constexpr uint32_t M_WEST_SIZE = 4;
1435 int col,
int row, WireBundle bundle, uint32_t port_num,
bool master)
const {
1440 case WireBundle::Core:
1441 if (port_num >= aie2_port_id::core::M_CORE_SIZE)
1442 return std::nullopt;
1443 return aie2_port_id::core::M_CORE_OFFSET + port_num;
1444 case WireBundle::TileControl:
1445 if (port_num >= aie2_port_id::core::M_CTRL_SIZE)
1446 return std::nullopt;
1447 return aie2_port_id::core::M_CTRL_OFFSET + port_num;
1448 case WireBundle::DMA:
1449 if (port_num >= aie2_port_id::core::M_DMA_SIZE)
1450 return std::nullopt;
1451 return aie2_port_id::core::M_DMA_OFFSET + port_num;
1452 case WireBundle::East:
1453 if (port_num >= aie2_port_id::core::M_EAST_SIZE)
1454 return std::nullopt;
1455 return aie2_port_id::core::M_EAST_OFFSET + port_num;
1456 case WireBundle::FIFO:
1457 if (port_num >= aie2_port_id::core::M_FIFO_SIZE)
1458 return std::nullopt;
1459 return aie2_port_id::core::M_FIFO_OFFSET + port_num;
1460 case WireBundle::North:
1461 if (port_num >= aie2_port_id::core::M_NORTH_SIZE)
1462 return std::nullopt;
1463 return aie2_port_id::core::M_NORTH_OFFSET + port_num;
1464 case WireBundle::South:
1465 if (port_num >= aie2_port_id::core::M_SOUTH_SIZE)
1466 return std::nullopt;
1467 return aie2_port_id::core::M_SOUTH_OFFSET + port_num;
1468 case WireBundle::West:
1469 if (port_num >= aie2_port_id::core::M_WEST_SIZE)
1470 return std::nullopt;
1471 return aie2_port_id::core::M_WEST_OFFSET + port_num;
1473 return std::nullopt;
1477 case WireBundle::TileControl:
1478 if (port_num >= aie2_port_id::mem::M_CTRL_SIZE)
1479 return std::nullopt;
1480 return aie2_port_id::mem::M_CTRL_OFFSET + port_num;
1481 case WireBundle::DMA:
1482 if (port_num >= aie2_port_id::mem::M_DMA_SIZE)
1483 return std::nullopt;
1484 return aie2_port_id::mem::M_DMA_OFFSET + port_num;
1485 case WireBundle::North:
1486 if (port_num >= aie2_port_id::mem::M_NORTH_SIZE)
1487 return std::nullopt;
1488 return aie2_port_id::mem::M_NORTH_OFFSET + port_num;
1489 case WireBundle::South:
1490 if (port_num >= aie2_port_id::mem::M_SOUTH_SIZE)
1491 return std::nullopt;
1492 return aie2_port_id::mem::M_SOUTH_OFFSET + port_num;
1494 return std::nullopt;
1498 case WireBundle::TileControl:
1499 if (port_num >= aie2_port_id::shim::M_CTRL_SIZE)
1500 return std::nullopt;
1501 return aie2_port_id::shim::M_CTRL_OFFSET + port_num;
1502 case WireBundle::East:
1503 if (port_num >= aie2_port_id::shim::M_EAST_SIZE)
1504 return std::nullopt;
1505 return aie2_port_id::shim::M_EAST_OFFSET + port_num;
1506 case WireBundle::FIFO:
1507 if (port_num >= aie2_port_id::shim::M_FIFO_SIZE)
1508 return std::nullopt;
1509 return aie2_port_id::shim::M_FIFO_OFFSET + port_num;
1510 case WireBundle::North:
1511 if (port_num >= aie2_port_id::shim::M_NORTH_SIZE)
1512 return std::nullopt;
1513 return aie2_port_id::shim::M_NORTH_OFFSET + port_num;
1514 case WireBundle::South:
1515 if (port_num >= aie2_port_id::shim::M_SOUTH_SIZE)
1516 return std::nullopt;
1517 return aie2_port_id::shim::M_SOUTH_OFFSET + port_num;
1518 case WireBundle::West:
1519 if (port_num >= aie2_port_id::shim::M_WEST_SIZE)
1520 return std::nullopt;
1521 return aie2_port_id::shim::M_WEST_OFFSET + port_num;
1523 return std::nullopt;
1531 case WireBundle::Core:
1532 if (port_num >= aie2_port_id::core::S_CORE_SIZE)
1533 return std::nullopt;
1534 return aie2_port_id::core::S_CORE_OFFSET + port_num;
1535 case WireBundle::TileControl:
1536 if (port_num >= aie2_port_id::core::S_CTRL_SIZE)
1537 return std::nullopt;
1538 return aie2_port_id::core::S_CTRL_OFFSET + port_num;
1539 case WireBundle::DMA:
1540 if (port_num >= aie2_port_id::core::S_DMA_SIZE)
1541 return std::nullopt;
1542 return aie2_port_id::core::S_DMA_OFFSET + port_num;
1543 case WireBundle::East:
1544 if (port_num >= aie2_port_id::core::S_EAST_SIZE)
1545 return std::nullopt;
1546 return aie2_port_id::core::S_EAST_OFFSET + port_num;
1547 case WireBundle::FIFO:
1548 if (port_num >= aie2_port_id::core::S_FIFO_SIZE)
1549 return std::nullopt;
1550 return aie2_port_id::core::S_FIFO_OFFSET + port_num;
1551 case WireBundle::North:
1552 if (port_num >= aie2_port_id::core::S_NORTH_SIZE)
1553 return std::nullopt;
1554 return aie2_port_id::core::S_NORTH_OFFSET + port_num;
1555 case WireBundle::South:
1556 if (port_num >= aie2_port_id::core::S_SOUTH_SIZE)
1557 return std::nullopt;
1558 return aie2_port_id::core::S_SOUTH_OFFSET + port_num;
1559 case WireBundle::Trace:
1560 if (port_num >= aie2_port_id::core::S_TRACE_SIZE)
1561 return std::nullopt;
1562 return aie2_port_id::core::S_TRACE_OFFSET + port_num;
1563 case WireBundle::West:
1564 if (port_num >= aie2_port_id::core::S_WEST_SIZE)
1565 return std::nullopt;
1566 return aie2_port_id::core::S_WEST_OFFSET + port_num;
1568 return std::nullopt;
1572 case WireBundle::TileControl:
1573 if (port_num >= aie2_port_id::mem::S_CTRL_SIZE)
1574 return std::nullopt;
1575 return aie2_port_id::mem::S_CTRL_OFFSET + port_num;
1576 case WireBundle::DMA:
1577 if (port_num >= aie2_port_id::mem::S_DMA_SIZE)
1578 return std::nullopt;
1579 return aie2_port_id::mem::S_DMA_OFFSET + port_num;
1580 case WireBundle::North:
1581 if (port_num >= aie2_port_id::mem::S_NORTH_SIZE)
1582 return std::nullopt;
1583 return aie2_port_id::mem::S_NORTH_OFFSET + port_num;
1584 case WireBundle::South:
1585 if (port_num >= aie2_port_id::mem::S_SOUTH_SIZE)
1586 return std::nullopt;
1587 return aie2_port_id::mem::S_SOUTH_OFFSET + port_num;
1588 case WireBundle::Trace:
1589 if (port_num >= aie2_port_id::mem::S_TRACE_SIZE)
1590 return std::nullopt;
1591 return aie2_port_id::mem::S_TRACE_OFFSET + port_num;
1593 return std::nullopt;
1597 case WireBundle::TileControl:
1598 if (port_num >= aie2_port_id::shim::S_CTRL_SIZE)
1599 return std::nullopt;
1600 return aie2_port_id::shim::S_CTRL_OFFSET + port_num;
1601 case WireBundle::East:
1602 if (port_num >= aie2_port_id::shim::S_EAST_SIZE)
1603 return std::nullopt;
1604 return aie2_port_id::shim::S_EAST_OFFSET + port_num;
1605 case WireBundle::FIFO:
1606 if (port_num >= aie2_port_id::shim::S_FIFO_SIZE)
1607 return std::nullopt;
1608 return aie2_port_id::shim::S_FIFO_OFFSET + port_num;
1609 case WireBundle::North:
1610 if (port_num >= aie2_port_id::shim::S_NORTH_SIZE)
1611 return std::nullopt;
1612 return aie2_port_id::shim::S_NORTH_OFFSET + port_num;
1613 case WireBundle::South:
1614 if (port_num >= aie2_port_id::shim::S_SOUTH_SIZE)
1615 return std::nullopt;
1616 return aie2_port_id::shim::S_SOUTH_OFFSET + port_num;
1617 case WireBundle::Trace:
1618 if (port_num >= aie2_port_id::shim::S_TRACE_SIZE)
1619 return std::nullopt;
1620 return aie2_port_id::shim::S_TRACE_OFFSET + port_num;
1621 case WireBundle::West:
1622 if (port_num >= aie2_port_id::shim::S_WEST_SIZE)
1623 return std::nullopt;
1624 return aie2_port_id::shim::S_WEST_OFFSET + port_num;
1626 return std::nullopt;
1630 return std::nullopt;
1636 for (
int j = 0; j <
columns(); j++) {
1644 for (
int j = 0; j <
columns(); j++)
1650 for (
int j = 0; j <
columns(); j++)
1655 for (
int i = 0; i <
rows() - 1; i++)
1656 for (
int j = 0; j <
columns(); j++)
1660 for (
int i = 1; i <
rows(); i++)
1661 for (
int j = 0; j <
columns(); j++)
1665 for (
int i = 0; i <
rows(); i++)
1666 for (
int j = 0; j <
columns() - 1; j++)
1670 for (
int i = 0; i <
rows(); i++)
1671 for (
int j = 1; j <
columns(); j++)
1675 for (
int j = 0; j <
columns(); j++)
1678 for (
int i = 0; i <
rows(); i++)
1680 WireBundle::East) == 0);
1681 for (
int i = 0; i <
rows(); i++)
1685 for (
int i = 0; i <
rows(); i++)
1686 for (
int j = 0; j <
columns(); j++)
1691std::optional<uint32_t>
1693 int lockRow)
const {
1695 if (
isMemSouth(localCol, localRow, lockCol, lockRow))
1697 if (
isMemWest(localCol, localRow, lockCol, lockRow))
1699 if (
isMemNorth(localCol, localRow, lockCol, lockRow))
1701 if (
isMemEast(localCol, localRow, lockCol, lockRow))
1706 if (
isWest(localCol, localRow, lockCol, lockRow))
1708 if (
isInternal(localCol, localRow, lockCol, lockRow))
1710 if (
isEast(localCol, localRow, lockCol, lockRow))
1714 return std::nullopt;
1717std::optional<uint32_t>
1721 if (
isMemSouth(localCol, localRow, memCol, memRow))
1723 if (
isMemWest(localCol, localRow, memCol, memRow))
1725 if (
isMemNorth(localCol, localRow, memCol, memRow))
1727 if (
isMemEast(localCol, localRow, memCol, memRow))
1732 if (
isWest(localCol, localRow, memCol, memRow))
1734 if (
isInternal(localCol, localRow, memCol, memRow))
1736 if (
isEast(localCol, localRow, memCol, memRow))
1740 return std::nullopt;
1749std::vector<std::pair<uint32_t, uint32_t>>
1751 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256),
1756 std::string
const &format)
const {
1757 std::set<std::string> supportedTypes = {
"v8bfp16ebs8",
"v16bfp16ebs16"};
1758 return static_cast<bool>(supportedTypes.find(format) != supportedTypes.end());
1766 AIE::DMAChannelDir direction)
const {
1768 uint64_t offset = 0x00009000 + bd_id * 0x30;
1778 AIE::DMAChannelDir direction)
const {
1780 uint32_t offset = 0x00009300 + (channel * 0x8);
1781 if (direction == AIE::DMAChannelDir::MM2S)
1790std::optional<uint32_t>
1792 AIE::DMAChannelDir direction)
const {
1798 return std::nullopt;
1805 WireBundle bundle)
const {
1806 if (
isShimNOCTile(col, row) && bundle == WireBundle::Controller32)
1813 WireBundle bundle)
const {
1814 if (
isShimNOCTile(col, row) && bundle == WireBundle::Controller32)
1820 int col,
int row, WireBundle bundle, uint32_t channel,
bool master)
const {
1822 if (
isShimNOCTile(col, row) && bundle == WireBundle::Controller32) {
1824 return std::nullopt;
1825 return master ? 22 : 23;
bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is North of dst.
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
std::optional< TileID > getMemSouth(TileID src) const override
Return the tile ID of the memory to the south of the given tile, if it exists.
std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const override
std::optional< TileID > getMemNorth(TileID src) const override
Return the tile ID of the memory to the north of the given tile, if it exists.
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t port_num, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is South of dst.
std::optional< TileID > getMemWest(TileID src) const override
Return the tile ID of the memory to the west of the given tile, if it exists.
bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const override
Return true if core can access the memory in mem.
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
uint32_t getRowShift() const override
uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a shimmux.
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
uint32_t getColumnShift() const override
bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is East of dst.
bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is West of dst.
uint32_t getDmaBdAddressOffset(int col, int row) const override
Return the offset of the base address field within the shim dma buffer descriptor.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
AIEArch getTargetArch() const override
AIE1 TargetModel.
uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a shimmux.
std::optional< TileID > getMemEast(TileID src) const override
Return the tile ID of the memory to the east of the given tile, if it exists.
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
std::optional< uint32_t > getDmaStatusAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the address of the DMA status register for a channel, or nullopt when this target's layout has...
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t channel, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
uint32_t getRowShift() const override
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
uint32_t getNumLocks(AIETileType tileType) const override
Return the number of lock objects for a given tile type.
std::optional< uint32_t > getDmaStatusAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the address of the DMA status register for a channel, or nullopt when this target's layout has...
std::optional< TileID > getMemWest(TileID src) const override
Return the tile ID of the memory to the west of the given tile, if it exists.
std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t port_num, bool master) const override
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
std::unique_ptr< RegisterDatabase > loadRegisterDatabase() const override
AIE2 TargetModel.
AIEArch getTargetArch() const override
Return the target architecture.
bool isLegalMemAffinity(int coreCol, int coreRow, int memCol, int memRow) const override
Return true if core can access the memory in mem.
std::optional< TileID > getMemEast(TileID src) const override
Return the tile ID of the memory to the east of the given tile, if it exists.
bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is North of dst.
uint32_t getNumDestShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a shimmux.
uint32_t getColumnShift() const override
uint64_t getDmaBdAddress(int col, int row, uint32_t bd_id, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma buffer descriptor for the given col, row, buffer descriptor id,...
uint32_t getDmaControlAddress(int col, int row, int channel, AIE::DMAChannelDir direction) const override
Return the array address of the dma task queue register for the given col, row, channel and direction...
std::optional< uint32_t > getLocalLockAddress(uint32_t lockId, TileID tile) const override
std::optional< TileID > getMemSouth(TileID src) const override
Return the tile ID of the memory to the south of the given tile, if it exists.
const DmaBdLayout * getDmaBdLayout(AIETileType tileType) const override
Return the register layout of a buffer descriptor on the given tile type, or null if the target has n...
uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of destinations of connections inside a switchbox.
bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is West of dst.
bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is South of dst.
std::optional< TileID > getMemNorth(TileID src) const override
Return the tile ID of the memory to the north of the given tile, if it exists.
bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const override
Return true if src has a memory tile which is East of dst.
uint32_t getNumSourceShimMuxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a shimmux.
uint32_t getDmaBdAddressOffset(int col, int row) const override
Return the offset of the base address field within the shim dma buffer descriptor.
std::optional< uint32_t > encodeFieldValue(const BitFieldInfo &field, uint32_t value) const
Encode a field value with proper bit shifting.
std::optional< uint32_t > resolvePortValue(llvm::StringRef value, TileID tile, bool master) const
Resolve stream switch port specification to port index.
llvm::DenseMap< TileID, int > getTileToControllerIdMap(bool columnWiseUniqueIDs=true) const
Return a mapping from tile coordinates to controller IDs.
std::optional< uint32_t > getMemLocalBaseAddress(int localCol, int localRow, int memCol, int memRow) const
Return the memory base address (or offset) in the local tile when accessing a neighbor's memory or an...
bool isNorth(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is North of dst.
bool isSouth(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is South of dst.
bool isWest(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is West of dst.
virtual bool isSupportedBlockFormat(std::string const &format) const
bool isCoreTile(int col, int row) const
Return true if the given tile is a Core tile.
virtual bool isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is North of dst.
bool isMemTile(int col, int row) const
Return true if the given tile is a Mem tile.
virtual uint32_t getMemSouthBaseAddress() const =0
Return the base address in the local address map for a core.
std::optional< uint32_t > getLockLocalBaseIndex(int localCol, int localRow, int lockCol, int lockRow) const
Return the lock base index (or offset) in the local tile when accessing a neighbor's lock or an empty...
std::optional< uint32_t > getFieldMask(const BitFieldInfo &field) const
Compute a 32-bit mask for a register field.
virtual uint32_t getNumLocks(AIETileType tileType) const =0
Return the number of lock objects for a given tile type.
std::optional< uint32_t > lookupEvent(llvm::StringRef name, TileID tile, bool isMem=false) const
Lookup event number by name and tile.
const RegisterInfo * lookupRegister(llvm::StringRef name, TileID tile, bool isMem=false) const
Register Database API - provides access to register and event information for trace configuration and...
const RegisterDatabase * getRegisterDatabase() const
Get the register database, loading it lazily on first access.
virtual bool isMemEast(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is East of dst.
bool isShimPLTile(int col, int row) const
Return true if the given tile is a ShimPL tile.
virtual ~AIETargetModel()
virtual bool isValidTile(TileID src) const
Return true if the given tile ID is valid.
bool isEast(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is East of dst.
virtual bool isMemSouth(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is South of dst.
bool isShimNOCorPLTile(int col, int row) const
Return true if the given tile is either a ShimNOC or ShimPL tile.
virtual uint32_t getMemWestBaseAddress() const =0
Return the base address in the local address map for a core.
virtual int rows() const =0
Return the number of rows in the device.
bool isShimNOCTile(int col, int row) const
Return true if the given tile is a ShimNOC tile.
virtual std::unique_ptr< RegisterDatabase > loadRegisterDatabase() const
Subclasses override to provide architecture-specific database loading.
virtual uint32_t getMemNorthBaseAddress() const =0
Return the base address in the local address map for a core.
virtual int columns() const =0
Return the number of columns in the device.
virtual uint32_t getMemEastBaseAddress() const =0
Return the base address in the local address map for a core.
virtual uint32_t getNumMemTileRows() const =0
virtual bool isMemWest(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is West of dst.
virtual uint32_t getNumDestSwitchboxConnections(int col, int row, WireBundle bundle) const =0
Return the number of destinations of connections inside a switchbox.
bool isInternal(int srcCol, int srcRow, int dstCol, int dstRow) const
Return true if src is the internal memory of dst.
virtual uint32_t getMemTileSize() const =0
Return the size (in bytes) of a MemTile.
virtual std::optional< uint32_t > getStreamSwitchPortIndex(int col, int row, WireBundle bundle, uint32_t channel, bool master) const =0
Get stream switch port index for a given port specification Return port index for Stream_Switch_Event...
virtual uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const =0
Return the number of sources of connections inside a switchbox.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
AIEArch getTargetArch() const override
Return the target architecture.
bool isSupportedBlockFormat(std::string const &format) const override
Register and event database for a specific architecture.
static std::unique_ptr< RegisterDatabase > loadAIE2()
Load database for AIE2 architecture.
struct TileID { friend std::ostream &operator<<(std::ostream &os, const TileID &s) { os<< "TileID("<< s.col<< ", "<< s.row<< ")"; return os; } friend std::string to_string(const TileID &s) { std::ostringstream ss; ss<< s; return ss.str(); } friend llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const TileID &s) { os<< to_string(s); return os; } inline bool operator<(const TileID &rhs) const { return std::tie(col, row)< std::tie(rhs.col, rhs.row); } bool operator==(const TileID &rhs) const { return std::tie(col, row)==std::tie(rhs.col, rhs.row); } bool operator!=(const TileID &rhs) const { return !(*this==rhs);} int col, row;} TileID
Bit field information for a register.
uint32_t getWidth() const
The register layout of one tile type's DMA buffer descriptor.
DmaBdField iterationCurrent
DmaBdField iterationStride