From 209a585a68be747ffa7fdaeac25619393a90f68f Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 30 Apr 2020 01:03:10 +0100 Subject: [PATCH] Remove VL_NEGATE_{I,Q,E}, use C native unary '-' instead This is to avoid slowing down -O0 models unnecessarily. --- include/verilated.h | 7 ------- src/V3AstNodes.h | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/include/verilated.h b/include/verilated.h index 086838c47..06a70c978 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -1428,13 +1428,6 @@ static inline int _VL_CMPS_W(int lbits, WDataInP lwp, WDataInP rwp) VL_MT_SAFE { //========================================================================= // Math -// Optimization bug in GCC 2.96 and presumably all-pre GCC 3 versions need this workaround, -// we can't just -//# define VL_NEGATE_I(data) (-(data)) -static inline IData VL_NEGATE_I(IData data) VL_PURE { return -data; } -static inline QData VL_NEGATE_Q(QData data) VL_PURE { return -data; } -static inline EData VL_NEGATE_E(EData data) VL_PURE { return -data; } - static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP lwp) VL_MT_SAFE { EData carry = 1; for (int i = 0; i < words; ++i) { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index cab07a6c6..3a8adca4b 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -5089,6 +5089,7 @@ public: virtual void numberOperate(V3Number& out, const V3Number& lhs) { out.opNegate(lhs); } virtual string emitVerilog() { return "%f(- %l)"; } virtual string emitC() { return "VL_NEGATE_%lq(%lW, %P, %li)"; } + virtual string emitSimpleOperator() { return "-"; } virtual bool cleanOut() const { return false; } virtual bool cleanLhs() const { return false; } virtual bool sizeMattersLhs() const { return true; }