Skip to content

Commit

Permalink
Convert logical operators to bitwise only in constifyAllLint
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Oct 10, 2023
1 parent 5070362 commit 0ceaa30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/V3Const.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ class ConstVisitor final : public VNVisitor {
bool m_doNConst = false; // Enable non-constant-child simplifications
bool m_doV = false; // Verilog, not C++ conversion
bool m_doGenerate = false; // Postpone width checking inside generate
bool m_convertLogicToBit = false; // Sonvert logical operators to bitwise
bool m_hasJumpDelay = false; // JumpGo or Delay under this while
bool m_underRecFunc = false; // Under a recursive function
AstNodeModule* m_modp = nullptr; // Current module
Expand Down Expand Up @@ -2362,6 +2363,7 @@ class ConstVisitor final : public VNVisitor {
}

bool mayConvertToBitwise(AstNodeBiop* const nodep) {
if (!m_convertLogicToBit) return false;
if (!nodep->lhsp()->width1()) return false;
if (!nodep->rhsp()->width1()) return false;
if (!nodep->isPure()) return false;
Expand Down Expand Up @@ -3756,7 +3758,7 @@ class ConstVisitor final : public VNVisitor {
case PROC_GENERATE: m_doV = true; m_doNConst = true; m_params = true;
m_required = true; m_doGenerate = true; break;
case PROC_LIVE: break;
case PROC_V_WARN: m_doV = true; m_doNConst = true; m_warn = true; break;
case PROC_V_WARN: m_doV = true; m_doNConst = true; m_warn = true; m_convertLogicToBit = true; break;
case PROC_V_NOWARN: m_doV = true; m_doNConst = true; break;
case PROC_V_EXPENSIVE: m_doV = true; m_doNConst = true; m_doExpensive = true; break;
case PROC_CPP: m_doV = false; m_doNConst = true; m_doCpp = true; break;
Expand Down

0 comments on commit 0ceaa30

Please sign in to comment.