CIRCT  20.0.0git
SeqOps.h
Go to the documentation of this file.
1 //===- SeqOps.h - Declare Seq 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 Seq dialect.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_SEQ_SEQOPS_H
14 #define CIRCT_DIALECT_SEQ_SEQOPS_H
15 
16 #include "mlir/Bytecode/BytecodeOpInterface.h"
17 #include "mlir/IR/OpImplementation.h"
18 #include "mlir/IR/SymbolTable.h"
19 #include "mlir/Interfaces/InferTypeOpInterface.h"
20 #include "mlir/Interfaces/SideEffectInterfaces.h"
21 
24 #include "circt/Dialect/HW/HWOps.h"
31 
32 #define GET_OP_CLASSES
33 #include "circt/Dialect/Seq/Seq.h.inc"
34 
35 namespace circt {
36 namespace seq {
37 
38 // Returns true if the given sequence of addresses match the shape of the given
39 // HLMemType'd handle.
40 bool isValidIndexValues(Value hlmemHandle, ValueRange addresses);
41 
42 /// Helper structure carrying information about FIR memory generated ops.
43 struct FirMemory {
44  size_t numReadPorts;
45  size_t numWritePorts;
47  size_t dataWidth;
48  size_t depth;
49  size_t maskGran;
50  size_t readLatency;
51  size_t writeLatency;
52  seq::RUW readUnderWrite;
53  seq::WUW writeUnderWrite;
54  SmallVector<int32_t> writeClockIDs;
55  StringRef initFilename;
58 
59  FirMemory(hw::HWModuleGeneratedOp op);
60 };
61 
62 // Helper functions to create constant initial values.
63 mlir::TypedValue<seq::ImmutableType>
64 createConstantInitialValue(OpBuilder builder, Location loc,
65  mlir::IntegerAttr attr);
66 mlir::TypedValue<seq::ImmutableType>
67 createConstantInitialValue(OpBuilder builder, Operation *constantLike);
68 
69 // Helper function to unwrap an immutable type value and get yield value in
70 // initial op.
71 Value unwrapImmutableValue(mlir::TypedValue<seq::ImmutableType> immutableVal);
72 
73 // Helper function to merge initial ops within the block into a single initial
74 // op. Return failure if we cannot topologically sort the initial ops.
75 // Return null if there is no initial op in the block. Return the initial op
76 // otherwise.
77 FailureOr<seq::InitialOp> mergeInitialOps(Block *block);
78 
79 } // namespace seq
80 } // namespace circt
81 
82 #endif // CIRCT_DIALECT_SEQ_SEQOPS_H
FailureOr< seq::InitialOp > mergeInitialOps(Block *block)
Definition: SeqOps.cpp:1093
bool isValidIndexValues(Value hlmemHandle, ValueRange addresses)
Definition: SeqOps.cpp:31
mlir::TypedValue< seq::ImmutableType > createConstantInitialValue(OpBuilder builder, Location loc, mlir::IntegerAttr attr)
Definition: SeqOps.cpp:1065
Value unwrapImmutableValue(mlir::TypedValue< seq::ImmutableType > immutableVal)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: seq.py:1
Helper structure carrying information about FIR memory generated ops.
Definition: SeqOps.h:43
size_t numWritePorts
Definition: SeqOps.h:45
size_t writeLatency
Definition: SeqOps.h:51
seq::WUW writeUnderWrite
Definition: SeqOps.h:53
seq::RUW readUnderWrite
Definition: SeqOps.h:52
FirMemory(hw::HWModuleGeneratedOp op)
Definition: SeqOps.cpp:998
size_t numReadPorts
Definition: SeqOps.h:44
size_t readLatency
Definition: SeqOps.h:50
SmallVector< int32_t > writeClockIDs
Definition: SeqOps.h:54
size_t numReadWritePorts
Definition: SeqOps.h:46
StringRef initFilename
Definition: SeqOps.h:55