Skip to content

Commit 5ef5d11

Browse files
committed
using predicate info to refactor
1 parent 506ac35 commit 5ef5d11

File tree

4 files changed

+492
-1371
lines changed

4 files changed

+492
-1371
lines changed

include/circt/Dialect/Calyx/CalyxLoweringUtils.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,26 @@ class BuildCallInstance : public calyx::FuncOpPartialLoweringPattern {
779779
ComponentOp getCallComponent(mlir::func::CallOp callOp) const;
780780
};
781781

782+
/// Predicate information for the floating point comparisons
783+
struct PredicateInfo {
784+
struct InputPorts {
785+
// Relevant ports to extract from the `std_compareFN`. For example, we
786+
// extract the `lt` and the `unordered` ports when the predicate is `oge`.
787+
enum Port { EQ, GT, LT, UNORDERED } port;
788+
// Whether we should invert the port before passing as inputs to the `op`
789+
// field. For example, we should invert both the `lt` and the `unordered`
790+
// port just extracted for predicate `oge`.
791+
bool invert;
792+
};
793+
794+
// The combinational logic to apply to the input ports. For example, we should
795+
// apply `AND` logic to the two input ports for predicate `oge`.
796+
enum CombLogic { AND, OR, SPECIAL } logic;
797+
SmallVector<InputPorts> inputPorts;
798+
};
799+
800+
PredicateInfo getPredicateInfo(mlir::arith::CmpFPredicate pred);
801+
782802
} // namespace calyx
783803
} // namespace circt
784804

0 commit comments

Comments
 (0)