From 02273bbe7f3c561977c6b32f3a114a90f8eab737 Mon Sep 17 00:00:00 2001 From: Hanchen Ye Date: Tue, 9 Jan 2024 15:30:30 -0600 Subject: [PATCH] Support math.erf operation --- include/scalehls/Utils/Visitor.h | 3 ++- lib/Translation/EmitHLSCpp.cpp | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/scalehls/Utils/Visitor.h b/include/scalehls/Utils/Visitor.h index 4185a9e5..2da4814f 100644 --- a/include/scalehls/Utils/Visitor.h +++ b/include/scalehls/Utils/Visitor.h @@ -51,7 +51,7 @@ class HLSVisitorBase { // Unary expressions. math::AbsIOp, math::AbsFOp, math::CeilOp, math::CosOp, math::SinOp, math::TanhOp, math::SqrtOp, math::RsqrtOp, math::ExpOp, - math::Exp2Op, math::LogOp, math::Log2Op, math::Log10Op, + math::Exp2Op, math::LogOp, math::Log2Op, math::Log10Op, math::ErfOp, arith::NegFOp, // Float binary expressions. @@ -158,6 +158,7 @@ class HLSVisitorBase { HANDLE(math::LogOp); HANDLE(math::Log2Op); HANDLE(math::Log10Op); + HANDLE(math::ErfOp); HANDLE(arith::NegFOp); // Float binary expressions. diff --git a/lib/Translation/EmitHLSCpp.cpp b/lib/Translation/EmitHLSCpp.cpp index ad22081f..25d2e9b7 100644 --- a/lib/Translation/EmitHLSCpp.cpp +++ b/lib/Translation/EmitHLSCpp.cpp @@ -573,6 +573,7 @@ class ExprVisitor : public HLSVisitorBase { bool visitOp(math::Log10Op op) { return emitter.emitUnary(op, "log10"), true; } + bool visitOp(math::ErfOp op) { return emitter.emitUnary(op, "erf"), true; } bool visitOp(arith::NegFOp op) { return emitter.emitUnary(op, "-"), true; } /// Float binary expressions. @@ -1877,6 +1878,7 @@ void ModuleEmitter::emitModule(ModuleOp module) { //===----------------------------------------------------------------------===// #include +#include #include #include #include