CIRCT 22.0.0git
Loading...
Searching...
No Matches
SimOps.h
Go to the documentation of this file.
1//===- SimOps.h - Declare Sim dialect operations ----------------*- C++ -*-===//
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// This file declares the operation classes for the Sim dialect.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef CIRCT_DIALECT_SIM_SIMOPS_H
14#define CIRCT_DIALECT_SIM_SIMOPS_H
15
22#include "mlir/Bytecode/BytecodeOpInterface.h"
23#include "mlir/IR/OpImplementation.h"
24#include "mlir/IR/SymbolTable.h"
25#include "mlir/Interfaces/CallInterfaces.h"
26#include "mlir/Interfaces/FunctionInterfaces.h"
27#include "mlir/Interfaces/InferTypeOpInterface.h"
28
29#include "circt/Dialect/Sim/SimOpInterfaces.h.inc"
30
31#define GET_OP_CLASSES
32#include "circt/Dialect/Sim/Sim.h.inc"
33
34namespace circt {
35namespace sim {
36
37/// Returns the value operand of a value formatting operation.
38/// Returns a null value for all other operations.
39static inline mlir::Value getFormattedValue(mlir::Operation *fmtOp) {
40 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatBinOp>(fmtOp))
41 return fmt.getValue();
42 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatDecOp>(fmtOp))
43 return fmt.getValue();
44 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatOctOp>(fmtOp))
45 return fmt.getValue();
46 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatHexOp>(fmtOp))
47 return fmt.getValue();
48 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatCharOp>(fmtOp))
49 return fmt.getValue();
50 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatGeneralOp>(fmtOp))
51 return fmt.getValue();
52 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatFloatOp>(fmtOp))
53 return fmt.getValue();
54 if (auto fmt = llvm::dyn_cast_or_null<circt::sim::FormatScientificOp>(fmtOp))
55 return fmt.getValue();
56 return {};
57}
58
59} // namespace sim
60} // namespace circt
61
62#endif // CIRCT_DIALECT_SIM_SIMOPS_H
static mlir::Value getFormattedValue(mlir::Operation *fmtOp)
Returns the value operand of a value formatting operation.
Definition SimOps.h:39
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition sim.py:1