CIRCT 24.0.0git
Loading...
Searching...
No Matches
AXI4Ops.h
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef CIRCT_DIALECT_AXI4_AXI4OPS_H
10#define CIRCT_DIALECT_AXI4_AXI4OPS_H
11
12#include "mlir/IR/OpDefinition.h"
13#include "mlir/IR/OpImplementation.h"
14
19
20namespace circt {
21namespace axi4 {
22namespace OpTrait {
23/// Constrains an op's `!axi4.port` results to at most one use each
24template <typename ConcreteType>
26 : public mlir::OpTrait::TraitBase<ConcreteType, PortResultsAtMostOneUse> {
27public:
28 static llvm::LogicalResult verifyTrait(mlir::Operation *op) {
29 for (mlir::Value result : op->getResults())
30 if (mlir::isa<PortType>(result.getType()) && result.hasNUsesOrMore(2))
31 return op->emitOpError(
32 "port result must have at most one use; route through an "
33 "'axi4.xbar' to fan out to multiple endpoints");
34 return mlir::success();
35 }
36};
37} // namespace OpTrait
38} // namespace axi4
39} // namespace circt
40
41#define GET_OP_CLASSES
42#include "circt/Dialect/AXI4/AXI4.h.inc"
43
44#endif // CIRCT_DIALECT_AXI4_AXI4OPS_H
Constrains an op's !axi4.port results to at most one use each.
Definition AXI4Ops.h:26
static llvm::LogicalResult verifyTrait(mlir::Operation *op)
Definition AXI4Ops.h:28
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.