MLIR-AIE 1.4.6.dev
AIEEnums.h
Go to the documentation of this file.
1//===- AIEEnums.h -----------------------------------------------*- C++ -*-===//
2//
3// Copyright (C) 2023 Advanced Micro Devices, Inc.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5//
6//===----------------------------------------------------------------------===//
7
8#ifndef MLIR_AIE_ENUMS_H
9#define MLIR_AIE_ENUMS_H
10
11#include "mlir/IR/BuiltinTypes.h"
12#include "mlir/IR/Dialect.h"
13
14#include "aie/Dialect/AIE/IR/AIEEnums.h.inc"
15
16namespace xilinx::AIE {
17
18/// True if `dir` moves data out of memory onto a stream (MM2S, ControlMM2S).
19inline bool isMM2S(DMAChannelDir dir) {
20 return dir == DMAChannelDir::MM2S || dir == DMAChannelDir::ControlMM2S;
21}
22
23/// True if `dir` moves data from a stream into memory (S2MM, TraceS2MM).
24inline bool isS2MM(DMAChannelDir dir) {
25 return dir == DMAChannelDir::S2MM || dir == DMAChannelDir::TraceS2MM;
26}
27
28/// The stream-switch bundle the channels of `dir` use.
29inline WireBundle getDMAChannelBundle(DMAChannelDir dir) {
30 switch (dir) {
31 case DMAChannelDir::S2MM:
32 case DMAChannelDir::MM2S:
33 break;
34 case DMAChannelDir::ControlMM2S:
35 return WireBundle::DMAControl;
36 case DMAChannelDir::TraceS2MM:
37 return WireBundle::DMATrace;
38 }
39 return WireBundle::DMA;
40}
41
42} // namespace xilinx::AIE
43
44#endif
bool isS2MM(DMAChannelDir dir)
True if dir moves data from a stream into memory (S2MM, TraceS2MM).
Definition AIEEnums.h:24
bool isMM2S(DMAChannelDir dir)
True if dir moves data out of memory onto a stream (MM2S, ControlMM2S).
Definition AIEEnums.h:19
WireBundle getDMAChannelBundle(DMAChannelDir dir)
The stream-switch bundle the channels of dir use.
Definition AIEEnums.h:29