CIRCT
22.0.0git
Loading...
Searching...
No Matches
include
circt
Dialect
FIRRTL
FIRRTLEnums.h
Go to the documentation of this file.
1
//===- FIRRTLEnums.h - FIRRTL dialect enums ---------------------*- 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 contains custom FIRRTL Dialect enumerations.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H
14
#define CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H
15
16
#include "
circt/Dialect/FIRRTL/FIRRTLDialect.h
"
17
#include "
circt/Support/LLVM.h
"
18
19
namespace
circt
{
20
namespace
firrtl {
21
22
//===----------------------------------------------------------------------===//
23
// PortDirections
24
//===----------------------------------------------------------------------===//
25
26
/// This represents the direction of a single port.
27
enum class
Direction
{
In
,
Out
};
28
29
/// Prints the Direction to the stream as either "in" or "out".
30
llvm::raw_ostream &
operator<<
(llvm::raw_ostream &os,
const
Direction
&dir);
31
32
namespace
direction {
33
34
/// Return an output direction if \p isOutput is true, otherwise return an
35
/// input direction.
36
static
inline
Direction
get
(
bool
isOutput) {
return
(
Direction
)isOutput; }
37
38
/// Convert from Direction to bool. The opposite of get;
39
static
inline
bool
unGet
(
Direction
dir) {
return
(
bool
)dir; }
40
41
/// Flip a port direction.
42
Direction
flip
(
Direction
direction);
43
44
static
inline
StringRef
toString
(
Direction
direction) {
45
return
direction ==
Direction::In
?
"in"
:
"out"
;
46
}
47
48
static
inline
StringRef
toString
(
bool
direction) {
49
return
toString
(
get
(direction));
50
}
51
52
/// Return a \p DenseBoolArrayAttr containing the packed representation of an
53
/// array of directions.
54
mlir::DenseBoolArrayAttr
packAttribute
(MLIRContext *
context
,
55
ArrayRef<Direction> directions);
56
57
/// Return a \p DenseBoolArrayAttr containing the packed representation of an
58
/// array of directions.
59
mlir::DenseBoolArrayAttr
packAttribute
(MLIRContext *
context
,
60
ArrayRef<bool> directions);
61
62
/// Turn a packed representation of port attributes into a vector that can
63
/// be worked with.
64
SmallVector<Direction>
unpackAttribute
(mlir::DenseBoolArrayAttr directions);
65
66
}
// namespace direction
67
}
// namespace firrtl
68
}
// namespace circt
69
70
#define GET_ATTRDEF_CLASSES
71
#include "circt/Dialect/FIRRTL/FIRRTLEnums.h.inc"
72
73
#endif
// CIRCT_DIALECT_FIRRTL_FIRRTLENUMS_H
context
static std::unique_ptr< Context > context
Definition
DpiEntryPoints.cpp:37
FIRRTLDialect.h
LLVM.h
circt::firrtl::direction::packAttribute
mlir::DenseBoolArrayAttr packAttribute(MLIRContext *context, ArrayRef< Direction > directions)
Return a DenseBoolArrayAttr containing the packed representation of an array of directions.
Definition
FIRRTLAttributes.cpp:38
circt::firrtl::direction::unGet
static bool unGet(Direction dir)
Convert from Direction to bool. The opposite of get;.
Definition
FIRRTLEnums.h:39
circt::firrtl::direction::flip
Direction flip(Direction direction)
Flip a port direction.
Definition
FIRRTLAttributes.cpp:27
circt::firrtl::direction::unpackAttribute
SmallVector< Direction > unpackAttribute(mlir::DenseBoolArrayAttr directions)
Turn a packed representation of port attributes into a vector that can be worked with.
Definition
FIRRTLAttributes.cpp:54
circt::firrtl::direction::get
static Direction get(bool isOutput)
Return an output direction if isOutput is true, otherwise return an input direction.
Definition
FIRRTLEnums.h:36
circt::firrtl::direction::toString
static StringRef toString(Direction direction)
Definition
FIRRTLEnums.h:44
circt::firrtl::Direction
Direction
This represents the direction of a single port.
Definition
FIRRTLEnums.h:27
circt::firrtl::Direction::Out
@ Out
circt::firrtl::Direction::In
@ In
circt::firrtl::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &os, const InstanceInfo::LatticeValue &value)
Definition
FIRRTLInstanceInfo.h:199
circt
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition
DebugAnalysis.h:21
Generated on Wed Dec 17 2025 00:08:52 for CIRCT by
1.9.8