Skip to content

Commit

Permalink
Support math.erf operation
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchenye committed Jan 9, 2024
1 parent 4bf297f commit 02273bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/scalehls/Utils/Visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -158,6 +158,7 @@ class HLSVisitorBase {
HANDLE(math::LogOp);
HANDLE(math::Log2Op);
HANDLE(math::Log10Op);
HANDLE(math::ErfOp);
HANDLE(arith::NegFOp);

// Float binary expressions.
Expand Down
2 changes: 2 additions & 0 deletions lib/Translation/EmitHLSCpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ class ExprVisitor : public HLSVisitorBase<ExprVisitor, bool> {
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.
Expand Down Expand Up @@ -1877,6 +1878,7 @@ void ModuleEmitter::emitModule(ModuleOp module) {
//===----------------------------------------------------------------------===//
#include <algorithm>
#include <cmath>
#include <ap_axi_sdata.h>
#include <ap_fixed.h>
#include <ap_int.h>
Expand Down

0 comments on commit 02273bb

Please sign in to comment.