30 bool isEvenRow = ((
src.row % 2) == 0);
31 std::optional<TileID> ret;
35 ret = {
src.col - 1,
src.row};
43 bool isEvenRow = (
src.row % 2) == 0;
44 std::optional<TileID> ret;
46 ret = {
src.col + 1,
src.row};
56 std::optional<TileID> ret({
src.col,
src.row + 1});
63 std::optional<TileID> ret({
src.col,
src.row - 1});
72 bool IsEvenRow = (srcRow % 2) == 0;
73 return (IsEvenRow &&
isInternal(srcCol, srcRow, dstCol, dstRow)) ||
74 (!IsEvenRow &&
isWest(srcCol, srcRow, dstCol, dstRow));
79 bool IsEvenRow = (srcRow % 2) == 0;
80 return (!IsEvenRow &&
isInternal(srcCol, srcRow, dstCol, dstRow)) ||
81 (IsEvenRow &&
isEast(srcCol, srcRow, dstCol, dstRow));
86 return isNorth(srcCol, srcRow, dstCol, dstRow);
91 return isSouth(srcCol, srcRow, dstCol, dstRow);
96 bool IsEvenRow = ((coreRow % 2) == 0);
98 bool IsMemWest = (
isWest(coreCol, coreRow, memCol, memRow) && !IsEvenRow) ||
99 (
isInternal(coreCol, coreRow, memCol, memRow) && IsEvenRow);
101 bool IsMemEast = (
isEast(coreCol, coreRow, memCol, memRow) && IsEvenRow) ||
102 (
isInternal(coreCol, coreRow, memCol, memRow) && !IsEvenRow);
104 bool IsMemNorth =
isNorth(coreCol, coreRow, memCol, memRow);
105 bool IsMemSouth =
isSouth(coreCol, coreRow, memCol, memRow);
107 return IsMemSouth || IsMemNorth || IsMemWest || IsMemEast;
112 WireBundle bundle)
const {
115 case WireBundle::FIFO:
117 case WireBundle::North:
119 case WireBundle::West: {
124 case WireBundle::South:
126 case WireBundle::East: {
131 case WireBundle::TileControl:
138 case WireBundle::Core:
139 case WireBundle::DMA:
140 case WireBundle::FIFO:
142 case WireBundle::North: {
147 case WireBundle::West: {
152 case WireBundle::South:
154 case WireBundle::East: {
159 case WireBundle::TileControl:
168 WireBundle bundle)
const {
171 case WireBundle::FIFO:
173 case WireBundle::North:
175 case WireBundle::West: {
180 case WireBundle::South:
182 case WireBundle::East: {
187 case WireBundle::Trace:
189 case WireBundle::TileControl:
196 case WireBundle::Core:
197 case WireBundle::DMA:
198 case WireBundle::FIFO:
200 case WireBundle::North: {
205 case WireBundle::West: {
210 case WireBundle::South:
212 case WireBundle::East: {
217 case WireBundle::Trace:
219 case WireBundle::TileControl:
227 WireBundle bundle)
const {
230 case WireBundle::DMA:
232 case WireBundle::NOC:
234 case WireBundle::PLIO:
236 case WireBundle::South:
245 WireBundle bundle)
const {
248 case WireBundle::DMA:
250 case WireBundle::NOC:
252 case WireBundle::PLIO:
254 case WireBundle::South:
263 WireBundle srcBundle,
int srcChan,
264 WireBundle dstBundle,
278 if (srcBundle == WireBundle::Trace)
279 return dstBundle == WireBundle::South;
285 if (srcBundle == WireBundle::Trace)
286 return dstBundle == WireBundle::South;
293std::vector<std::pair<uint32_t, uint32_t>>
295 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256)};
298std::optional<uint32_t>
314 std::optional<TileID> ret({
src.col - 1,
src.row});
323 std::optional ret =
src;
332 std::optional<TileID> ret({
src.col,
src.row + 1});
339 std::optional<TileID> ret({
src.col,
src.row - 1});
349 return isWest(srcCol, srcRow, dstCol, dstRow);
354 return isInternal(srcCol, srcRow, dstCol, dstRow);
359 return isNorth(srcCol, srcRow, dstCol, dstRow);
364 return isSouth(srcCol, srcRow, dstCol, dstRow);
370 bool IsMemWest =
isMemWest(coreCol, coreRow, memCol, memRow);
371 bool IsMemEast =
isMemEast(coreCol, coreRow, memCol, memRow);
372 bool IsMemNorth =
isMemNorth(coreCol, coreRow, memCol, memRow);
373 bool IsMemSouth =
isMemSouth(coreCol, coreRow, memCol, memRow);
376 return isEast(coreCol, coreRow, memCol, memRow) ||
377 isInternal(coreCol, coreRow, memCol, memRow) ||
378 isWest(coreCol, coreRow, memCol, memRow);
379 return (IsMemSouth && !
isMemTile(memCol, memRow)) || IsMemNorth ||
380 IsMemWest || IsMemEast;
385 WireBundle bundle)
const {
388 case WireBundle::DMA:
389 case WireBundle::North:
391 case WireBundle::South:
393 case WireBundle::TileControl:
401 case WireBundle::FIFO:
403 case WireBundle::North:
405 case WireBundle::West: {
410 case WireBundle::South:
412 case WireBundle::East: {
417 case WireBundle::TileControl:
424 case WireBundle::Core:
426 case WireBundle::DMA:
428 case WireBundle::FIFO:
430 case WireBundle::North: {
435 case WireBundle::West: {
440 case WireBundle::South:
442 case WireBundle::East: {
447 case WireBundle::TileControl:
456 WireBundle bundle)
const {
459 case WireBundle::DMA:
461 case WireBundle::North:
463 case WireBundle::South:
465 case WireBundle::Trace:
466 case WireBundle::TileControl:
474 case WireBundle::FIFO:
476 case WireBundle::North:
478 case WireBundle::West: {
483 case WireBundle::South:
485 case WireBundle::East: {
490 case WireBundle::Trace:
492 case WireBundle::TileControl:
500 case WireBundle::Core:
502 case WireBundle::DMA:
504 case WireBundle::FIFO:
506 case WireBundle::North: {
511 case WireBundle::West: {
516 case WireBundle::South:
518 case WireBundle::East: {
523 case WireBundle::Trace:
526 case WireBundle::TileControl:
535 WireBundle bundle)
const {
538 case WireBundle::DMA:
540 case WireBundle::NOC:
542 case WireBundle::PLIO:
544 case WireBundle::South:
555 WireBundle bundle)
const {
558 case WireBundle::DMA:
560 case WireBundle::NOC:
562 case WireBundle::PLIO:
564 case WireBundle::South:
574 WireBundle srcBundle,
int srcChan,
575 WireBundle dstBundle,
584 auto isBundleInList = [](WireBundle bundle,
585 std::initializer_list<WireBundle> bundles) {
586 return std::find(bundles.begin(), bundles.end(), bundle) != bundles.end();
591 if (srcBundle == WireBundle::DMA) {
592 if (dstBundle == WireBundle::DMA)
593 return srcChan == dstChan;
594 if (isBundleInList(dstBundle, {WireBundle::TileControl, WireBundle::South,
598 if (srcBundle == WireBundle::TileControl) {
599 if (dstBundle == WireBundle::DMA)
601 if (isBundleInList(dstBundle, {WireBundle::South, WireBundle::North}))
604 if (isBundleInList(srcBundle, {WireBundle::South, WireBundle::North})) {
605 if (isBundleInList(dstBundle, {WireBundle::DMA, WireBundle::TileControl}))
607 if (isBundleInList(dstBundle, {WireBundle::South, WireBundle::North}))
608 return srcChan == dstChan;
610 if (srcBundle == WireBundle::Trace) {
611 if (dstBundle == WireBundle::DMA)
613 if (dstBundle == WireBundle::South)
619 if (srcBundle == WireBundle::TileControl)
620 return dstBundle != WireBundle::TileControl;
621 if (isBundleInList(srcBundle, {WireBundle::FIFO, WireBundle::South}))
622 return isBundleInList(dstBundle,
623 {WireBundle::TileControl, WireBundle::FIFO,
624 WireBundle::South, WireBundle::West,
625 WireBundle::North, WireBundle::East});
626 if (isBundleInList(srcBundle,
627 {WireBundle::West, WireBundle::North, WireBundle::East}))
628 return (srcBundle == dstBundle)
629 ? (srcChan == dstChan)
630 : isBundleInList(dstBundle,
631 {WireBundle::TileControl, WireBundle::FIFO,
632 WireBundle::South, WireBundle::West,
633 WireBundle::North, WireBundle::East});
634 if (srcBundle == WireBundle::Trace) {
635 if (isBundleInList(dstBundle, {WireBundle::FIFO, WireBundle::South}))
637 if (isBundleInList(dstBundle, {WireBundle::West, WireBundle::East}))
643 if (isBundleInList(srcBundle,
644 {WireBundle::DMA, WireBundle::FIFO, WireBundle::South,
645 WireBundle::West, WireBundle::North, WireBundle::East}))
646 if (isBundleInList(dstBundle, {WireBundle::Core, WireBundle::DMA,
647 WireBundle::TileControl, WireBundle::FIFO,
648 WireBundle::South, WireBundle::West,
649 WireBundle::North, WireBundle::East}))
650 return (srcBundle == dstBundle) ? (srcChan == dstChan) :
true;
651 if (srcBundle == WireBundle::Core)
652 return dstBundle != WireBundle::Core;
653 if (srcBundle == WireBundle::TileControl)
654 return dstBundle != WireBundle::TileControl &&
655 dstBundle != WireBundle::DMA;
656 if (srcBundle == WireBundle::Trace) {
657 if (dstBundle == WireBundle::DMA)
659 if (isBundleInList(dstBundle, {WireBundle::FIFO, WireBundle::South}))
666std::vector<std::pair<uint32_t, uint32_t>>
668 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256)};
671std::optional<uint32_t>
673 auto computeTileBaseAddress = 0x0001F000;
674 auto memTileBaseAddress = 0x000C0000;
675 auto shimTileBaseAddress = 0x00014000;
676 auto lockAddrOffset = 0x10;
680 return computeTileBaseAddress + lockAddrOffset * lockId;
683 return memTileBaseAddress + lockAddrOffset * lockId;
687 return shimTileBaseAddress + lockAddrOffset * lockId;
695 for (
int j = 0; j <
columns(); j++) {
703 for (
int j = 0; j <
columns(); j++)
709 for (
int j = 0; j <
columns(); j++)
714 for (
int i = 0; i <
rows() - 1; i++)
715 for (
int j = 0; j <
columns(); j++)
719 for (
int i = 1; i <
rows(); i++)
720 for (
int j = 0; j <
columns(); j++)
724 for (
int i = 0; i <
rows(); i++)
725 for (
int j = 0; j <
columns() - 1; j++)
729 for (
int i = 0; i <
rows(); i++)
730 for (
int j = 1; j <
columns(); j++)
734 for (
int j = 0; j <
columns(); j++)
737 for (
int i = 0; i <
rows(); i++)
739 WireBundle::East) == 0);
740 for (
int i = 0; i <
rows(); i++)
744 for (
int i = 0; i <
rows(); i++)
745 for (
int j = 0; j <
columns(); j++)
750std::optional<uint32_t>
754 if (
isMemSouth(localCol, localRow, lockCol, lockRow))
756 if (
isMemWest(localCol, localRow, lockCol, lockRow))
758 if (
isMemNorth(localCol, localRow, lockCol, lockRow))
760 if (
isMemEast(localCol, localRow, lockCol, lockRow))
765 if (
isWest(localCol, localRow, lockCol, lockRow))
767 if (
isInternal(localCol, localRow, lockCol, lockRow))
769 if (
isEast(localCol, localRow, lockCol, lockRow))
776std::optional<uint32_t>
780 if (
isMemSouth(localCol, localRow, memCol, memRow))
782 if (
isMemWest(localCol, localRow, memCol, memRow))
784 if (
isMemNorth(localCol, localRow, memCol, memRow))
786 if (
isMemEast(localCol, localRow, memCol, memRow))
791 if (
isWest(localCol, localRow, memCol, memRow))
793 if (
isInternal(localCol, localRow, memCol, memRow))
795 if (
isEast(localCol, localRow, memCol, memRow))
804std::vector<std::pair<uint32_t, uint32_t>>
806 return {std::pair(0, 64), std::pair(1, 128), std::pair(2, 256),
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.
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.
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.
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.
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.
bool isCoreTile(int col, int row) const override
Return true if the given tile is a 'Core' tile.
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
bool isMemTile(int col, int row) const override
Return true if the given tile is an AIE2 'Memory' tile.
uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const override
Return the number of sources of connections inside a switchbox.
bool isLegalTileConnection(int col, int row, WireBundle srcBundle, int srcChan, WireBundle dstBundle, int dstChan) const override
uint32_t getNumLocks(int col, int row) const override
Return the number of lock objects.
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
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.
AIEArch getTargetArch() const override
AIE2 TargetModel.
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.
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.
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.
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 isMemNorth(int srcCol, int srcRow, int dstCol, int dstRow) const =0
Return true if src has a memory tile which is North of dst.
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...
virtual bool isCoreTile(int col, int row) const =0
Return true if the given tile is a 'Core' tile.
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.
virtual ~AIETargetModel()
virtual bool isMemTile(int col, int row) const =0
Return true if the given tile is an AIE2 'Memory' tile.
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.
virtual uint32_t getMemWestBaseAddress() const =0
Return the base address in the local address map for a core.
virtual uint32_t getNumLocks(int col, int row) const =0
Return the number of lock objects.
virtual int rows() const =0
Return the number of rows in the device.
virtual bool isShimNOCTile(int col, int row) const =0
Return true if the given tile is a Shim NOC tile.
virtual bool isShimNOCorPLTile(int col, int row) const =0
Return true if the given tile is either a Shim NOC or a Shim PL interface tile.
virtual bool isShimPLTile(int col, int row) const =0
Return true if the given tile is a Shim PL interface tile.
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 uint32_t getNumSourceSwitchboxConnections(int col, int row, WireBundle bundle) const =0
Return the number of sources of connections inside a switchbox.
AIEArch getTargetArch() const override
AIE2 TargetModel.
std::vector< std::pair< uint32_t, uint32_t > > getShimBurstEncodingsAndLengths() const override
TileID { friend std::ostream &operator<<(std::ostream &os, const TileID &s) { os<< "TileID("<< s.col<< ", "<< s.row<< ")" TileID