From c5c3c45102ee65246b77de66788896ba7918ba72 Mon Sep 17 00:00:00 2001 From: 24bit-xjkp <63223769+24bit-xjkp@users.noreply.github.com> Date: Thu, 30 Jul 2026 18:14:40 +0800 Subject: [PATCH] Internals: Remove static inline functions in headers (#7988) (#8007) --- include/verilated_cov.h | 24 +- include/verilated_dpi.h | 32 +- include/verilated_funcs.h | 835 ++++++++++++++++------------------ include/verilated_trace_imp.h | 8 +- include/verilated_types.h | 8 +- include/verilatedos.h | 4 +- 6 files changed, 430 insertions(+), 481 deletions(-) diff --git a/include/verilated_cov.h b/include/verilated_cov.h index e1dcad8d2..f47289f74 100644 --- a/include/verilated_cov.h +++ b/include/verilated_cov.h @@ -75,24 +75,24 @@ class VerilatedCovImp; ccontextp->_insertp("hier", name, __VA_ARGS__); \ } while (false) -static inline void VL_COV_TOGGLE_CHG_ST_I(const int width, uint32_t* covp, const IData newData, - const IData oldData) { +inline void VL_COV_TOGGLE_CHG_ST_I(const int width, uint32_t* covp, const IData newData, + const IData oldData) { const IData chgData = newData ^ oldData; for (int i = 0; i < width; ++i) { *(covp + 2 * i + ((newData >> i) & 1)) += (chgData >> i) & 1; } } -static inline void VL_COV_TOGGLE_CHG_ST_Q(const int width, uint32_t* covp, const QData newData, - const QData oldData) { +inline void VL_COV_TOGGLE_CHG_ST_Q(const int width, uint32_t* covp, const QData newData, + const QData oldData) { const QData chgData = newData ^ oldData; for (int i = 0; i < width; ++i) { *(covp + 2 * i + ((newData >> i) & 1)) += (chgData >> i) & 1; } } -static inline void VL_COV_TOGGLE_CHG_ST_W(const int width, uint32_t* covp, WDataInP newData, - WDataInP oldData) { +inline void VL_COV_TOGGLE_CHG_ST_W(const int width, uint32_t* covp, WDataInP newData, + WDataInP oldData) { for (int i = 0; i < VL_WORDS_I(width); ++i) { const EData chgData = newData[i] ^ oldData[i]; if (chgData) { @@ -104,8 +104,8 @@ static inline void VL_COV_TOGGLE_CHG_ST_W(const int width, uint32_t* covp, WData } } -static inline void VL_COV_TOGGLE_CHG_MT_I(const int width, std::atomic* covp, - const IData newData, const IData oldData) VL_MT_SAFE { +inline void VL_COV_TOGGLE_CHG_MT_I(const int width, std::atomic* covp, + const IData newData, const IData oldData) VL_MT_SAFE { const IData chgData = newData ^ oldData; for (int i = 0; i < width; ++i) { if (VL_BITISSET_I(chgData, i)) { @@ -114,8 +114,8 @@ static inline void VL_COV_TOGGLE_CHG_MT_I(const int width, std::atomic } } -static inline void VL_COV_TOGGLE_CHG_MT_Q(const int width, std::atomic* covp, - const QData newData, const QData oldData) VL_MT_SAFE { +inline void VL_COV_TOGGLE_CHG_MT_Q(const int width, std::atomic* covp, + const QData newData, const QData oldData) VL_MT_SAFE { const QData chgData = newData ^ oldData; for (int i = 0; i < width; ++i) { if (VL_BITISSET_Q(chgData, i)) { @@ -124,8 +124,8 @@ static inline void VL_COV_TOGGLE_CHG_MT_Q(const int width, std::atomic } } -static inline void VL_COV_TOGGLE_CHG_MT_W(const int width, std::atomic* covp, - WDataInP newData, WDataInP oldData) VL_MT_SAFE { +inline void VL_COV_TOGGLE_CHG_MT_W(const int width, std::atomic* covp, WDataInP newData, + WDataInP oldData) VL_MT_SAFE { for (int i = 0; i < VL_WORDS_I(width); ++i) { const EData chgData = newData[i] ^ oldData[i]; if (chgData) { diff --git a/include/verilated_dpi.h b/include/verilated_dpi.h index fd8f177ee..93fb87653 100644 --- a/include/verilated_dpi.h +++ b/include/verilated_dpi.h @@ -37,68 +37,68 @@ // SETTING OPERATORS // Convert svBitVecVal to Verilator internal data -static inline void VL_SET_W_SVBV(int obits, WDataOutP owp, const svBitVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_W_SVBV(int obits, WDataOutP owp, const svBitVecVal* lwp) VL_MT_SAFE { const int words = VL_WORDS_I(obits); for (int i = 0; i < words - 1; ++i) owp[i] = lwp[i]; owp[words - 1] = lwp[words - 1] & VL_MASK_I(obits); } -static inline void VL_SET_Q_SVBV(int obits, QData& out, const svBitVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_Q_SVBV(int obits, QData& out, const svBitVecVal* lwp) VL_MT_SAFE { out = VL_MASK_Q(obits) & VL_SET_QII(lwp[1], lwp[0]); } -static inline void VL_SET_I_SVBV(int obits, IData& out, const svBitVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_I_SVBV(int obits, IData& out, const svBitVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0]; } -static inline void VL_SET_S_SVBV(int obits, SData& out, const svBitVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_S_SVBV(int obits, SData& out, const svBitVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0]; } -static inline void VL_SET_C_SVBV(int obits, CData& out, const svBitVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_C_SVBV(int obits, CData& out, const svBitVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0]; } // Convert Verilator internal data to svBitVecVal -static inline void VL_SET_SVBV_W(int obits, svBitVecVal* owp, const WDataInP lwp) VL_MT_SAFE { +inline void VL_SET_SVBV_W(int obits, svBitVecVal* owp, const WDataInP lwp) VL_MT_SAFE { const int words = VL_WORDS_I(obits); for (int i = 0; i < words - 1; ++i) owp[i] = lwp[i]; owp[words - 1] = lwp[words - 1] & VL_MASK_I(obits); } -static inline void VL_SET_SVBV_I(int, svBitVecVal* owp, const IData ld) VL_MT_SAFE { owp[0] = ld; } -static inline void VL_SET_SVBV_Q(int, svBitVecVal* owp, const QData ld) VL_MT_SAFE { +inline void VL_SET_SVBV_I(int, svBitVecVal* owp, const IData ld) VL_MT_SAFE { owp[0] = ld; } +inline void VL_SET_SVBV_Q(int, svBitVecVal* owp, const QData ld) VL_MT_SAFE { VL_SET_WQ(WDataOutP::external(owp), ld); } // Convert svLogicVecVal to Verilator internal data // Note these functions ignore X/Z in svLogicVecVal -static inline void VL_SET_W_SVLV(int obits, WDataOutP owp, const svLogicVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_W_SVLV(int obits, WDataOutP owp, const svLogicVecVal* lwp) VL_MT_SAFE { const int words = VL_WORDS_I(obits); for (int i = 0; i < words - 1; ++i) owp[i] = lwp[i].aval; owp[words - 1] = lwp[words - 1].aval & VL_MASK_I(obits); } -static inline void VL_SET_Q_SVLV(int obits, QData& out, const svLogicVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_Q_SVLV(int obits, QData& out, const svLogicVecVal* lwp) VL_MT_SAFE { out = VL_MASK_Q(obits) & VL_SET_QII(lwp[1].aval, lwp[0].aval); } -static inline void VL_SET_I_SVLV(int obits, IData& out, const svLogicVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_I_SVLV(int obits, IData& out, const svLogicVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0].aval; } -static inline void VL_SET_S_SVLV(int obits, SData& out, const svLogicVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_S_SVLV(int obits, SData& out, const svLogicVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0].aval; } -static inline void VL_SET_C_SVLV(int obits, CData& out, const svLogicVecVal* lwp) VL_MT_SAFE { +inline void VL_SET_C_SVLV(int obits, CData& out, const svLogicVecVal* lwp) VL_MT_SAFE { out = VL_MASK_I(obits) & lwp[0].aval; } // Convert Verilator internal data to svLogicVecVal // Note these functions never create X/Z in svLogicVecVal -static inline void VL_SET_SVLV_W(int obits, svLogicVecVal* owp, const WDataInP lwp) VL_MT_SAFE { +inline void VL_SET_SVLV_W(int obits, svLogicVecVal* owp, const WDataInP lwp) VL_MT_SAFE { const int words = VL_WORDS_I(obits); for (int i = 0; i < words; ++i) owp[i].bval = 0; for (int i = 0; i < words - 1; ++i) owp[i].aval = lwp[i]; owp[words - 1].aval = lwp[words - 1] & VL_MASK_I(obits); } -static inline void VL_SET_SVLV_I(int, svLogicVecVal* owp, const IData ld) VL_MT_SAFE { +inline void VL_SET_SVLV_I(int, svLogicVecVal* owp, const IData ld) VL_MT_SAFE { owp[0].aval = ld; owp[0].bval = 0; } -static inline void VL_SET_SVLV_Q(int, svLogicVecVal* owp, const QData ld) VL_MT_SAFE { +inline void VL_SET_SVLV_Q(int, svLogicVecVal* owp, const QData ld) VL_MT_SAFE { VlWide<2> lwp; VL_SET_WQ(lwp, ld); owp[0].aval = lwp[0]; diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index 349fe44da..4202d9cd3 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -206,17 +206,17 @@ extern const char* vl_mc_scan_plusargs(const char* prefixp) VL_MT_SAFE; // PLIi // Create two 32-bit words from quadword // VLWide is always at least 2 words; does not clean upper bits -static inline WDataOutP VL_SET_WQ(WDataOutP owp, QData data) VL_PURE { +inline WDataOutP VL_SET_WQ(WDataOutP owp, QData data) VL_PURE { owp[0] = static_cast(data); owp[1] = static_cast(data >> VL_EDATASIZE); return owp; } -static inline WDataOutP VL_SET_WI(WDataOutP owp, IData data) VL_PURE { +inline WDataOutP VL_SET_WI(WDataOutP owp, IData data) VL_PURE { owp[0] = static_cast(data); owp[1] = 0; return owp; } -static inline QData VL_SET_QW(WDataInP lwp) VL_PURE { +inline QData VL_SET_QW(WDataInP lwp) VL_PURE { return (static_cast(lwp[1]) << VL_EDATASIZE) | static_cast(lwp[0]); } #define VL_SET_QII(ld, rd) ((static_cast(ld) << 32ULL) | static_cast(rd)) @@ -227,46 +227,46 @@ extern FILE* VL_CVT_I_FP(IData lhs) VL_MT_SAFE; // clang-format off // Use a union to avoid cast-to-different-size warnings // Return void* from QData -static inline void* VL_CVT_Q_VP(QData lhs) VL_PURE { +inline void* VL_CVT_Q_VP(QData lhs) VL_PURE { union { void* fp; QData q; } u; u.q = lhs; return u.fp; } // Return QData from const void* -static inline QData VL_CVT_VP_Q(const void* fp) VL_PURE { +inline QData VL_CVT_VP_Q(const void* fp) VL_PURE { union { const void* fp; QData q; } u; u.q = 0; u.fp = fp; return u.q; } // Return double from QData (bits, not numerically) -static inline double VL_CVT_D_Q(QData lhs) VL_PURE { +inline double VL_CVT_D_Q(QData lhs) VL_PURE { union { double d; QData q; } u; u.q = lhs; return u.d; } // Return QData from double (bits, not numerically) -static inline QData VL_CVT_Q_D(double lhs) VL_PURE { +inline QData VL_CVT_Q_D(double lhs) VL_PURE { union { double d; QData q; } u; u.d = lhs; return u.q; } // clang-format on // Return string from DPI char* -static inline std::string VL_CVT_N_CSTR(const char* lhsp) VL_PURE { +inline std::string VL_CVT_N_CSTR(const char* lhsp) VL_PURE { return lhsp ? std::string{lhsp} : ""s; } // Return queue from an unpacked array template -static inline VlQueue VL_CVT_UNPACK_TO_Q(const VlUnpacked& q) VL_PURE { +inline VlQueue VL_CVT_UNPACK_TO_Q(const VlUnpacked& q) VL_PURE { VlQueue ret; for (size_t i = 0; i < N_Depth; ++i) ret.push_back(q[i]); return ret; } // Masked match functions -static inline IData VL_MATCHMASKED_I(int, IData lhs, WDataInP matchp) VL_PURE { +inline IData VL_MATCHMASKED_I(int, IData lhs, WDataInP matchp) VL_PURE { size_t i = 0; while (true) { const IData mask = matchp[i * 2]; @@ -276,7 +276,7 @@ static inline IData VL_MATCHMASKED_I(int, IData lhs, WDataInP matchp) VL_PURE { } return i; } -static inline IData VL_MATCHMASKED_Q(int, QData lhs, WDataInP matchp) VL_PURE { +inline IData VL_MATCHMASKED_Q(int, QData lhs, WDataInP matchp) VL_PURE { size_t i = 0; while (true) { const QData mask = VL_SET_QW(matchp + i * 4); @@ -286,7 +286,7 @@ static inline IData VL_MATCHMASKED_Q(int, QData lhs, WDataInP matchp) VL_PURE { } return i; } -static inline IData VL_MATCHMASKED_W(int lbits, WDataInP lhsp, WDataInP matchp) VL_MT_SAFE { +inline IData VL_MATCHMASKED_W(int lbits, WDataInP lhsp, WDataInP matchp) VL_MT_SAFE { const int iwords = VL_WORDS_I(lbits); size_t i = 0; while (true) { @@ -302,28 +302,28 @@ static inline IData VL_MATCHMASKED_W(int lbits, WDataInP lhsp, WDataInP matchp) // Return double from lhs (numeric) unsigned double VL_ITOR_D_W(int lbits, WDataInP const lwp) VL_PURE; -static inline double VL_ITOR_D_I(int, IData lhs) VL_PURE { +inline double VL_ITOR_D_I(int, IData lhs) VL_PURE { return static_cast(static_cast(lhs)); } -static inline double VL_ITOR_D_Q(int, QData lhs) VL_PURE { +inline double VL_ITOR_D_Q(int, QData lhs) VL_PURE { return static_cast(static_cast(lhs)); } // Return double from lhs (numeric) signed double VL_ISTOR_D_W(int lbits, WDataInP const lwp) VL_MT_SAFE; -static inline double VL_ISTOR_D_I(int lbits, IData lhs) VL_MT_SAFE { +inline double VL_ISTOR_D_I(int lbits, IData lhs) VL_MT_SAFE { if (lbits == 32) return static_cast(static_cast(lhs)); VlWide lwp; VL_SET_WI(lwp, lhs); return VL_ISTOR_D_W(lbits, lwp); } -static inline double VL_ISTOR_D_Q(int lbits, QData lhs) VL_MT_SAFE { +inline double VL_ISTOR_D_Q(int lbits, QData lhs) VL_MT_SAFE { if (lbits == 64) return static_cast(static_cast(lhs)); VlWide lwp; VL_SET_WQ(lwp, lhs); return VL_ISTOR_D_W(lbits, lwp); } // Return IData truncated from double (numeric) -static inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast(VL_TRUNC(lhs)); } +inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast(VL_TRUNC(lhs)); } // Sign extend such that if MSB set, we get ffff_ffff, else 0s // (Requires clean input) @@ -336,10 +336,10 @@ static inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast(rhs) << VL_BITBIT_Q(bit))); } -static inline void VL_ASSIGNBIT_WI(int bit, WDataOutP owp, IData rhs) VL_MT_SAFE { +inline void VL_ASSIGNBIT_WI(int bit, WDataOutP owp, IData rhs) VL_MT_SAFE { const EData orig = owp[VL_BITWORD_E(bit)]; owp[VL_BITWORD_E(bit)] = ((orig & ~(VL_EUL(1) << VL_BITBIT_E(bit))) | (static_cast(rhs) << VL_BITBIT_E(bit))); } // Alternative form that is an instruction faster when rhs is constant one. -static inline void VL_ASSIGNBIT_IO(int bit, CData& lhsr) VL_PURE { +inline void VL_ASSIGNBIT_IO(int bit, CData& lhsr) VL_PURE { lhsr = (lhsr | (VL_UL(1) << VL_BITBIT_I(bit))); } -static inline void VL_ASSIGNBIT_IO(int bit, SData& lhsr) VL_PURE { +inline void VL_ASSIGNBIT_IO(int bit, SData& lhsr) VL_PURE { lhsr = (lhsr | (VL_UL(1) << VL_BITBIT_I(bit))); } -static inline void VL_ASSIGNBIT_IO(int bit, IData& lhsr) VL_PURE { +inline void VL_ASSIGNBIT_IO(int bit, IData& lhsr) VL_PURE { lhsr = (lhsr | (VL_UL(1) << VL_BITBIT_I(bit))); } -static inline void VL_ASSIGNBIT_QO(int bit, QData& lhsr) VL_PURE { +inline void VL_ASSIGNBIT_QO(int bit, QData& lhsr) VL_PURE { lhsr = (lhsr | (1ULL << VL_BITBIT_Q(bit))); } -static inline void VL_ASSIGNBIT_WO(int bit, WDataOutP owp) VL_MT_SAFE { +inline void VL_ASSIGNBIT_WO(int bit, WDataOutP owp) VL_MT_SAFE { const EData orig = owp[VL_BITWORD_E(bit)]; owp[VL_BITWORD_E(bit)] = (orig | (VL_EUL(1) << VL_BITBIT_E(bit))); } @@ -631,19 +628,18 @@ static inline void VL_ASSIGNBIT_WO(int bit, WDataOutP owp) VL_MT_SAFE { #define VL_EXTEND_QI(obits, lbits, lhs) (static_cast(lhs)) #define VL_EXTEND_QQ(obits, lbits, lhs) ((lhs)) -static inline WDataOutP VL_EXTEND_WI(int obits, int, WDataOutP owp, IData ld) VL_MT_SAFE { +inline WDataOutP VL_EXTEND_WI(int obits, int, WDataOutP owp, IData ld) VL_MT_SAFE { // Note for extracts that obits != lbits owp[0] = ld; VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); return owp; } -static inline WDataOutP VL_EXTEND_WQ(int obits, int, WDataOutP owp, QData ld) VL_MT_SAFE { +inline WDataOutP VL_EXTEND_WQ(int obits, int, WDataOutP owp, QData ld) VL_MT_SAFE { VL_SET_WQ(owp, ld); VL_MEMSET_ZERO_W(owp + VL_WQ_WORDS_E, VL_WORDS_I(obits) - VL_WQ_WORDS_E); return owp; } -static inline WDataOutP VL_EXTEND_WW(int obits, int lbits, WDataOutP owp, - WDataInP const lwp) VL_MT_SAFE { +inline WDataOutP VL_EXTEND_WW(int obits, int lbits, WDataOutP owp, WDataInP const lwp) VL_MT_SAFE { const int lwords = VL_WORDS_I(lbits); VL_PREFETCH_RD(lwp.datap()); VL_MEMSET_ZERO_W(owp + lwords, VL_WORDS_I(obits) - lwords); @@ -652,17 +648,17 @@ static inline WDataOutP VL_EXTEND_WW(int obits, int lbits, WDataOutP owp, // EMIT_RULE: VL_EXTENDS: oclean=*dirty*; obits=lbits; // Sign extension; output dirty -static inline IData VL_EXTENDS_II(int, int lbits, IData lhs) VL_PURE { +inline IData VL_EXTENDS_II(int, int lbits, IData lhs) VL_PURE { return VL_EXTENDSIGN_I(lbits, lhs) | lhs; } -static inline QData VL_EXTENDS_QI(int, int lbits, QData lhs /*Q_as_need_extended*/) VL_PURE { +inline QData VL_EXTENDS_QI(int, int lbits, QData lhs /*Q_as_need_extended*/) VL_PURE { return VL_EXTENDSIGN_Q(lbits, lhs) | lhs; } -static inline QData VL_EXTENDS_QQ(int, int lbits, QData lhs) VL_PURE { +inline QData VL_EXTENDS_QQ(int, int lbits, QData lhs) VL_PURE { return VL_EXTENDSIGN_Q(lbits, lhs) | lhs; } -static inline WDataOutP VL_EXTENDS_WI(int obits, int lbits, WDataOutP owp, IData ld) VL_MT_SAFE { +inline WDataOutP VL_EXTENDS_WI(int obits, int lbits, WDataOutP owp, IData ld) VL_MT_SAFE { owp[0] = ld; if (VL_SIGN_E(lbits, owp[0])) { owp[0] |= ~VL_MASK_E(lbits); @@ -672,7 +668,7 @@ static inline WDataOutP VL_EXTENDS_WI(int obits, int lbits, WDataOutP owp, IData } return owp; } -static inline WDataOutP VL_EXTENDS_WQ(int obits, int lbits, WDataOutP owp, QData ld) VL_MT_SAFE { +inline WDataOutP VL_EXTENDS_WQ(int obits, int lbits, WDataOutP owp, QData ld) VL_MT_SAFE { VL_SET_WQ(owp, ld); if (VL_SIGN_E(lbits, owp[1])) { owp[1] |= ~VL_MASK_E(lbits); @@ -682,8 +678,8 @@ static inline WDataOutP VL_EXTENDS_WQ(int obits, int lbits, WDataOutP owp, QData } return owp; } -static inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, - WDataInP const lwp) VL_MT_SAFE { +inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, + WDataInP const lwp) VL_MT_SAFE { const int lwords = VL_WORDS_I(lbits); VL_PREFETCH_RD(lwp.datap()); owp[lwords - 1] = lwp[lwords - 1]; @@ -702,7 +698,7 @@ static inline WDataOutP VL_EXTENDS_WW(int obits, int lbits, WDataOutP owp, // EMIT_RULE: VL_REDAND: oclean=clean; lclean==clean; obits=1; #define VL_REDAND_II(lbits, lhs) ((lhs) == VL_MASK_I(lbits)) #define VL_REDAND_IQ(lbits, lhs) ((lhs) == VL_MASK_Q(lbits)) -static inline IData VL_REDAND_IW(int lbits, WDataInP const lwp) VL_PURE { +inline IData VL_REDAND_IW(int lbits, WDataInP const lwp) VL_PURE { const int words = VL_WORDS_I(lbits); EData combine = lwp[0]; for (int i = 1; i < words - 1; ++i) combine &= lwp[i]; @@ -714,19 +710,19 @@ static inline IData VL_REDAND_IW(int lbits, WDataInP const lwp) VL_PURE { // EMIT_RULE: VL_REDOR: oclean=clean; lclean==clean; obits=1; #define VL_REDOR_I(lhs) ((lhs) != 0) #define VL_REDOR_Q(lhs) ((lhs) != 0) -static inline IData VL_REDOR_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_REDOR_W(int words, WDataInP const lwp) VL_PURE { EData equal = 0; for (int i = 0; i < words; ++i) equal |= lwp[i]; return (equal != 0); } // EMIT_RULE: VL_REDXOR: oclean=dirty; obits=1; -static inline IData VL_REDXOR_2(IData r) VL_PURE { +inline IData VL_REDXOR_2(IData r) VL_PURE { // Experiments show VL_REDXOR_2 is faster than __builtin_parityl r = (r ^ (r >> 1)); return r; } -static inline IData VL_REDXOR_4(IData r) VL_PURE { +inline IData VL_REDXOR_4(IData r) VL_PURE { #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return __builtin_parityl(r); #else @@ -735,7 +731,7 @@ static inline IData VL_REDXOR_4(IData r) VL_PURE { return r; #endif } -static inline IData VL_REDXOR_8(IData r) VL_PURE { +inline IData VL_REDXOR_8(IData r) VL_PURE { #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return __builtin_parityl(r); #else @@ -745,7 +741,7 @@ static inline IData VL_REDXOR_8(IData r) VL_PURE { return r; #endif } -static inline IData VL_REDXOR_16(IData r) VL_PURE { +inline IData VL_REDXOR_16(IData r) VL_PURE { #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return __builtin_parityl(r); #else @@ -756,7 +752,7 @@ static inline IData VL_REDXOR_16(IData r) VL_PURE { return r; #endif } -static inline IData VL_REDXOR_32(IData r) VL_PURE { +inline IData VL_REDXOR_32(IData r) VL_PURE { #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return __builtin_parityl(r); #else @@ -768,7 +764,7 @@ static inline IData VL_REDXOR_32(IData r) VL_PURE { return r; #endif } -static inline IData VL_REDXOR_64(QData r) VL_PURE { +inline IData VL_REDXOR_64(QData r) VL_PURE { #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return __builtin_parityll(r); #else @@ -781,14 +777,14 @@ static inline IData VL_REDXOR_64(QData r) VL_PURE { return static_cast(r); #endif } -static inline IData VL_REDXOR_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_REDXOR_W(int words, WDataInP const lwp) VL_PURE { EData r = lwp[0]; for (int i = 1; i < words; ++i) r ^= lwp[i]; return VL_REDXOR_32(r); } // EMIT_RULE: VL_COUNTONES_II: oclean = false; lhs clean -static inline IData VL_COUNTONES_I(IData lhs) VL_PURE { +inline IData VL_COUNTONES_I(IData lhs) VL_PURE { // This is faster than __builtin_popcountl IData r = lhs - ((lhs >> 1) & 033333333333) - ((lhs >> 2) & 011111111111); r = (r + (r >> 3)) & 030707070707; @@ -796,19 +792,18 @@ static inline IData VL_COUNTONES_I(IData lhs) VL_PURE { r = (r + (r >> 12) + (r >> 24)) & 077; return r; } -static inline IData VL_COUNTONES_Q(QData lhs) VL_PURE { +inline IData VL_COUNTONES_Q(QData lhs) VL_PURE { return VL_COUNTONES_I(static_cast(lhs)) + VL_COUNTONES_I(static_cast(lhs >> 32)); } #define VL_COUNTONES_E VL_COUNTONES_I -static inline IData VL_COUNTONES_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_COUNTONES_W(int words, WDataInP const lwp) VL_PURE { EData r = 0; for (int i = 0; i < words; ++i) r += VL_COUNTONES_E(lwp[i]); return r; } // EMIT_RULE: VL_COUNTBITS_II: oclean = false; lhs clean -static inline IData VL_COUNTBITS_I(int lbits, IData lhs, IData ctrl0, IData ctrl1, - IData ctrl2) VL_PURE { +inline IData VL_COUNTBITS_I(int lbits, IData lhs, IData ctrl0, IData ctrl1, IData ctrl2) VL_PURE { const int ctrlSum = (ctrl0 & 0x1) + (ctrl1 & 0x1) + (ctrl2 & 0x1); if (ctrlSum == 3) return VL_COUNTONES_I(lhs); if (ctrlSum == 0) { @@ -817,14 +812,13 @@ static inline IData VL_COUNTBITS_I(int lbits, IData lhs, IData ctrl0, IData ctrl } return (lbits == 32) ? 32 : lbits; } -static inline IData VL_COUNTBITS_Q(int lbits, QData lhs, IData ctrl0, IData ctrl1, - IData ctrl2) VL_PURE { +inline IData VL_COUNTBITS_Q(int lbits, QData lhs, IData ctrl0, IData ctrl1, IData ctrl2) VL_PURE { return VL_COUNTBITS_I(32, static_cast(lhs), ctrl0, ctrl1, ctrl2) + VL_COUNTBITS_I(lbits - 32, static_cast(lhs >> 32), ctrl0, ctrl1, ctrl2); } #define VL_COUNTBITS_E VL_COUNTBITS_I -static inline IData VL_COUNTBITS_W(int lbits, int words, WDataInP const lwp, IData ctrl0, - IData ctrl1, IData ctrl2) VL_MT_SAFE { +inline IData VL_COUNTBITS_W(int lbits, int words, WDataInP const lwp, IData ctrl0, IData ctrl1, + IData ctrl2) VL_MT_SAFE { EData r = 0; IData wordLbits = 32; for (int i = 0; i < words; ++i) { @@ -834,15 +828,15 @@ static inline IData VL_COUNTBITS_W(int lbits, int words, WDataInP const lwp, IDa return r; } -static inline IData VL_ONEHOT_I(IData lhs) VL_PURE { +inline IData VL_ONEHOT_I(IData lhs) VL_PURE { const IData y = lhs - 1; return y < (lhs ^ y); } -static inline IData VL_ONEHOT_Q(QData lhs) VL_PURE { +inline IData VL_ONEHOT_Q(QData lhs) VL_PURE { const QData y = lhs - 1; return y < (lhs ^ y); } -static inline IData VL_ONEHOT_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_ONEHOT_W(int words, WDataInP const lwp) VL_PURE { EData one = 0; for (int i = 0; (i < words); ++i) { if (lwp[i]) { @@ -854,9 +848,9 @@ static inline IData VL_ONEHOT_W(int words, WDataInP const lwp) VL_PURE { return one; } -static inline IData VL_ONEHOT0_I(IData lhs) VL_PURE { return ((lhs & (lhs - 1)) == 0); } -static inline IData VL_ONEHOT0_Q(QData lhs) VL_PURE { return ((lhs & (lhs - 1)) == 0); } -static inline IData VL_ONEHOT0_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_ONEHOT0_I(IData lhs) VL_PURE { return ((lhs & (lhs - 1)) == 0); } +inline IData VL_ONEHOT0_Q(QData lhs) VL_PURE { return ((lhs & (lhs - 1)) == 0); } +inline IData VL_ONEHOT0_W(int words, WDataInP const lwp) VL_PURE { bool one = false; for (int i = 0; (i < words); ++i) { if (lwp[i]) { @@ -868,7 +862,7 @@ static inline IData VL_ONEHOT0_W(int words, WDataInP const lwp) VL_PURE { return 1; } -static inline IData VL_CLOG2_I(IData lhs) VL_PURE { +inline IData VL_CLOG2_I(IData lhs) VL_PURE { // There are faster algorithms, or fls GCC4 builtins, but rarely used // In C++20 there will be std::bit_width(lhs) - 1 if (VL_UNLIKELY(!lhs)) return 0; @@ -877,14 +871,14 @@ static inline IData VL_CLOG2_I(IData lhs) VL_PURE { for (; lhs != 0; ++shifts) lhs = lhs >> 1; return shifts; } -static inline IData VL_CLOG2_Q(QData lhs) VL_PURE { +inline IData VL_CLOG2_Q(QData lhs) VL_PURE { if (VL_UNLIKELY(!lhs)) return 0; --lhs; int shifts = 0; for (; lhs != 0; ++shifts) lhs = lhs >> 1ULL; return shifts; } -static inline IData VL_CLOG2_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_CLOG2_W(int words, WDataInP const lwp) VL_PURE { const EData adjust = (VL_COUNTONES_W(words, lwp) == 1) ? 0 : 1; for (int i = words - 1; i >= 0; --i) { if (VL_UNLIKELY(lwp[i])) { // Shorter worst case if predict not taken @@ -899,7 +893,7 @@ static inline IData VL_CLOG2_W(int words, WDataInP const lwp) VL_PURE { return 0; } -static inline IData VL_MOSTSETBITP1_I(IData lhs) VL_PURE { +inline IData VL_MOSTSETBITP1_I(IData lhs) VL_PURE { if (VL_UNLIKELY(!lhs)) return 0; // __builtin_clz is undefined for 0 #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return VL_EDATASIZE - __builtin_clz(lhs); @@ -910,7 +904,7 @@ static inline IData VL_MOSTSETBITP1_I(IData lhs) VL_PURE { return 0; // LCOV_EXCL_LINE // Can't get here - one bit must be set #endif } -static inline IData VL_MOSTSETBITP1_Q(QData lhs) VL_PURE { +inline IData VL_MOSTSETBITP1_Q(QData lhs) VL_PURE { if (VL_UNLIKELY(!lhs)) return 0; #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(VL_NO_BUILTINS) return 64 - __builtin_clzll(static_cast(lhs)); @@ -920,7 +914,7 @@ static inline IData VL_MOSTSETBITP1_Q(QData lhs) VL_PURE { : VL_MOSTSETBITP1_I(static_cast(lhs)); #endif } -static inline IData VL_MOSTSETBITP1_W(int words, WDataInP const lwp) VL_PURE { +inline IData VL_MOSTSETBITP1_W(int words, WDataInP const lwp) VL_PURE { for (int i = words - 1; i >= 0; --i) { // Shorter worst case if predict not taken if (VL_UNLIKELY(lwp[i])) return i * VL_EDATASIZE + VL_MOSTSETBITP1_I(lwp[i]); @@ -932,31 +926,31 @@ static inline IData VL_MOSTSETBITP1_W(int words, WDataInP const lwp) VL_PURE { // SIMPLE LOGICAL OPERATORS // EMIT_RULE: VL_AND: oclean=lclean||rclean; obits=lbits; lbits==rbits; -static inline WDataOutP VL_AND_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_AND_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 0; (i < words); ++i) owp[i] = (lwp[i] & rwp[i]); return owp; } // EMIT_RULE: VL_OR: oclean=lclean&&rclean; obits=lbits; lbits==rbits; -static inline WDataOutP VL_OR_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_OR_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 0; (i < words); ++i) owp[i] = (lwp[i] | rwp[i]); return owp; } // EMIT_RULE: VL_CHANGEXOR: oclean=1; obits=32; lbits==rbits; -static inline IData VL_CHANGEXOR_W(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { +inline IData VL_CHANGEXOR_W(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { IData od = 0; for (int i = 0; (i < words); ++i) od |= (lwp[i] ^ rwp[i]); return od; } // EMIT_RULE: VL_XOR: oclean=lclean&&rclean; obits=lbits; lbits==rbits; -static inline WDataOutP VL_XOR_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_XOR_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 0; (i < words); ++i) owp[i] = (lwp[i] ^ rwp[i]); return owp; } // EMIT_RULE: VL_NOT: oclean=dirty; obits=lbits; -static inline WDataOutP VL_NOT_W(int words, WDataOutP owp, WDataInP const lwp) VL_MT_SAFE { +inline WDataOutP VL_NOT_W(int words, WDataOutP owp, WDataInP const lwp) VL_MT_SAFE { for (int i = 0; i < words; ++i) owp[i] = ~(lwp[i]); return owp; } @@ -978,25 +972,24 @@ static inline WDataOutP VL_NOT_W(int words, WDataOutP owp, WDataInP const lwp) V #define VL_GTE_W(words, lwp, rwp) (_vl_cmp_w(words, lwp, rwp) >= 0) // Output clean, AND MUST BE CLEAN -static inline IData VL_EQ_W(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { +inline IData VL_EQ_W(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { EData nequal = 0; for (int i = 0; (i < words); ++i) nequal |= (lwp[i] ^ rwp[i]); return (nequal == 0); } template -static inline IData VL_EQ_W(int words, WDataInP const rwp, - const VlQueue>& q) VL_PURE { +inline IData VL_EQ_W(int words, WDataInP const rwp, const VlQueue>& q) VL_PURE { return VL_EQ_R(words, q, rwp); } template -static inline IData VL_EQ_W(int words, WDataInP const rwp, VlQueue q) VL_PURE { +inline IData VL_EQ_W(int words, WDataInP const rwp, VlQueue q) VL_PURE { return VL_EQ_R(words, q, rwp); } template -static inline IData VL_EQ_R(int words, VlQueue q, WDataInP const rwp) VL_PURE { +inline IData VL_EQ_R(int words, VlQueue q, WDataInP const rwp) VL_PURE { EData nequal = 0; const int wordsInQ = q.size() * sizeof(T) / sizeof(IData) - 1; if (wordsInQ + 1 != words) return false; @@ -1031,8 +1024,7 @@ static inline IData VL_EQ_R(int words, VlQueue q, WDataInP const rwp) VL_PURE } template -static inline IData VL_EQ_R(int words, const VlQueue>& q, - WDataInP const rwp) VL_PURE { +inline IData VL_EQ_R(int words, const VlQueue>& q, WDataInP const rwp) VL_PURE { EData nequal = 0; if ((q.size() * N_Words) != words) { return false; } int count = 0; @@ -1047,7 +1039,7 @@ static inline IData VL_EQ_R(int words, const VlQueue>& q, } // Internal usage -static inline int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { +inline int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE { for (int i = words - 1; i >= 0; --i) { if (lwp[i] > rwp[i]) return 1; if (lwp[i] < rwp[i]) return -1; @@ -1060,53 +1052,53 @@ static inline int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) V #define VL_GTS_IWW(lbits, lwp, rwp) (_vl_cmps_w(lbits, lwp, rwp) > 0) #define VL_GTES_IWW(lbits, lwp, rwp) (_vl_cmps_w(lbits, lwp, rwp) >= 0) -static inline IData VL_GTS_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_GTS_III(int lbits, IData lhs, IData rhs) VL_PURE { // For lbits==32, this becomes just a single instruction, otherwise ~5. // GCC 3.3.4 sign extension bugs on AMD64 architecture force us to use quad logic const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc return lhs_signed > rhs_signed; } -static inline IData VL_GTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline IData VL_GTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); return lhs_signed > rhs_signed; } -static inline IData VL_GTES_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_GTES_III(int lbits, IData lhs, IData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc return lhs_signed >= rhs_signed; } -static inline IData VL_GTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline IData VL_GTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); return lhs_signed >= rhs_signed; } -static inline IData VL_LTS_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_LTS_III(int lbits, IData lhs, IData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc return lhs_signed < rhs_signed; } -static inline IData VL_LTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline IData VL_LTS_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); return lhs_signed < rhs_signed; } -static inline IData VL_LTES_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_LTES_III(int lbits, IData lhs, IData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); // Q for gcc const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); // Q for gcc return lhs_signed <= rhs_signed; } -static inline IData VL_LTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline IData VL_LTES_IQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); return lhs_signed <= rhs_signed; } -static inline int _vl_cmps_w(int lbits, WDataInP const lwp, WDataInP const rwp) VL_PURE { +inline int _vl_cmps_w(int lbits, WDataInP const lwp, WDataInP const rwp) VL_PURE { const int words = VL_WORDS_I(lbits); int i = words - 1; // We need to flip sense if negative comparison @@ -1125,7 +1117,7 @@ static inline int _vl_cmps_w(int lbits, WDataInP const lwp, WDataInP const rwp) // Expressions // Output NOT clean -static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP const lwp) VL_MT_SAFE { +inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP const lwp) VL_MT_SAFE { EData carry = 1; for (int i = 0; i < words; ++i) { owp[i] = ~lwp[i] + carry; @@ -1133,7 +1125,7 @@ static inline WDataOutP VL_NEGATE_W(int words, WDataOutP owp, WDataInP const lwp } return owp; } -static inline void VL_NEGATE_INPLACE_W(int words, WDataOutP owp_lwp) VL_MT_SAFE { +inline void VL_NEGATE_INPLACE_W(int words, WDataOutP owp_lwp) VL_MT_SAFE { EData carry = 1; for (int i = 0; i < words; ++i) { const EData word = ~owp_lwp[i] + carry; @@ -1145,23 +1137,19 @@ static inline void VL_NEGATE_INPLACE_W(int words, WDataOutP owp_lwp) VL_MT_SAFE // EMIT_RULE: VL_MUL: oclean=dirty; lclean==clean; rclean==clean; // EMIT_RULE: VL_DIV: oclean=dirty; lclean==clean; rclean==clean; // EMIT_RULE: VL_MODDIV: oclean=dirty; lclean==clean; rclean==clean; -static inline IData VL_DIV_III(int /*lbits*/, IData lhs, IData rhs) { - return (rhs == 0) ? 0 : lhs / rhs; -} -static inline QData VL_DIV_QQQ(int /*lbits*/, QData lhs, QData rhs) { - return (rhs == 0) ? 0 : lhs / rhs; -} +inline IData VL_DIV_III(int /*lbits*/, IData lhs, IData rhs) { return (rhs == 0) ? 0 : lhs / rhs; } +inline QData VL_DIV_QQQ(int /*lbits*/, QData lhs, QData rhs) { return (rhs == 0) ? 0 : lhs / rhs; } #define VL_DIV_WWW(lbits, owp, lwp, rwp) (_vl_moddiv_w(lbits, owp, lwp, rwp, 0)) -static inline IData VL_MODDIV_III(int /*lbits*/, IData lhs, IData rhs) { +inline IData VL_MODDIV_III(int /*lbits*/, IData lhs, IData rhs) { return (rhs == 0) ? 0 : lhs % rhs; } -static inline QData VL_MODDIV_QQQ(int /*lbits*/, QData lhs, QData rhs) { +inline QData VL_MODDIV_QQQ(int /*lbits*/, QData lhs, QData rhs) { return (rhs == 0) ? 0 : lhs % rhs; } #define VL_MODDIV_WWW(lbits, owp, lwp, rwp) (_vl_moddiv_w(lbits, owp, lwp, rwp, 1)) -static inline WDataOutP VL_ADD_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_ADD_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { QData carry = 0; for (int i = 0; i < words; ++i) { carry = carry + static_cast(lwp[i]) + static_cast(rwp[i]); @@ -1172,8 +1160,8 @@ static inline WDataOutP VL_ADD_W(int words, WDataOutP owp, WDataInP const lwp, return owp; } -static inline WDataOutP VL_SUB_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_SUB_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { QData carry = 0; for (int i = 0; i < words; ++i) { carry = (carry + static_cast(lwp[i]) @@ -1186,8 +1174,8 @@ static inline WDataOutP VL_SUB_W(int words, WDataOutP owp, WDataInP const lwp, return owp; } -static inline WDataOutP VL_MUL_W(int words, WDataOutP owp, WDataInP const lwp, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_MUL_W(int words, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 0; i < words; ++i) owp[i] = 0; for (int lword = 0; lword < words; ++lword) { for (int rword = 0; rword < words; ++rword) { @@ -1203,19 +1191,18 @@ static inline WDataOutP VL_MUL_W(int words, WDataOutP owp, WDataInP const lwp, return owp; } -static inline IData VL_MULS_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_MULS_III(int lbits, IData lhs, IData rhs) VL_PURE { const int32_t lhs_signed = VL_EXTENDS_II(32, lbits, lhs); const int32_t rhs_signed = VL_EXTENDS_II(32, lbits, rhs); return lhs_signed * rhs_signed; } -static inline QData VL_MULS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline QData VL_MULS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t lhs_signed = VL_EXTENDS_QQ(64, lbits, lhs); const int64_t rhs_signed = VL_EXTENDS_QQ(64, lbits, rhs); return lhs_signed * rhs_signed; } -static inline WDataOutP VL_MULS_WWW(int lbits, WDataOutP owp, WDataInP lwp, - WDataInP rwp) VL_MT_SAFE { +inline WDataOutP VL_MULS_WWW(int lbits, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE { const int words = VL_WORDS_I(lbits); VL_DEBUG_IFDEF(assert(words <= VL_MULS_MAX_WORDS);); VlWide lwstore; @@ -1249,7 +1236,7 @@ static inline WDataOutP VL_MULS_WWW(int lbits, WDataOutP owp, WDataInP lwp, return owp; } -static inline IData VL_DIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_DIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 0; // -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0; @@ -1257,7 +1244,7 @@ static inline IData VL_DIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { const int32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs); return lhs_signed / rhs_signed; } -static inline QData VL_DIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline QData VL_DIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 0; // -MAX / -1 cannot be represented in twos complement, and will cause SIGFPE if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0; @@ -1265,14 +1252,14 @@ static inline QData VL_DIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { const int64_t rhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, rhs); return lhs_signed / rhs_signed; } -static inline IData VL_MODDIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_MODDIVS_III(int lbits, IData lhs, IData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(lhs == 0x80000000 && rhs == 0xffffffff)) return 0; const int32_t lhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, lhs); const int32_t rhs_signed = VL_EXTENDS_II(VL_IDATASIZE, lbits, rhs); return lhs_signed % rhs_signed; } -static inline QData VL_MODDIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { +inline QData VL_MODDIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 0; if (VL_UNLIKELY(lhs == 0x8000000000000000ULL && rhs == 0xffffffffffffffffULL)) return 0; const int64_t lhs_signed = VL_EXTENDS_QQ(VL_QUADSIZE, lbits, lhs); @@ -1280,8 +1267,7 @@ static inline QData VL_MODDIVS_QQQ(int lbits, QData lhs, QData rhs) VL_PURE { return lhs_signed % rhs_signed; } -static inline WDataOutP VL_DIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, - WDataInP rwp) VL_MT_SAFE { +inline WDataOutP VL_DIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE { const int lwords = VL_WORDS_I(lbits); const EData lsign = VL_SIGN_E(lbits, lwp[lwords - 1]); const EData rsign = VL_SIGN_E(lbits, rwp[lwords - 1]); @@ -1298,8 +1284,7 @@ static inline WDataOutP VL_DIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, } return VL_DIV_WWW(lbits, owp, lwp, rwp); } -static inline WDataOutP VL_MODDIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, - WDataInP rwp) VL_MT_SAFE { +inline WDataOutP VL_MODDIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, WDataInP rwp) VL_MT_SAFE { const int lwords = VL_WORDS_I(lbits); const EData lsign = VL_SIGN_E(lbits, lwp[lwords - 1]); const EData rsign = VL_SIGN_E(lbits, rwp[lwords - 1]); @@ -1323,7 +1308,7 @@ static inline WDataOutP VL_MODDIVS_WWW(int lbits, WDataOutP owp, WDataInP lwp, #define VL_POW_WWI(obits, lbits, rbits, owp, lwp, rhs) \ VL_POW_WWQ(obits, lbits, rbits, owp, lwp, rhs) -static inline IData VL_POW_III(int, int, int rbits, IData lhs, IData rhs) VL_PURE { +inline IData VL_POW_III(int, int, int rbits, IData lhs, IData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 1; if (VL_UNLIKELY(lhs == 0)) return 0; IData power = lhs; @@ -1334,7 +1319,7 @@ static inline IData VL_POW_III(int, int, int rbits, IData lhs, IData rhs) VL_PUR } return out; } -static inline QData VL_POW_QQQ(int, int, int rbits, QData lhs, QData rhs) VL_PURE { +inline QData VL_POW_QQQ(int, int, int rbits, QData lhs, QData rhs) VL_PURE { if (VL_UNLIKELY(rhs == 0)) return 1; if (VL_UNLIKELY(lhs == 0)) return 0; QData power = lhs; @@ -1362,8 +1347,8 @@ QData VL_POW_QQW(int obits, int, int rbits, QData lhs, WDataInP const rwp) VL_MT #define VL_POWSS_WWI(obits, lbits, rbits, owp, lwp, rhs, lsign, rsign) \ VL_POWSS_WWQ(obits, lbits, rbits, owp, lwp, rhs, lsign, rsign) -static inline IData VL_POWSS_III(int obits, int, int rbits, IData lhs, IData rhs, bool lsign, - bool rsign) VL_MT_SAFE { +inline IData VL_POWSS_III(int obits, int, int rbits, IData lhs, IData rhs, bool lsign, + bool rsign) VL_MT_SAFE { if (VL_UNLIKELY(rhs == 0)) return 1; if (rsign && VL_SIGN_I(rbits, rhs)) { if (lhs == 0) { @@ -1378,8 +1363,8 @@ static inline IData VL_POWSS_III(int obits, int, int rbits, IData lhs, IData rhs } return VL_POW_III(obits, rbits, rbits, lhs, rhs); } -static inline QData VL_POWSS_QQQ(int obits, int, int rbits, QData lhs, QData rhs, bool lsign, - bool rsign) VL_MT_SAFE { +inline QData VL_POWSS_QQQ(int obits, int, int rbits, QData lhs, QData rhs, bool lsign, + bool rsign) VL_MT_SAFE { if (VL_UNLIKELY(rhs == 0)) return 1; if (rsign && VL_SIGN_Q(rbits, rhs)) { if (lhs == 0) return 0; // "X" @@ -1405,28 +1390,27 @@ QData VL_POWSS_QQW(int obits, int, int rbits, QData lhs, WDataInP const rwp, boo // INTERNAL: Stuff LHS bit 0++ into OUTPUT at specified offset // ld may be "dirty", output is clean -static inline void _vl_insert_II(CData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { +inline void _vl_insert_II(CData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { const IData cleanmask = VL_MASK_I(rbits); const IData insmask = (VL_MASK_I(hbit - lbit + 1)) << lbit; lhsr = (lhsr & ~insmask) | ((ld << lbit) & (insmask & cleanmask)); } -static inline void _vl_insert_II(SData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { +inline void _vl_insert_II(SData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { const IData cleanmask = VL_MASK_I(rbits); const IData insmask = (VL_MASK_I(hbit - lbit + 1)) << lbit; lhsr = (lhsr & ~insmask) | ((ld << lbit) & (insmask & cleanmask)); } -static inline void _vl_insert_II(IData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { +inline void _vl_insert_II(IData& lhsr, IData ld, int hbit, int lbit, int rbits) VL_PURE { const IData cleanmask = VL_MASK_I(rbits); const IData insmask = (VL_MASK_I(hbit - lbit + 1)) << lbit; lhsr = (lhsr & ~insmask) | ((ld << lbit) & (insmask & cleanmask)); } -static inline void _vl_insert_QQ(QData& lhsr, QData ld, int hbit, int lbit, int rbits) VL_PURE { +inline void _vl_insert_QQ(QData& lhsr, QData ld, int hbit, int lbit, int rbits) VL_PURE { const QData cleanmask = VL_MASK_Q(rbits); const QData insmask = (VL_MASK_Q(hbit - lbit + 1)) << lbit; lhsr = (lhsr & ~insmask) | ((ld << lbit) & (insmask & cleanmask)); } -static inline void _vl_insert_WI(WDataOutP iowp, IData ld, int hbit, int lbit, - int rbits = 0) VL_MT_SAFE { +inline void _vl_insert_WI(WDataOutP iowp, IData ld, int hbit, int lbit, int rbits = 0) VL_MT_SAFE { // Insert value ld into iowp at bit slice [hbit:lbit]. iowp is rbits wide. const int hoffset = VL_BITBIT_E(hbit); const int loffset = VL_BITBIT_E(lbit); @@ -1462,8 +1446,8 @@ static inline void _vl_insert_WI(WDataOutP iowp, IData ld, int hbit, int lbit, } // Copy bits from lwp[hbit:lbit] to low bits of lhsr. rbits is real width of lshr -static inline void _vl_insert_IW(IData& lhsr, WDataInP const lwp, int hbit, int lbit, - int rbits = 0) VL_MT_SAFE { +inline void _vl_insert_IW(IData& lhsr, WDataInP const lwp, int hbit, int lbit, + int rbits = 0) VL_MT_SAFE { const int hoffset = VL_BITBIT_E(hbit); const int loffset = VL_BITBIT_E(lbit); const int hword = VL_BITWORD_E(hbit); @@ -1483,8 +1467,8 @@ static inline void _vl_insert_IW(IData& lhsr, WDataInP const lwp, int hbit, int // INTERNAL: Stuff large LHS bit 0++ into OUTPUT at specified offset // lwp may be "dirty" -static inline void _vl_insert_WW(WDataOutP iowp, WDataInP const lwp, int hbit, int lbit, - int rbits = 0) VL_MT_SAFE { +inline void _vl_insert_WW(WDataOutP iowp, WDataInP const lwp, int hbit, int lbit, + int rbits = 0) VL_MT_SAFE { const int hoffset = VL_BITBIT_E(hbit); const int loffset = VL_BITBIT_E(lbit); const int roffset = VL_BITBIT_E(rbits); @@ -1539,8 +1523,7 @@ static inline void _vl_insert_WW(WDataOutP iowp, WDataInP const lwp, int hbit, i } } -static inline void _vl_insert_WQ(WDataOutP iowp, QData ld, int hbit, int lbit, - int rbits = 0) VL_MT_SAFE { +inline void _vl_insert_WQ(WDataOutP iowp, QData ld, int hbit, int lbit, int rbits = 0) VL_MT_SAFE { VlWide lwp; VL_SET_WQ(lwp, ld); _vl_insert_WW(iowp, lwp, hbit, lbit, rbits); @@ -1551,7 +1534,7 @@ static inline void _vl_insert_WQ(WDataOutP iowp, QData ld, int hbit, int lbit, #define VL_REPLICATE_IOI(lbits, ld, rep) (-(ld)) // Iff lbits==1 #define VL_REPLICATE_QOI(lbits, ld, rep) (-(static_cast(ld))) // Iff lbits==1 -static inline IData VL_REPLICATE_III(int lbits, IData ld, IData rep) VL_PURE { +inline IData VL_REPLICATE_III(int lbits, IData ld, IData rep) VL_PURE { IData returndata = ld; for (unsigned i = 1; i < rep; ++i) { returndata = returndata << lbits; @@ -1559,7 +1542,7 @@ static inline IData VL_REPLICATE_III(int lbits, IData ld, IData rep) VL_PURE { } return returndata; } -static inline QData VL_REPLICATE_QII(int lbits, IData ld, IData rep) VL_PURE { +inline QData VL_REPLICATE_QII(int lbits, IData ld, IData rep) VL_PURE { QData returndata = ld; for (unsigned i = 1; i < rep; ++i) { returndata = returndata << lbits; @@ -1567,8 +1550,7 @@ static inline QData VL_REPLICATE_QII(int lbits, IData ld, IData rep) VL_PURE { } return returndata; } -static inline WDataOutP VL_REPLICATE_WII(int lbits, WDataOutP owp, IData ld, - IData rep) VL_MT_SAFE { +inline WDataOutP VL_REPLICATE_WII(int lbits, WDataOutP owp, IData ld, IData rep) VL_MT_SAFE { owp[0] = ld; // Zeroing all words isn't strictly needed but allows compiler to know // it does not need to preserve data in word(s) not being written @@ -1578,8 +1560,7 @@ static inline WDataOutP VL_REPLICATE_WII(int lbits, WDataOutP owp, IData ld, } return owp; } -static inline WDataOutP VL_REPLICATE_WQI(int lbits, WDataOutP owp, QData ld, - IData rep) VL_MT_SAFE { +inline WDataOutP VL_REPLICATE_WQI(int lbits, WDataOutP owp, QData ld, IData rep) VL_MT_SAFE { VL_SET_WQ(owp, ld); // Zeroing all words isn't strictly needed but allows compiler to know // it does not need to preserve data in word(s) not being written @@ -1589,8 +1570,8 @@ static inline WDataOutP VL_REPLICATE_WQI(int lbits, WDataOutP owp, QData ld, } return owp; } -static inline WDataOutP VL_REPLICATE_WWI(int lbits, WDataOutP owp, WDataInP const lwp, - IData rep) VL_MT_SAFE { +inline WDataOutP VL_REPLICATE_WWI(int lbits, WDataOutP owp, WDataInP const lwp, + IData rep) VL_MT_SAFE { for (unsigned i = 0; i < VL_WORDS_I(static_cast(lbits)); ++i) owp[i] = lwp[i]; // Zeroing all words isn't strictly needed but allows compiler to know // it does not need to preserve data in word(s) not being written @@ -1607,7 +1588,7 @@ static inline WDataOutP VL_REPLICATE_WWI(int lbits, WDataOutP owp, WDataInP cons // Special "fast" versions for slice sizes that are a power of 2. These use // shifts and masks to execute faster than the slower for-loop approach where a // subset of bits is copied in during each iteration. -static inline IData VL_STREAML_FAST_III(int lbits, IData ld, IData rd_log2) VL_PURE { +inline IData VL_STREAML_FAST_III(int lbits, IData ld, IData rd_log2) VL_PURE { // Pre-shift bits in most-significant slice: // // If lbits is not a multiple of the slice size (i.e., lbits % rd != 0), @@ -1645,7 +1626,7 @@ static inline IData VL_STREAML_FAST_III(int lbits, IData ld, IData rd_log2) VL_P return ret >> (VL_IDATASIZE - lbits); } -static inline QData VL_STREAML_FAST_QQI(int lbits, QData ld, IData rd_log2) VL_PURE { +inline QData VL_STREAML_FAST_QQI(int lbits, QData ld, IData rd_log2) VL_PURE { // Pre-shift bits in most-significant slice (see comment in VL_STREAML_FAST_III) QData ret = ld; if (rd_log2) { @@ -1677,7 +1658,7 @@ static inline QData VL_STREAML_FAST_QQI(int lbits, QData ld, IData rd_log2) VL_P } template -static inline void VL_STREAML_FAST_RQI(int lbits, VlQueue& q, QData ld, IData rd_log2) VL_PURE { +inline void VL_STREAML_FAST_RQI(int lbits, VlQueue& q, QData ld, IData rd_log2) VL_PURE { const QData ret = VL_STREAML_FAST_QQI(lbits, ld, rd_log2); q.clear(); const int numQData = 8 / sizeof(T); @@ -1693,8 +1674,8 @@ static inline void VL_STREAML_FAST_RQI(int lbits, VlQueue& q, QData ld, IData } template -static inline void VL_STREAML_FAST_RQI(int lbits, VlQueue>& q, QData ld, - IData rd_log2) VL_PURE { +inline void VL_STREAML_FAST_RQI(int lbits, VlQueue>& q, QData ld, + IData rd_log2) VL_PURE { const QData ret = VL_STREAML_FAST_QQI(lbits, ld, rd_log2); q.clear(); VlWide value; @@ -1705,7 +1686,7 @@ static inline void VL_STREAML_FAST_RQI(int lbits, VlQueue>& q, Q } template -static inline void VL_STREAMR_RII(int lbits, VlQueue& q, IData ld, IData rd_log2) VL_PURE { +inline void VL_STREAMR_RII(int lbits, VlQueue& q, IData ld, IData rd_log2) VL_PURE { q.clear(); VL_CONSTEXPR_CXX17 int valueSize = sizeof(T); if VL_CONSTEXPR_CXX17 (valueSize < 4) { @@ -1722,8 +1703,8 @@ static inline void VL_STREAMR_RII(int lbits, VlQueue& q, IData ld, IData rd_l } template -static inline void VL_STREAMR_RII(int lbits, VlQueue>& q, IData ld, - IData rd_log2) VL_PURE { +inline void VL_STREAMR_RII(int lbits, VlQueue>& q, IData ld, + IData rd_log2) VL_PURE { q.clear(); VlWide value; VL_SET_WI(value, ld); @@ -1731,7 +1712,7 @@ static inline void VL_STREAMR_RII(int lbits, VlQueue>& q, IData } template -static inline void VL_STREAMR_RQI(int lbits, VlQueue& q, QData ld, IData rd_log2) VL_PURE { +inline void VL_STREAMR_RQI(int lbits, VlQueue& q, QData ld, IData rd_log2) VL_PURE { q.clear(); // Empty the queue first // If this is a queue of bytes (unsigned char) if VL_CONSTEXPR_CXX17 (sizeof(T) == 1) { @@ -1753,7 +1734,7 @@ static inline void VL_STREAMR_RQI(int lbits, VlQueue& q, QData ld, IData rd_l } template -static inline IData VL_STREAMR_IRI(int lbits, VlQueue& q, IData rd_log2) VL_PURE { +inline IData VL_STREAMR_IRI(int lbits, VlQueue& q, IData rd_log2) VL_PURE { IData value = 0; // Starts at 0. Out-of-range bits will remain 0. const size_t len = q.size(); @@ -1776,7 +1757,7 @@ static inline IData VL_STREAMR_IRI(int lbits, VlQueue& q, IData rd_log2) VL_P } template -static inline IData VL_STREAMR_QRI(int lbits, VlQueue& q, IData rd_log2) VL_PURE { +inline IData VL_STREAMR_QRI(int lbits, VlQueue& q, IData rd_log2) VL_PURE { QData value = 0; const size_t len = q.size(); @@ -1799,8 +1780,8 @@ static inline IData VL_STREAMR_QRI(int lbits, VlQueue& q, IData rd_log2) VL_P } template -static inline void VL_STREAMR_RQI(int lbits, VlQueue>& q, QData ld, - IData rd_log2) VL_PURE { +inline void VL_STREAMR_RQI(int lbits, VlQueue>& q, QData ld, + IData rd_log2) VL_PURE { q.clear(); // Empty the queue first VlWide value; VL_SET_WQ(value, ld); @@ -1808,8 +1789,7 @@ static inline void VL_STREAMR_RQI(int lbits, VlQueue>& q, QData } template -static inline void VL_STREAMR_RWI(int lbits, VlQueue& q, WDataInP const lwp, - IData rd_log2) VL_PURE { +inline void VL_STREAMR_RWI(int lbits, VlQueue& q, WDataInP const lwp, IData rd_log2) VL_PURE { q.clear(); // Empty the queue first const int numWords = VL_BITWORD_E(lbits); QData qdataValue = 0; @@ -1837,8 +1817,8 @@ static inline void VL_STREAMR_RWI(int lbits, VlQueue& q, WDataInP const lwp, } template -static inline void VL_STREAMR_RWI(int lbits, VlQueue>& q, WDataInP const lwp, - IData rd_log2) VL_PURE { +inline void VL_STREAMR_RWI(int lbits, VlQueue>& q, WDataInP const lwp, + IData rd_log2) VL_PURE { q.clear(); // Empty the queue first const int numWords = VL_BITWORD_E(lbits); VlWide value; @@ -1850,18 +1830,18 @@ static inline void VL_STREAMR_RWI(int lbits, VlQueue>& q, WDataI } template -static inline VlQueue VL_STREAMR_RRI(int lbits, const VlQueue q, IData rd) VL_MT_SAFE { +inline VlQueue VL_STREAMR_RRI(int lbits, const VlQueue q, IData rd) VL_MT_SAFE { return q; } -static inline VlQueue VL_STREAMR_NRI(int lbits, const VlQueue q, - IData rd) VL_MT_SAFE { +inline VlQueue VL_STREAMR_NRI(int lbits, const VlQueue q, + IData rd) VL_MT_SAFE { return q; } template -static inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, - const VlQueue& from_q, IData rd) VL_MT_SAFE { +inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, const VlQueue& from_q, + IData rd) VL_MT_SAFE { to_q.clear(); VL_CONSTEXPR_CXX17 size_t otherSize = sizeof(T_Other); VL_CONSTEXPR_CXX17 size_t sizeOfThis = sizeof(T_Value); @@ -1892,8 +1872,8 @@ static inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, } template -static inline void VL_STREAMR_RRI(int lbits, VlQueue>& to_q, - const VlQueue& from_q, IData rd) VL_MT_SAFE { +inline void VL_STREAMR_RRI(int lbits, VlQueue>& to_q, + const VlQueue& from_q, IData rd) VL_MT_SAFE { to_q.clear(); VL_CONSTEXPR_CXX17 size_t otherSize = sizeof(T_Other); @@ -1940,8 +1920,8 @@ static inline void VL_STREAMR_RRI(int lbits, VlQueue>& to_q, } template -static inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, - const VlQueue>& from_q, IData rd) VL_MT_SAFE { +inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, + const VlQueue>& from_q, IData rd) VL_MT_SAFE { to_q.clear(); VL_CONSTEXPR_CXX17 size_t sizeOfThis = sizeof(T_Value); @@ -1970,7 +1950,7 @@ static inline void VL_STREAMR_RRI(int lbits, VlQueue& to_q, } // Regular "slow" streaming operators -static inline IData VL_STREAML_III(int lbits, IData ld, IData rd) VL_PURE { +inline IData VL_STREAML_III(int lbits, IData ld, IData rd) VL_PURE { IData ret = 0; // Slice size should never exceed the lhs width const IData mask = VL_MASK_I(rd); @@ -1983,7 +1963,7 @@ static inline IData VL_STREAML_III(int lbits, IData ld, IData rd) VL_PURE { } template -static inline VlQueue VL_STREAML_RRI(int lbitsIn, const VlQueue q, IData rd) VL_MT_SAFE { +inline VlQueue VL_STREAML_RRI(int lbitsIn, const VlQueue q, IData rd) VL_MT_SAFE { // TODO this function needs to have a temp variable made in verilator and passed in. // dynamicly make our "temp variable" // lbitsIn is always 0 @@ -2010,8 +1990,8 @@ static inline VlQueue VL_STREAML_RRI(int lbitsIn, const VlQueue q, IData r } template -static inline VlQueue> -VL_STREAML_RRI(int lbitsIn, const VlQueue> q, IData rd) VL_MT_SAFE { +inline VlQueue> VL_STREAML_RRI(int lbitsIn, const VlQueue> q, + IData rd) VL_MT_SAFE { // TODO this function needs to have a temp variable. // dynamicly make our "temp variable" // lbitsIn is always zero @@ -2043,8 +2023,8 @@ VL_STREAML_RRI(int lbitsIn, const VlQueue> q, IData rd) VL_MT_SA } template -static inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue& q, IData ld, - IData rd) VL_MT_SAFE { +inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue& q, IData ld, + IData rd) VL_MT_SAFE { IData ret = 0; if (lbits < queueBits) { lbits = queueBits; } @@ -2071,8 +2051,8 @@ static inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue& q, IData } template -static inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue>& q, IData ld, - IData rd) VL_MT_SAFE { +inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue>& q, IData ld, + IData rd) VL_MT_SAFE { if (lbits < queueBits) { lbits = queueBits; } IData ret = 0; // Slice size should never exceed the lhs width @@ -2088,7 +2068,7 @@ static inline void VL_STREAML_RII(int lbits, int queueBits, VlQueue(lbits)) ? rd : (static_cast(lbits)); @@ -2120,8 +2100,8 @@ static inline WDataOutP VL_STREAML_WWI(int lbits, WDataOutP owp, WDataInP const } template -static inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue& q, WDataInP const lwp, - IData rd) VL_MT_SAFE { +inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue& q, WDataInP const lwp, + IData rd) VL_MT_SAFE { const bool needsMask = sizeof(T) < 4; VL_CONSTEXPR_CXX17 int numBitsInT = 8 * sizeof(T); VL_CONSTEXPR_CXX17 int mask = VL_MASK_I(numBitsInT * needsMask); @@ -2150,8 +2130,8 @@ static inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue& q, WData } template -static inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue>& q, - WDataInP const lwp, IData rd) VL_MT_SAFE { +inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue>& q, + WDataInP const lwp, IData rd) VL_MT_SAFE { VL_CONSTEXPR_CXX17 int numBitsInT = 4 * N_Words * 8; if (lbits < queueBits) { // this handles the case where the queue is larger than the rhs lbits = queueBits; @@ -2172,21 +2152,21 @@ static inline void VL_STREAML_RWI(int lbits, int queueBits, VlQueue& q) { +inline IData VL_PACK_I_RI(int /*obits*/, int lbits, const VlQueue& q) { IData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= static_cast(q.at(q.size() - 1 - i)) << (i * lbits); return ret; } -static inline IData VL_PACK_I_RI(int /*obits*/, int lbits, const VlQueue& q) { +inline IData VL_PACK_I_RI(int /*obits*/, int lbits, const VlQueue& q) { IData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= static_cast(q.at(q.size() - 1 - i)) << (i * lbits); return ret; } -static inline IData VL_PACK_I_RI(int /*obits*/, int lbits, const VlQueue& q) { +inline IData VL_PACK_I_RI(int /*obits*/, int lbits, const VlQueue& q) { IData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i) << (i * lbits); return ret; @@ -2203,7 +2183,7 @@ struct VlUnpackedElements> final { }; template -static inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { IData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= static_cast(q[N_Depth - 1 - i]) << (i * lbits); @@ -2211,7 +2191,7 @@ static inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked -static inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { IData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= static_cast(q[N_Depth - 1 - i]) << (i * lbits); @@ -2219,15 +2199,15 @@ static inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked -static inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline IData VL_PACK_I_UI(int /*obits*/, int lbits, const VlUnpacked& q) { IData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= q[N_Depth - 1 - i] << (i * lbits); return ret; } template -static inline IData VL_PACK_I_UI(const int obits, const int lbits, - const VlUnpacked, N_Depth>& q) { +inline IData VL_PACK_I_UI(const int obits, const int lbits, + const VlUnpacked, N_Depth>& q) { IData ret = 0; const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { @@ -2237,21 +2217,21 @@ static inline IData VL_PACK_I_UI(const int obits, const int lbits, return ret; } -static inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { +inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { QData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= static_cast(q.at(q.size() - 1 - i)) << (i * lbits); return ret; } -static inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { +inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { QData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= static_cast(q.at(q.size() - 1 - i)) << (i * lbits); return ret; } -static inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { +inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& q) { QData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= static_cast(q.at(q.size() - 1 - i)) << (i * lbits); @@ -2259,7 +2239,7 @@ static inline QData VL_PACK_Q_RI(int /*obits*/, int lbits, const VlQueue& } template -static inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { QData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= static_cast(q[N_Depth - 1 - i]) << (i * lbits); @@ -2267,7 +2247,7 @@ static inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked -static inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { QData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= static_cast(q[N_Depth - 1 - i]) << (i * lbits); @@ -2275,41 +2255,40 @@ static inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked -static inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { +inline QData VL_PACK_Q_UI(int /*obits*/, int lbits, const VlUnpacked& q) { QData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= static_cast(q[N_Depth - 1 - i]) << (i * lbits); return ret; } -static inline QData VL_PACK_Q_RQ(int /*obits*/, int lbits, const VlQueue& q) { +inline QData VL_PACK_Q_RQ(int /*obits*/, int lbits, const VlQueue& q) { QData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i) << (i * lbits); return ret; } -static inline IData VL_PACK_I_RQ(int /*obits*/, int lbits, const VlQueue& q) { +inline IData VL_PACK_I_RQ(int /*obits*/, int lbits, const VlQueue& q) { IData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i) << (i * lbits); return ret; } template -static inline IData VL_PACK_I_RW(int /*obits*/, int lbits, const VlQueue>& q) { +inline IData VL_PACK_I_RW(int /*obits*/, int lbits, const VlQueue>& q) { IData ret = 0; for (size_t i = 0; i < q.size(); ++i) ret |= q.at(q.size() - 1 - i)[0] << (i * lbits); return ret; } template -static inline QData VL_PACK_Q_UQ(int /*obits*/, int lbits, const VlUnpacked& q) { +inline QData VL_PACK_Q_UQ(int /*obits*/, int lbits, const VlUnpacked& q) { QData ret = 0; for (size_t i = 0; i < N_Depth; ++i) ret |= q[N_Depth - 1 - i] << (i * lbits); return ret; } -static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, - const VlQueue& q) { +inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2319,8 +2298,7 @@ static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, return owp; } -static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, - const VlQueue& q) { +inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2330,8 +2308,7 @@ static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, return owp; } -static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, - const VlQueue& q) { +inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, const VlQueue& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2342,8 +2319,8 @@ static inline WDataOutP VL_PACK_W_RI(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, - const VlUnpacked& q) { +inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, + const VlUnpacked& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); for (size_t i = 0; i < N_Depth; ++i) _vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits); @@ -2351,8 +2328,8 @@ static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, - const VlUnpacked& q) { +inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, + const VlUnpacked& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); for (size_t i = 0; i < N_Depth; ++i) _vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits); @@ -2360,16 +2337,15 @@ static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, - const VlUnpacked& q) { +inline WDataOutP VL_PACK_W_UI(int obits, int lbits, WDataOutP owp, + const VlUnpacked& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); for (size_t i = 0; i < N_Depth; ++i) _vl_insert_WI(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits); return owp; } -static inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp, - const VlQueue& q) { +inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp, const VlQueue& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2380,8 +2356,8 @@ static inline WDataOutP VL_PACK_W_RQ(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp, - const VlUnpacked& q) { +inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp, + const VlUnpacked& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); for (size_t i = 0; i < N_Depth; ++i) _vl_insert_WQ(owp, q[N_Depth - 1 - i], i * lbits + lbits - 1, i * lbits); @@ -2389,8 +2365,8 @@ static inline WDataOutP VL_PACK_W_UQ(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp, - const VlQueue>& q) { +inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp, + const VlQueue>& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2401,8 +2377,8 @@ static inline WDataOutP VL_PACK_W_RW(int obits, int lbits, WDataOutP owp, } template -static inline WDataOutP VL_PACK_W_UW(int obits, int lbits, WDataOutP owp, - const VlUnpacked, N_Depth>& q) { +inline WDataOutP VL_PACK_W_UW(int obits, int lbits, WDataOutP owp, + const VlUnpacked, N_Depth>& q) { VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); if (VL_UNLIKELY(obits < q.size() * lbits)) return owp; // Though is illegal for q to be larger const int offset = obits - q.size() * lbits; @@ -2426,67 +2402,67 @@ static inline WDataOutP VL_PACK_W_UW(int obits, int lbits, WDataOutP owp, #define VL_CONCAT_QQQ(obits, lbits, rbits, ld, rd) \ (static_cast(ld) << (rbits) | static_cast(rd)) -static inline WDataOutP VL_CONCAT_WII(int obits, int lbits, int rbits, WDataOutP owp, IData ld, - IData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WII(int obits, int lbits, int rbits, WDataOutP owp, IData ld, + IData rd) VL_MT_SAFE { owp[0] = rd; VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); _vl_insert_WI(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WWI(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, IData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WWI(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + IData rd) VL_MT_SAFE { owp[0] = rd; VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); _vl_insert_WW(owp, lwp, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WIW(int obits, int lbits, int rbits, WDataOutP owp, IData ld, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WIW(int obits, int lbits, int rbits, WDataOutP owp, IData ld, + WDataInP const rwp) VL_MT_SAFE { const int rwords = VL_WORDS_I(rbits); VL_MEMCPY_W(owp, rwp, rwords); VL_MEMSET_ZERO_W(owp + rwords, VL_WORDS_I(obits) - rwords); _vl_insert_WI(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WIQ(int obits, int lbits, int rbits, WDataOutP owp, IData ld, - QData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WIQ(int obits, int lbits, int rbits, WDataOutP owp, IData ld, + QData rd) VL_MT_SAFE { VL_SET_WQ(owp, rd); VL_MEMSET_ZERO_W(owp + VL_WQ_WORDS_E, VL_WORDS_I(obits) - VL_WQ_WORDS_E); _vl_insert_WI(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WQI(int obits, int lbits, int rbits, WDataOutP owp, QData ld, - IData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WQI(int obits, int lbits, int rbits, WDataOutP owp, QData ld, + IData rd) VL_MT_SAFE { owp[0] = rd; VL_MEMSET_ZERO_W(owp + 1, VL_WORDS_I(obits) - 1); _vl_insert_WQ(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WQQ(int obits, int lbits, int rbits, WDataOutP owp, QData ld, - QData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WQQ(int obits, int lbits, int rbits, WDataOutP owp, QData ld, + QData rd) VL_MT_SAFE { VL_SET_WQ(owp, rd); VL_MEMSET_ZERO_W(owp + VL_WQ_WORDS_E, VL_WORDS_I(obits) - VL_WQ_WORDS_E); _vl_insert_WQ(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WWQ(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, QData rd) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WWQ(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + QData rd) VL_MT_SAFE { VL_SET_WQ(owp, rd); VL_MEMSET_ZERO_W(owp + VL_WQ_WORDS_E, VL_WORDS_I(obits) - VL_WQ_WORDS_E); _vl_insert_WW(owp, lwp, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WQW(int obits, int lbits, int rbits, WDataOutP owp, QData ld, - WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WQW(int obits, int lbits, int rbits, WDataOutP owp, QData ld, + WDataInP const rwp) VL_MT_SAFE { const int rwords = VL_WORDS_I(rbits); VL_MEMCPY_W(owp, rwp, rwords); VL_MEMSET_ZERO_W(owp + rwords, VL_WORDS_I(obits) - rwords); _vl_insert_WQ(owp, ld, rbits + lbits - 1, rbits); return owp; } -static inline WDataOutP VL_CONCAT_WWW(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_CONCAT_WWW(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { const int rwords = VL_WORDS_I(rbits); VL_MEMCPY_W(owp, rwp, rwords); VL_MEMSET_ZERO_W(owp + rwords, VL_WORDS_I(obits) - rwords); @@ -2499,8 +2475,7 @@ static inline WDataOutP VL_CONCAT_WWW(int obits, int lbits, int rbits, WDataOutP // Static shift, used by internal functions // The output is the same as the input - it overlaps! -static inline void _vl_shiftl_inplace_w(int obits, WDataOutP iowp, - IData rd /*1 or 4*/) VL_MT_SAFE { +inline void _vl_shiftl_inplace_w(int obits, WDataOutP iowp, IData rd /*1 or 4*/) VL_MT_SAFE { const int words = VL_WORDS_I(obits); const EData linsmask = VL_MASK_E(rd); for (int i = words - 1; i >= 1; --i) { @@ -2516,24 +2491,24 @@ static inline void _vl_shiftl_inplace_w(int obits, WDataOutP iowp, // expression. Thus consider this when optimizing. (And perhaps have 2 funcs?) // If RHS (rd/rwp) is larger than the output, zeros (or all ones for >>>) must be returned // (This corresponds to AstShift*Ovr Ast nodes) -static inline IData VL_SHIFTL_III(int /*obits*/, int, int, IData lhs, IData rhs) VL_MT_SAFE { +inline IData VL_SHIFTL_III(int /*obits*/, int, int, IData lhs, IData rhs) VL_MT_SAFE { if (VL_UNLIKELY(rhs >= VL_IDATASIZE)) return 0; return lhs << rhs; // Small is common so not clean return } -static inline IData VL_SHIFTL_IIQ(int obits, int, int, IData lhs, QData rhs) VL_MT_SAFE { +inline IData VL_SHIFTL_IIQ(int obits, int, int, IData lhs, QData rhs) VL_MT_SAFE { if (VL_UNLIKELY(rhs >= VL_IDATASIZE)) return 0; return VL_CLEAN_II(obits, obits, lhs << rhs); } -static inline QData VL_SHIFTL_QQI(int /*obits*/, int, int, QData lhs, IData rhs) VL_MT_SAFE { +inline QData VL_SHIFTL_QQI(int /*obits*/, int, int, QData lhs, IData rhs) VL_MT_SAFE { if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return 0; return lhs << rhs; // Small is common so not clean return } -static inline QData VL_SHIFTL_QQQ(int obits, int, int, QData lhs, QData rhs) VL_MT_SAFE { +inline QData VL_SHIFTL_QQQ(int obits, int, int, QData lhs, QData rhs) VL_MT_SAFE { if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return 0; return VL_CLEAN_QQ(obits, obits, lhs << rhs); } -static inline WDataOutP VL_SHIFTL_WWI(int obits, int, int, WDataOutP owp, WDataInP const lwp, - IData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTL_WWI(int obits, int, int, WDataOutP owp, WDataInP const lwp, + IData rd) VL_MT_SAFE { const int word_shift = VL_BITWORD_E(rd); const int bit_shift = VL_BITBIT_E(rd); if (rd >= static_cast(obits)) { // rd may be huge with MSB set @@ -2547,8 +2522,8 @@ static inline WDataOutP VL_SHIFTL_WWI(int obits, int, int, WDataOutP owp, WDataI } return owp; } -static inline WDataOutP VL_SHIFTL_WWW(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_SHIFTL_WWW(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more return VL_ZERO_W(obits, owp); @@ -2556,14 +2531,13 @@ static inline WDataOutP VL_SHIFTL_WWW(int obits, int lbits, int rbits, WDataOutP } return VL_SHIFTL_WWI(obits, lbits, 32, owp, lwp, rwp[0]); } -static inline WDataOutP VL_SHIFTL_WWQ(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, QData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTL_WWQ(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + QData rd) VL_MT_SAFE { VlWide rwp; VL_SET_WQ(rwp, rd); return VL_SHIFTL_WWW(obits, lbits, rbits, owp, lwp, rwp); } -static inline IData VL_SHIFTL_IIW(int obits, int, int rbits, IData lhs, - WDataInP const rwp) VL_MT_SAFE { +inline IData VL_SHIFTL_IIW(int obits, int, int rbits, IData lhs, WDataInP const rwp) VL_MT_SAFE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more return 0; @@ -2571,8 +2545,7 @@ static inline IData VL_SHIFTL_IIW(int obits, int, int rbits, IData lhs, } return VL_SHIFTL_III(obits, obits, 32, lhs, rwp[0]); } -static inline QData VL_SHIFTL_QQW(int obits, int, int rbits, QData lhs, - WDataInP const rwp) VL_MT_SAFE { +inline QData VL_SHIFTL_QQW(int obits, int, int rbits, QData lhs, WDataInP const rwp) VL_MT_SAFE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more return 0; @@ -2585,24 +2558,24 @@ static inline QData VL_SHIFTL_QQW(int obits, int, int rbits, QData lhs, // EMIT_RULE: VL_SHIFTR: oclean=lclean; rclean==clean; // Important: Unlike most other funcs, the shift might well be a computed // expression. Thus consider this when optimizing. (And perhaps have 2 funcs?) -static inline IData VL_SHIFTR_III(int /*obits*/, int, int, IData lhs, IData rhs) VL_PURE { +inline IData VL_SHIFTR_III(int /*obits*/, int, int, IData lhs, IData rhs) VL_PURE { if (VL_UNLIKELY(rhs >= VL_IDATASIZE)) return 0; return lhs >> rhs; } -static inline IData VL_SHIFTR_IIQ(int /*obits*/, int, int, IData lhs, QData rhs) VL_PURE { +inline IData VL_SHIFTR_IIQ(int /*obits*/, int, int, IData lhs, QData rhs) VL_PURE { if (VL_UNLIKELY(rhs >= VL_IDATASIZE)) return 0; return lhs >> rhs; } -static inline QData VL_SHIFTR_QQI(int /*obits*/, int, int, QData lhs, IData rhs) VL_PURE { +inline QData VL_SHIFTR_QQI(int /*obits*/, int, int, QData lhs, IData rhs) VL_PURE { if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return 0; return lhs >> rhs; } -static inline QData VL_SHIFTR_QQQ(int /*obits*/, int, int, QData lhs, QData rhs) VL_PURE { +inline QData VL_SHIFTR_QQQ(int /*obits*/, int, int, QData lhs, QData rhs) VL_PURE { if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return 0; return lhs >> rhs; } -static inline WDataOutP VL_SHIFTR_WWI(int obits, int, int, WDataOutP owp, WDataInP const lwp, - IData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTR_WWI(int obits, int, int, WDataOutP owp, WDataInP const lwp, + IData rd) VL_MT_SAFE { const int word_shift = VL_BITWORD_E(rd); // Maybe 0 const int bit_shift = VL_BITBIT_E(rd); if (rd >= static_cast(obits)) { // rd may be huge with MSB set @@ -2625,8 +2598,8 @@ static inline WDataOutP VL_SHIFTR_WWI(int obits, int, int, WDataOutP owp, WDataI } return owp; } -static inline WDataOutP VL_SHIFTR_WWW(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_SHIFTR_WWW(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) { // Huge shift 1>>32 or more return VL_ZERO_W(obits, owp); @@ -2634,22 +2607,20 @@ static inline WDataOutP VL_SHIFTR_WWW(int obits, int lbits, int rbits, WDataOutP } return VL_SHIFTR_WWI(obits, lbits, 32, owp, lwp, rwp[0]); } -static inline WDataOutP VL_SHIFTR_WWQ(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, QData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTR_WWQ(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + QData rd) VL_MT_SAFE { VlWide rwp; VL_SET_WQ(rwp, rd); return VL_SHIFTR_WWW(obits, lbits, rbits, owp, lwp, rwp); } -static inline IData VL_SHIFTR_IIW(int obits, int, int rbits, IData lhs, - WDataInP const rwp) VL_PURE { +inline IData VL_SHIFTR_IIW(int obits, int, int rbits, IData lhs, WDataInP const rwp) VL_PURE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) return 0; // Huge shift 1>>32 or more } return VL_SHIFTR_III(obits, obits, 32, lhs, rwp[0]); } -static inline QData VL_SHIFTR_QQW(int obits, int, int rbits, QData lhs, - WDataInP const rwp) VL_PURE { +inline QData VL_SHIFTR_QQW(int obits, int, int rbits, QData lhs, WDataInP const rwp) VL_PURE { for (int i = 1; i < VL_WORDS_I(rbits); ++i) { if (VL_UNLIKELY(rwp[i])) return 0; // Huge shift 1>>32 or more } @@ -2657,7 +2628,7 @@ static inline QData VL_SHIFTR_QQW(int obits, int, int rbits, QData lhs, } // EMIT_RULE: VL_SHIFTRS: oclean=false; lclean=clean, rclean==clean; -static inline IData VL_SHIFTRS_III(int obits, int lbits, int, IData lhs, IData rhs) VL_PURE { +inline IData VL_SHIFTRS_III(int obits, int lbits, int, IData lhs, IData rhs) VL_PURE { // Note the C standard does not specify the >> operator as a arithmetic shift! // IEEE says signed if output signed, but bit position from lbits; // must use lbits for sign; lbits might != obits, @@ -2667,17 +2638,17 @@ static inline IData VL_SHIFTRS_III(int obits, int lbits, int, IData lhs, IData r const IData signext = ~(VL_MASK_I(lbits) >> rhs); // One with bits where we've shifted "past" return (lhs >> rhs) | (sign & VL_CLEAN_II(obits, obits, signext)); } -static inline QData VL_SHIFTRS_QQI(int obits, int lbits, int, QData lhs, IData rhs) VL_PURE { +inline QData VL_SHIFTRS_QQI(int obits, int lbits, int, QData lhs, IData rhs) VL_PURE { const QData sign = -(lhs >> (lbits - 1)); if (VL_UNLIKELY(rhs >= VL_QUADSIZE)) return sign & VL_MASK_Q(obits); const QData signext = ~(VL_MASK_Q(lbits) >> rhs); return (lhs >> rhs) | (sign & VL_CLEAN_QQ(obits, obits, signext)); } -static inline IData VL_SHIFTRS_IQI(int obits, int lbits, int rbits, QData lhs, IData rhs) VL_PURE { +inline IData VL_SHIFTRS_IQI(int obits, int lbits, int rbits, QData lhs, IData rhs) VL_PURE { return static_cast(VL_SHIFTRS_QQI(obits, lbits, rbits, lhs, rhs)); } -static inline WDataOutP VL_SHIFTRS_WWI(int obits, int lbits, int, WDataOutP owp, - WDataInP const lwp, IData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTRS_WWI(int obits, int lbits, int, WDataOutP owp, WDataInP const lwp, + IData rd) VL_MT_SAFE { const int word_shift = VL_BITWORD_E(rd); const int bit_shift = VL_BITBIT_E(rd); const int lmsw = VL_WORDS_I(obits) - 1; @@ -2708,8 +2679,8 @@ static inline WDataOutP VL_SHIFTRS_WWI(int obits, int lbits, int, WDataOutP owp, } return owp; } -static inline WDataOutP VL_SHIFTRS_WWW(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, WDataInP const rwp) VL_MT_SAFE { +inline WDataOutP VL_SHIFTRS_WWW(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + WDataInP const rwp) VL_MT_SAFE { EData overshift = 0; // Huge shift 1>>32 or more for (int i = 1; i < VL_WORDS_I(rbits); ++i) overshift |= rwp[i]; if (VL_UNLIKELY(overshift || rwp[0] >= static_cast(obits))) { @@ -2724,14 +2695,14 @@ static inline WDataOutP VL_SHIFTRS_WWW(int obits, int lbits, int rbits, WDataOut } return VL_SHIFTRS_WWI(obits, lbits, 32, owp, lwp, rwp[0]); } -static inline WDataOutP VL_SHIFTRS_WWQ(int obits, int lbits, int rbits, WDataOutP owp, - WDataInP const lwp, QData rd) VL_MT_SAFE { +inline WDataOutP VL_SHIFTRS_WWQ(int obits, int lbits, int rbits, WDataOutP owp, WDataInP const lwp, + QData rd) VL_MT_SAFE { VlWide rwp; VL_SET_WQ(rwp, rd); return VL_SHIFTRS_WWW(obits, lbits, rbits, owp, lwp, rwp); } -static inline IData VL_SHIFTRS_IIW(int obits, int lbits, int rbits, IData lhs, - WDataInP const rwp) VL_PURE { +inline IData VL_SHIFTRS_IIW(int obits, int lbits, int rbits, IData lhs, + WDataInP const rwp) VL_PURE { EData overshift = 0; // Huge shift 1>>32 or more for (int i = 1; i < VL_WORDS_I(rbits); ++i) overshift |= rwp[i]; if (VL_UNLIKELY(overshift || rwp[0] >= static_cast(obits))) { @@ -2740,8 +2711,8 @@ static inline IData VL_SHIFTRS_IIW(int obits, int lbits, int rbits, IData lhs, } return VL_SHIFTRS_III(obits, lbits, 32, lhs, rwp[0]); } -static inline QData VL_SHIFTRS_QQW(int obits, int lbits, int rbits, QData lhs, - WDataInP const rwp) VL_PURE { +inline QData VL_SHIFTRS_QQW(int obits, int lbits, int rbits, QData lhs, + WDataInP const rwp) VL_PURE { EData overshift = 0; // Huge shift 1>>32 or more for (int i = 1; i < VL_WORDS_I(rbits); ++i) overshift |= rwp[i]; if (VL_UNLIKELY(overshift || rwp[0] >= static_cast(obits))) { @@ -2750,12 +2721,12 @@ static inline QData VL_SHIFTRS_QQW(int obits, int lbits, int rbits, QData lhs, } return VL_SHIFTRS_QQI(obits, lbits, 32, lhs, rwp[0]); } -static inline IData VL_SHIFTRS_IIQ(int obits, int lbits, int rbits, IData lhs, QData rhs) VL_PURE { +inline IData VL_SHIFTRS_IIQ(int obits, int lbits, int rbits, IData lhs, QData rhs) VL_PURE { VlWide rwp; VL_SET_WQ(rwp, rhs); return VL_SHIFTRS_IIW(obits, lbits, rbits, lhs, rwp); } -static inline QData VL_SHIFTRS_QQQ(int obits, int lbits, int rbits, QData lhs, QData rhs) VL_PURE { +inline QData VL_SHIFTRS_QQQ(int obits, int lbits, int rbits, QData lhs, QData rhs) VL_PURE { VlWide rwp; VL_SET_WQ(rwp, rhs); return VL_SHIFTRS_QQW(obits, lbits, rbits, lhs, rwp); @@ -2770,7 +2741,7 @@ static inline QData VL_SHIFTRS_QQQ(int obits, int lbits, int rbits, QData lhs, Q #define VL_BITSEL_QQII(lbits, lhs, rhs) ((lhs) >> (rhs)) #define VL_BITSEL_IQII(lbits, lhs, rhs) (static_cast((lhs) >> (rhs))) -static inline IData VL_BITSEL_IWII(int lbits, WDataInP const lwp, IData rd) VL_MT_SAFE { +inline IData VL_BITSEL_IWII(int lbits, WDataInP const lwp, IData rd) VL_MT_SAFE { const int word = VL_BITWORD_E(rd); if (VL_UNLIKELY(rd > static_cast(lbits))) { return ~0; // Spec says you can go outside the range of a array. Don't coredump if so. @@ -2787,8 +2758,7 @@ static inline IData VL_BITSEL_IWII(int lbits, WDataInP const lwp, IData rd) VL_M // #define VL_SEL_IRII(lbits, lhs, lsb, width) ((lhs) >> (lsb)) template -static inline IData VL_SEL_IRII(int lbits, const VlQueue& lhs, IData lsb, - IData width) VL_MT_SAFE { +inline IData VL_SEL_IRII(int lbits, const VlQueue& lhs, IData lsb, IData width) VL_MT_SAFE { IData val = 0; if (sizeof(T) == 8) { const int offset = lhs.size() * sizeof(T) / sizeof(IData) - VL_BITWORD_E(lsb) - 1; @@ -2809,8 +2779,8 @@ static inline IData VL_SEL_IRII(int lbits, const VlQueue& lhs, IData lsb, } template -static inline IData VL_SEL_IRII(int lbits, const VlQueue>& lhs, IData lsb, - IData width) VL_MT_SAFE { +inline IData VL_SEL_IRII(int lbits, const VlQueue>& lhs, IData lsb, + IData width) VL_MT_SAFE { IData val = 0; const int offset = lhs.size() * N_Words - VL_BITWORD_E(lsb) - 1; @@ -2822,7 +2792,7 @@ static inline IData VL_SEL_IRII(int lbits, const VlQueue>& lhs, return val; } -static inline IData VL_SEL_IWII(int lbits, WDataInP const lwp, IData lsb, IData width) VL_MT_SAFE { +inline IData VL_SEL_IWII(int lbits, WDataInP const lwp, IData lsb, IData width) VL_MT_SAFE { const int msb = lsb + width - 1; if (VL_UNLIKELY(msb >= lbits)) { return ~0; // Spec says you can go outside the range of a array. Don't coredump if so. @@ -2835,7 +2805,7 @@ static inline IData VL_SEL_IWII(int lbits, WDataInP const lwp, IData lsb, IData return ((lwp[VL_BITWORD_E(msb)] << nbitsfromlow) | VL_BITRSHIFT_W(lwp, lsb)); } -static inline QData VL_SEL_QWII(int lbits, WDataInP const lwp, IData lsb, IData width) VL_MT_SAFE { +inline QData VL_SEL_QWII(int lbits, WDataInP const lwp, IData lsb, IData width) VL_MT_SAFE { const int msb = lsb + width - 1; if (VL_UNLIKELY(msb > lbits)) { return ~0; // Spec says you can go outside the range of a array. Don't coredump if so. @@ -2857,8 +2827,8 @@ static inline QData VL_SEL_QWII(int lbits, WDataInP const lwp, IData lsb, IData return (hi << (nbitsfromlow + VL_EDATASIZE)) | (mid << nbitsfromlow) | lo; } -static inline WDataOutP VL_SEL_WWII(int obits, int lbits, WDataOutP owp, WDataInP const lwp, - IData lsb, IData width) VL_MT_SAFE { +inline WDataOutP VL_SEL_WWII(int obits, int lbits, WDataOutP owp, WDataInP const lwp, IData lsb, + IData width) VL_MT_SAFE { const int msb = lsb + width - 1; const int word_shift = VL_BITWORD_E(lsb); if (VL_UNLIKELY(msb > lbits)) { // Outside bounds, @@ -2886,16 +2856,16 @@ static inline WDataOutP VL_SEL_WWII(int obits, int lbits, WDataOutP owp, WDataIn } template -static inline VlQueue VL_CLONE_Q(const VlQueue& from, int lbits, int srcElementBits, - int dstElementBits) { +inline VlQueue VL_CLONE_Q(const VlQueue& from, int lbits, int srcElementBits, + int dstElementBits) { VlQueue ret; VL_COPY_Q(ret, from, lbits, srcElementBits, dstElementBits); return ret; } template -static inline VlQueue VL_REVCLONE_Q(const VlQueue& from, int lbits, int srcElementBits, - int dstElementBits) { +inline VlQueue VL_REVCLONE_Q(const VlQueue& from, int lbits, int srcElementBits, + int dstElementBits) { VlQueue ret; VL_REVCOPY_Q(ret, from, lbits, srcElementBits, dstElementBits); return ret; @@ -2903,7 +2873,7 @@ static inline VlQueue VL_REVCLONE_Q(const VlQueue& from, int lbits, int sr // Helper function to get a bit from a queue at a specific bit index template -static inline bool VL_GET_QUEUE_BIT(const VlQueue& queue, int srcElementBits, size_t bitIndex) { +inline bool VL_GET_QUEUE_BIT(const VlQueue& queue, int srcElementBits, size_t bitIndex) { const size_t elemIdx = bitIndex / srcElementBits; if (VL_UNLIKELY(elemIdx >= queue.size())) return false; @@ -2917,8 +2887,7 @@ static inline bool VL_GET_QUEUE_BIT(const VlQueue& queue, int srcElementBits, // Helper function to set a bit in the destination queue template -static inline void VL_SET_QUEUE_BIT(VlQueue& queue, int dstElementBits, size_t bitIndex, - bool value) { +inline void VL_SET_QUEUE_BIT(VlQueue& queue, int dstElementBits, size_t bitIndex, bool value) { if (dstElementBits == 1) { if (VL_UNLIKELY(bitIndex >= queue.size())) return; queue.atWrite(bitIndex) = value ? 1 : 0; @@ -2937,8 +2906,8 @@ static inline void VL_SET_QUEUE_BIT(VlQueue& queue, int dstElementBits, size_ // Helper function to get a bit from a VlWide queue at a specific bit index template -static inline bool VL_GET_QUEUE_BIT(const VlQueue>& queue, int srcElementBits, - size_t bitIndex) { +inline bool VL_GET_QUEUE_BIT(const VlQueue>& queue, int srcElementBits, + size_t bitIndex) { const size_t elemIdx = bitIndex / srcElementBits; if (VL_UNLIKELY(elemIdx >= queue.size())) return false; @@ -2951,8 +2920,8 @@ static inline bool VL_GET_QUEUE_BIT(const VlQueue>& queue, int s // Helper function to set a bit in a VlWide queue at a specific bit index template -static inline void VL_SET_QUEUE_BIT(VlQueue>& queue, int dstElementBits, - size_t bitIndex, bool value) { +inline void VL_SET_QUEUE_BIT(VlQueue>& queue, int dstElementBits, size_t bitIndex, + bool value) { const size_t elemIdx = bitIndex / dstElementBits; if (VL_UNLIKELY(elemIdx >= queue.size())) return; @@ -2968,20 +2937,20 @@ static inline void VL_SET_QUEUE_BIT(VlQueue>& queue, int dstElem } template -static inline void VL_ZERO_INIT_QUEUE_ELEM(T& elem) { +inline void VL_ZERO_INIT_QUEUE_ELEM(T& elem) { elem = 0; } template -static inline void VL_ZERO_INIT_QUEUE_ELEM(VlWide& elem) { +inline void VL_ZERO_INIT_QUEUE_ELEM(VlWide& elem) { for (size_t j = 0; j < N_Words; ++j) { elem.at(j) = 0; } } // This specialization works for both VlQueue (and similar) as well // as VlQueue>. template -static inline void VL_COPY_Q(VlQueue& q, const VlQueue& from, int /*lbits*/, - int srcElementBits, int dstElementBits) { +inline void VL_COPY_Q(VlQueue& q, const VlQueue& from, int /*lbits*/, int srcElementBits, + int dstElementBits) { if (srcElementBits == dstElementBits) { // Simple case: same element bit width, direct copy of each element if (VL_UNLIKELY(&q == &from)) return; // Skip self-assignment when it's truly a no-op @@ -3003,8 +2972,8 @@ static inline void VL_COPY_Q(VlQueue& q, const VlQueue& from, int /*lbits* // This specialization works for both VlQueue (and similar) as well // as VlQueue>. template -static inline void VL_REVCOPY_Q(VlQueue& q, const VlQueue& from, int lbits, - int srcElementBits, int dstElementBits) { +inline void VL_REVCOPY_Q(VlQueue& q, const VlQueue& from, int lbits, int srcElementBits, + int dstElementBits) { const size_t srcTotalBits = from.size() * srcElementBits; const size_t dstSize = (srcTotalBits + dstElementBits - 1) / dstElementBits; @@ -3049,7 +3018,7 @@ static inline void VL_REVCOPY_Q(VlQueue& q, const VlQueue& from, int lbits // Reverse element order of an unpacked array in-place. // Used by emitter for descending-range arrays after VL_UNPACK_*. template -static inline void VL_UNPACK_REVERSED(VlUnpacked& q) { +inline void VL_UNPACK_REVERSED(VlUnpacked& q) { for (size_t i = 0; i < N_Depth / 2; ++i) { const T_Value tmp = q[i]; q[i] = q[N_Depth - 1 - i]; @@ -3060,8 +3029,7 @@ static inline void VL_UNPACK_REVERSED(VlUnpacked& q) { // Return a reversed copy of an unpacked array. // Used by emitter for descending-range arrays before VL_PACK_*. template -static inline VlUnpacked -VL_PACK_REVERSED(const VlUnpacked& q) { +inline VlUnpacked VL_PACK_REVERSED(const VlUnpacked& q) { VlUnpacked ret; for (size_t i = 0; i < N_Depth; ++i) ret[i] = q[N_Depth - 1 - i]; return ret; @@ -3069,8 +3037,8 @@ VL_PACK_REVERSED(const VlUnpacked& q) { // Overloads for VlUnpacked source -> VlQueue destination template -static inline void VL_COPY_Q(VlQueue& q, const VlUnpacked& from, int lbits, - int srcElementBits, int dstElementBits) { +inline void VL_COPY_Q(VlQueue& q, const VlUnpacked& from, int lbits, + int srcElementBits, int dstElementBits) { VlQueue srcQ; srcQ.renew(N_Depth); for (size_t i = 0; i < N_Depth; ++i) srcQ.atWrite(i) = from[i]; @@ -3078,8 +3046,8 @@ static inline void VL_COPY_Q(VlQueue& q, const VlUnpacked& from, } template -static inline void VL_REVCOPY_Q(VlQueue& q, const VlUnpacked& from, int lbits, - int srcElementBits, int dstElementBits) { +inline void VL_REVCOPY_Q(VlQueue& q, const VlUnpacked& from, int lbits, + int srcElementBits, int dstElementBits) { VlQueue srcQ; srcQ.renew(N_Depth); for (size_t i = 0; i < N_Depth; ++i) srcQ.atWrite(i) = from[N_Depth - 1 - i]; @@ -3089,56 +3057,56 @@ static inline void VL_REVCOPY_Q(VlQueue& q, const VlUnpacked& fro //====================================================================== // Expressions needing insert/select -static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { +inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { +inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { +inline void VL_UNPACK_RI_I(int lbits, int rbits, VlQueue& q, IData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { +inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { +inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { +inline void VL_UNPACK_RI_Q(int lbits, int rbits, VlQueue& q, QData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RQ_Q(int lbits, int rbits, VlQueue& q, QData from) { +inline void VL_UNPACK_RQ_Q(int lbits, int rbits, VlQueue& q, QData from) { const size_t size = (rbits + lbits - 1) / lbits; q.renew(size); const QData mask = VL_MASK_Q(lbits); for (size_t i = 0; i < size; ++i) q.atWrite(size - 1 - i) = (from >> (i * lbits)) & mask; } -static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { +inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { const int size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); @@ -3151,7 +3119,7 @@ static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WData } } -static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { +inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { const int size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); @@ -3164,7 +3132,7 @@ static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WData } } -static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { +inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { const int size = (rbits + lbits - 1) / lbits; q.renew(size); const IData mask = VL_MASK_I(lbits); @@ -3177,7 +3145,7 @@ static inline void VL_UNPACK_RI_W(int lbits, int rbits, VlQueue& q, WData } } -static inline void VL_UNPACK_RQ_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { +inline void VL_UNPACK_RQ_W(int lbits, int rbits, VlQueue& q, WDataInP rwp) { const int size = (rbits + lbits - 1) / lbits; q.renew(size); const QData mask = VL_MASK_Q(lbits); @@ -3191,8 +3159,7 @@ static inline void VL_UNPACK_RQ_W(int lbits, int rbits, VlQueue& q, WData } template -static inline void VL_UNPACK_RW_W(int lbits, int rbits, VlQueue>& q, - WDataInP rwp) { +inline void VL_UNPACK_RW_W(int lbits, int rbits, VlQueue>& q, WDataInP rwp) { const int size = (rbits + lbits - 1) / lbits; q.renew(size); for (size_t i = 0; i < size; ++i) { @@ -3205,30 +3172,26 @@ static inline void VL_UNPACK_RW_W(int lbits, int rbits, VlQueue> } template -static inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, - IData from) { +inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, IData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, - IData from) { +inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, IData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, - IData from) { +inline void VL_UNPACK_UI_I(int lbits, int /*rbits*/, VlUnpacked& q, IData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_I(const int lbits, const int rbits, - VlUnpacked, N_Depth>& q, - const IData from) { +inline void VL_UNPACK_UI_I(const int lbits, const int rbits, + VlUnpacked, N_Depth>& q, const IData from) { const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { const IData sub_from = (from >> ((N_Depth - 1 - i) * sub_bits)); @@ -3237,30 +3200,26 @@ static inline void VL_UNPACK_UI_I(const int lbits, const int rbits, } template -static inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, - QData from) { +inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, QData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, - QData from) { +inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, QData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, - QData from) { +inline void VL_UNPACK_UI_Q(int lbits, int /*rbits*/, VlUnpacked& q, QData from) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_Q(const int lbits, const int rbits, - VlUnpacked, N_Depth>& q, - const QData from) { +inline void VL_UNPACK_UI_Q(const int lbits, const int rbits, + VlUnpacked, N_Depth>& q, const QData from) { const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { const QData sub_from = (from >> ((N_Depth - 1 - i) * sub_bits)); @@ -3269,16 +3228,15 @@ static inline void VL_UNPACK_UI_Q(const int lbits, const int rbits, } template -static inline void VL_UNPACK_UQ_Q(int lbits, int /*rbits*/, VlUnpacked& q, - QData from) { +inline void VL_UNPACK_UQ_Q(int lbits, int /*rbits*/, VlUnpacked& q, QData from) { const QData mask = VL_MASK_Q(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = (from >> ((N_Depth - 1 - i) * lbits)) & mask; } template -static inline void VL_UNPACK_UI_W(const int lbits, const int rbits, - VlUnpacked, N_Depth>& q, WDataInP rwp, - const int bit_offset = 0) { +inline void VL_UNPACK_UI_W(const int lbits, const int rbits, + VlUnpacked, N_Depth>& q, WDataInP rwp, + const int bit_offset = 0) { const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { VL_UNPACK_UI_W(lbits, rbits, q[i], rwp, bit_offset + (N_Depth - 1 - i) * sub_bits); @@ -3286,9 +3244,9 @@ static inline void VL_UNPACK_UI_W(const int lbits, const int rbits, } template -static inline void VL_UNPACK_UQ_W(const int lbits, const int rbits, - VlUnpacked, N_Depth>& q, WDataInP rwp, - const int bit_offset = 0) { +inline void VL_UNPACK_UQ_W(const int lbits, const int rbits, + VlUnpacked, N_Depth>& q, WDataInP rwp, + const int bit_offset = 0) { const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { VL_UNPACK_UQ_W(lbits, rbits, q[i], rwp, bit_offset + (N_Depth - 1 - i) * sub_bits); @@ -3296,9 +3254,9 @@ static inline void VL_UNPACK_UQ_W(const int lbits, const int rbits, } template -static inline void VL_UNPACK_UW_W(const int lbits, const int rbits, - VlUnpacked, N_Depth>& q, WDataInP rwp, - const int bit_offset = 0) { +inline void VL_UNPACK_UW_W(const int lbits, const int rbits, + VlUnpacked, N_Depth>& q, WDataInP rwp, + const int bit_offset = 0) { const int sub_bits = VlUnpackedElements>::count * lbits; for (size_t i = 0; i < N_Depth; ++i) { VL_UNPACK_UW_W(lbits, rbits, q[i], rwp, bit_offset + (N_Depth - 1 - i) * sub_bits); @@ -3306,47 +3264,47 @@ static inline void VL_UNPACK_UW_W(const int lbits, const int rbits, } template -static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, - WDataInP rwp, const int bit_offset = 0) { +inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, WDataInP rwp, + const int bit_offset = 0) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = VL_SEL_IWII(rbits, rwp, bit_offset + (N_Depth - 1 - i) * lbits, lbits) & mask; } template -static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, - WDataInP rwp, const int bit_offset = 0) { +inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, WDataInP rwp, + const int bit_offset = 0) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = VL_SEL_IWII(rbits, rwp, bit_offset + (N_Depth - 1 - i) * lbits, lbits) & mask; } template -static inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, - WDataInP rwp, const int bit_offset = 0) { +inline void VL_UNPACK_UI_W(int lbits, int rbits, VlUnpacked& q, WDataInP rwp, + const int bit_offset = 0) { const IData mask = VL_MASK_I(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = VL_SEL_IWII(rbits, rwp, bit_offset + (N_Depth - 1 - i) * lbits, lbits) & mask; } template -static inline void VL_UNPACK_UQ_W(int lbits, int rbits, VlUnpacked& q, - WDataInP rwp, const int bit_offset = 0) { +inline void VL_UNPACK_UQ_W(int lbits, int rbits, VlUnpacked& q, WDataInP rwp, + const int bit_offset = 0) { const QData mask = VL_MASK_Q(lbits); for (size_t i = 0; i < N_Depth; ++i) q[i] = VL_SEL_QWII(rbits, rwp, bit_offset + (N_Depth - 1 - i) * lbits, lbits) & mask; } template -static inline void VL_UNPACK_UW_W(int lbits, int rbits, VlUnpacked, N_Depth>& q, - WDataInP rwp, const int bit_offset = 0) { +inline void VL_UNPACK_UW_W(int lbits, int rbits, VlUnpacked, N_Depth>& q, + WDataInP rwp, const int bit_offset = 0) { for (size_t i = 0; i < N_Depth; ++i) VL_SEL_WWII(lbits, rbits, q[i], rwp, bit_offset + (N_Depth - 1 - i) * lbits, lbits); } // Return QData from double (numeric) // EMIT_RULE: VL_RTOIROUND_Q_D: oclean=dirty; lclean==clean/real -static inline QData VL_RTOIROUND_Q_D(double lhs) VL_PURE { +inline QData VL_RTOIROUND_Q_D(double lhs) VL_PURE { // IEEE format: [63]=sign [62:52]=exp+1023 [51:0]=mantissa // This does not need to support subnormals as they are sub-integral lhs = VL_ROUND(lhs); @@ -3363,10 +3321,10 @@ static inline QData VL_RTOIROUND_Q_D(double lhs) VL_PURE { if (lhs < 0) out = -out; return out; } -static inline IData VL_RTOIROUND_I_D(double lhs) VL_PURE { +inline IData VL_RTOIROUND_I_D(double lhs) VL_PURE { return static_cast(VL_RTOIROUND_Q_D(lhs)); } -static inline WDataOutP VL_RTOIROUND_W_D(int obits, WDataOutP owp, double lhs) VL_MT_SAFE { +inline WDataOutP VL_RTOIROUND_W_D(int obits, WDataOutP owp, double lhs) VL_MT_SAFE { // IEEE format: [63]=sign [62:52]=exp+1023 [51:0]=mantissa // This does not need to support subnormals as they are sub-integral lhs = VL_ROUND(lhs); @@ -3388,33 +3346,31 @@ static inline WDataOutP VL_RTOIROUND_W_D(int obits, WDataOutP owp, double lhs) V // Range assignments // EMIT_RULE: VL_ASSIGNRANGE: rclean=dirty; -static inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, CData& lhsr, IData rhs) VL_PURE { +inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, CData& lhsr, IData rhs) VL_PURE { _vl_insert_II(lhsr, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, SData& lhsr, IData rhs) VL_PURE { +inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, SData& lhsr, IData rhs) VL_PURE { _vl_insert_II(lhsr, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, IData& lhsr, IData rhs) VL_PURE { +inline void VL_ASSIGNSEL_II(int rbits, int obits, int lsb, IData& lhsr, IData rhs) VL_PURE { _vl_insert_II(lhsr, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_QI(int rbits, int obits, int lsb, QData& lhsr, IData rhs) VL_PURE { +inline void VL_ASSIGNSEL_QI(int rbits, int obits, int lsb, QData& lhsr, IData rhs) VL_PURE { _vl_insert_QQ(lhsr, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_QQ(int rbits, int obits, int lsb, QData& lhsr, QData rhs) VL_PURE { +inline void VL_ASSIGNSEL_QQ(int rbits, int obits, int lsb, QData& lhsr, QData rhs) VL_PURE { _vl_insert_QQ(lhsr, rhs, lsb + obits - 1, lsb, rbits); } -// static inline void VL_ASSIGNSEL_IIIW(int obits, int lsb, IData& lhsr, WDataInP const rwp) +// inline void VL_ASSIGNSEL_IIIW(int obits, int lsb, IData& lhsr, WDataInP const rwp) // VL_MT_SAFE { Illegal, as lhs width >= rhs width -static inline void VL_ASSIGNSEL_WI(int rbits, int obits, int lsb, WDataOutP iowp, - IData rhs) VL_MT_SAFE { +inline void VL_ASSIGNSEL_WI(int rbits, int obits, int lsb, WDataOutP iowp, IData rhs) VL_MT_SAFE { _vl_insert_WI(iowp, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_WQ(int rbits, int obits, int lsb, WDataOutP iowp, - QData rhs) VL_MT_SAFE { +inline void VL_ASSIGNSEL_WQ(int rbits, int obits, int lsb, WDataOutP iowp, QData rhs) VL_MT_SAFE { _vl_insert_WQ(iowp, rhs, lsb + obits - 1, lsb, rbits); } -static inline void VL_ASSIGNSEL_WW(int rbits, int obits, int lsb, WDataOutP iowp, - WDataInP const rwp) VL_MT_SAFE { +inline void VL_ASSIGNSEL_WW(int rbits, int obits, int lsb, WDataOutP iowp, + WDataInP const rwp) VL_MT_SAFE { _vl_insert_WW(iowp, rwp, lsb + obits - 1, lsb, rbits); } @@ -3423,62 +3379,55 @@ static inline void VL_ASSIGNSEL_WW(int rbits, int obits, int lsb, WDataOutP iowp // These additional functions copy bits range [obis+roffset-1:roffset] from rhs to lower bits // of lhs(select before assigning). Rhs should always be wider than lhs. -static inline void VL_SELASSIGN_II(int rbits, int obits, CData& lhsr, IData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_II(int rbits, int obits, CData& lhsr, IData rhs, int roffset) VL_PURE { _vl_insert_II(lhsr, rhs >> roffset, obits - 1, 0, rbits); } -static inline void VL_SELASSIGN_II(int rbits, int obits, SData& lhsr, IData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_II(int rbits, int obits, SData& lhsr, IData rhs, int roffset) VL_PURE { _vl_insert_II(lhsr, rhs >> roffset, obits - 1, 0, rbits); } -static inline void VL_SELASSIGN_II(int rbits, int obits, IData& lhsr, IData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_II(int rbits, int obits, IData& lhsr, IData rhs, int roffset) VL_PURE { _vl_insert_II(lhsr, rhs >> roffset, obits - 1, 0, rbits); } -static inline void VL_SELASSIGN_IQ(int rbits, int obits, CData& lhsr, QData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_IQ(int rbits, int obits, CData& lhsr, QData rhs, int roffset) VL_PURE { // it will be truncated to right CData mask const CData cleanmask = VL_MASK_I(rbits); const CData insmask = VL_MASK_I(obits); lhsr = (lhsr & ~insmask) | (static_cast(rhs >> roffset) & (insmask & cleanmask)); } -static inline void VL_SELASSIGN_IQ(int rbits, int obits, SData& lhsr, QData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_IQ(int rbits, int obits, SData& lhsr, QData rhs, int roffset) VL_PURE { // it will be truncated to right CData mask const SData cleanmask = VL_MASK_I(rbits); const SData insmask = VL_MASK_I(obits); lhsr = (lhsr & ~insmask) | (static_cast(rhs >> roffset) & (insmask & cleanmask)); } -static inline void VL_SELASSIGN_IQ(int rbits, int obits, IData& lhsr, QData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_IQ(int rbits, int obits, IData& lhsr, QData rhs, int roffset) VL_PURE { const IData cleanmask = VL_MASK_I(rbits); const IData insmask = VL_MASK_I(obits); lhsr = (lhsr & ~insmask) | (static_cast(rhs >> roffset) & (insmask & cleanmask)); } -static inline void VL_SELASSIGN_QQ(int rbits, int obits, QData& lhsr, QData rhs, - int roffset) VL_PURE { +inline void VL_SELASSIGN_QQ(int rbits, int obits, QData& lhsr, QData rhs, int roffset) VL_PURE { _vl_insert_QQ(lhsr, rhs >> roffset, obits - 1, 0, rbits); } -static inline void VL_SELASSIGN_IW(int rbits, int obits, CData& lhsr, WDataInP const rhs, - int roffset) VL_MT_SAFE { +inline void VL_SELASSIGN_IW(int rbits, int obits, CData& lhsr, WDataInP const rhs, + int roffset) VL_MT_SAFE { IData l = static_cast(lhsr); _vl_insert_IW(l, rhs, roffset + obits - 1, roffset, rbits); lhsr = static_cast(l); } -static inline void VL_SELASSIGN_IW(int rbits, int obits, SData& lhsr, WDataInP const rhs, - int roffset) VL_MT_SAFE { +inline void VL_SELASSIGN_IW(int rbits, int obits, SData& lhsr, WDataInP const rhs, + int roffset) VL_MT_SAFE { IData l = static_cast(lhsr); _vl_insert_IW(l, rhs, roffset + obits - 1, roffset, rbits); lhsr = static_cast(l); } -static inline void VL_SELASSIGN_IW(int rbits, int obits, IData& lhsr, WDataInP const rhs, - int roffset) VL_MT_SAFE { +inline void VL_SELASSIGN_IW(int rbits, int obits, IData& lhsr, WDataInP const rhs, + int roffset) VL_MT_SAFE { _vl_insert_IW(lhsr, rhs, roffset + obits - 1, roffset, rbits); } -static inline void VL_SELASSIGN_QW(int rbits, int obits, QData& lhsr, WDataInP const rhs, - int roffset) VL_MT_SAFE { +inline void VL_SELASSIGN_QW(int rbits, int obits, QData& lhsr, WDataInP const rhs, + int roffset) VL_MT_SAFE { // assert VL_QDATASIZE >= rbits > VL_IDATASIZE; IData low = static_cast(lhsr); IData high = static_cast(lhsr >> VL_IDATASIZE); @@ -3492,8 +3441,8 @@ static inline void VL_SELASSIGN_QW(int rbits, int obits, QData& lhsr, WDataInP c lhsr = (static_cast(high) << VL_IDATASIZE) | low; } -static inline void VL_SELASSIGN_WW(int rbits, int obits, WDataOutP iowp, WDataInP const rwp, - int roffset) VL_MT_SAFE { +inline void VL_SELASSIGN_WW(int rbits, int obits, WDataOutP iowp, WDataInP const rwp, + int roffset) VL_MT_SAFE { // assert rbits > VL_QDATASIZE const int wordoff = roffset / VL_EDATASIZE; const int lsb = roffset & VL_SIZEBITS_E; @@ -3532,46 +3481,46 @@ static inline void VL_SELASSIGN_WW(int rbits, int obits, WDataOutP iowp, WDataIn return o // clang-format off -static inline WDataOutP VL_CONST_W_1X(int obits, WDataOutP o, EData d0) VL_MT_SAFE { +inline WDataOutP VL_CONST_W_1X(int obits, WDataOutP o, EData d0) VL_MT_SAFE { o[0] = d0; VL_C_END_(obits, 1); } -static inline WDataOutP VL_CONST_W_2X(int obits, WDataOutP o, EData d1, EData d0) VL_MT_SAFE { +inline WDataOutP VL_CONST_W_2X(int obits, WDataOutP o, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; VL_C_END_(obits, 2); } -static inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o, EData d2, EData d1, +inline WDataOutP VL_CONST_W_3X(int obits, WDataOutP o, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; VL_C_END_(obits, 3); } -static inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o, +inline WDataOutP VL_CONST_W_4X(int obits, WDataOutP o, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; VL_C_END_(obits, 4); } -static inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o, +inline WDataOutP VL_CONST_W_5X(int obits, WDataOutP o, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[4] = d4; VL_C_END_(obits, 5); } -static inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o, +inline WDataOutP VL_CONST_W_6X(int obits, WDataOutP o, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[4] = d4; o[5] = d5; VL_C_END_(obits, 6); } -static inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o, +inline WDataOutP VL_CONST_W_7X(int obits, WDataOutP o, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; o[4] = d4; o[5] = d5; o[6] = d6; VL_C_END_(obits, 7); } -static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o, +inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o, EData d7, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { o[0] = d0; o[1] = d1; o[2] = d2; o[3] = d3; @@ -3579,31 +3528,31 @@ static inline WDataOutP VL_CONST_W_8X(int obits, WDataOutP o, VL_C_END_(obits, 8); } // -static inline WDataOutP VL_CONSTHI_W_1X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_1X(int obits, int lsb, WDataOutP o, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); ohi[0] = d0; VL_C_END_(obits, VL_WORDS_I(lsb) + 1); } -static inline WDataOutP VL_CONSTHI_W_2X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_2X(int obits, int lsb, WDataOutP o, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); ohi[0] = d0; ohi[1] = d1; VL_C_END_(obits, VL_WORDS_I(lsb) + 2); } -static inline WDataOutP VL_CONSTHI_W_3X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_3X(int obits, int lsb, WDataOutP o, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); ohi[0] = d0; ohi[1] = d1; ohi[2] = d2; VL_C_END_(obits, VL_WORDS_I(lsb) + 3); } -static inline WDataOutP VL_CONSTHI_W_4X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_4X(int obits, int lsb, WDataOutP o, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); ohi[0] = d0; ohi[1] = d1; ohi[2] = d2; ohi[3] = d3; VL_C_END_(obits, VL_WORDS_I(lsb) + 4); } -static inline WDataOutP VL_CONSTHI_W_5X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_5X(int obits, int lsb, WDataOutP o, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); @@ -3611,7 +3560,7 @@ static inline WDataOutP VL_CONSTHI_W_5X(int obits, int lsb, WDataOutP o, ohi[4] = d4; VL_C_END_(obits, VL_WORDS_I(lsb) + 5); } -static inline WDataOutP VL_CONSTHI_W_6X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_6X(int obits, int lsb, WDataOutP o, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); @@ -3619,7 +3568,7 @@ static inline WDataOutP VL_CONSTHI_W_6X(int obits, int lsb, WDataOutP o, ohi[4] = d4; ohi[5] = d5; VL_C_END_(obits, VL_WORDS_I(lsb) + 6); } -static inline WDataOutP VL_CONSTHI_W_7X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_7X(int obits, int lsb, WDataOutP o, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); @@ -3627,7 +3576,7 @@ static inline WDataOutP VL_CONSTHI_W_7X(int obits, int lsb, WDataOutP o, ohi[4] = d4; ohi[5] = d5; ohi[6] = d6; VL_C_END_(obits, VL_WORDS_I(lsb) + 7); } -static inline WDataOutP VL_CONSTHI_W_8X(int obits, int lsb, WDataOutP o, +inline WDataOutP VL_CONSTHI_W_8X(int obits, int lsb, WDataOutP o, EData d7, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP ohi = o + VL_WORDS_I(lsb); @@ -3639,7 +3588,7 @@ static inline WDataOutP VL_CONSTHI_W_8X(int obits, int lsb, WDataOutP o, #undef VL_C_END_ // Partial constant, lower words of vector wider than 8*32, starting at bit number lsb -static inline void VL_CONSTLO_W_8X(int lsb, WDataOutP obase, +inline void VL_CONSTLO_W_8X(int lsb, WDataOutP obase, EData d7, EData d6, EData d5, EData d4, EData d3, EData d2, EData d1, EData d0) VL_MT_SAFE { WDataOutP o = obase + VL_WORDS_I(lsb); diff --git a/include/verilated_trace_imp.h b/include/verilated_trace_imp.h index 0843f1843..e2d740d4a 100644 --- a/include/verilated_trace_imp.h +++ b/include/verilated_trace_imp.h @@ -449,7 +449,7 @@ void VerilatedTrace::initLib(const std::string& name) VL_MT_ // All of these take a destination pointer where the string will be emitted, // and a value to convert. There are a couple of variants for efficiency. -static inline void cvtCDataToStr(char* dstp, CData value) { +inline void cvtCDataToStr(char* dstp, CData value) { #ifdef VL_HAVE_SSE2 // Similar to cvtSDataToStr but only the bottom 8 byte lanes are used const __m128i a = _mm_cvtsi32_si128(value); @@ -471,7 +471,7 @@ static inline void cvtCDataToStr(char* dstp, CData value) { #endif } -static inline void cvtSDataToStr(char* dstp, SData value) { +inline void cvtSDataToStr(char* dstp, SData value) { #ifdef VL_HAVE_SSE2 // We want each bit in the 16-bit input value to end up in a byte lane // within the 128-bit XMM register. Note that x86 is little-endian and we @@ -507,7 +507,7 @@ static inline void cvtSDataToStr(char* dstp, SData value) { #endif } -static inline void cvtIDataToStr(char* dstp, IData value) { +inline void cvtIDataToStr(char* dstp, IData value) { #ifdef VL_HAVE_AVX2 // Similar to cvtSDataToStr but the bottom 16-bits are processed in the // top half of the YMM registers @@ -526,7 +526,7 @@ static inline void cvtIDataToStr(char* dstp, IData value) { #endif } -static inline void cvtQDataToStr(char* dstp, QData value) { +inline void cvtQDataToStr(char* dstp, QData value) { cvtIDataToStr(dstp, value >> 32); cvtIDataToStr(dstp + 32, value); } diff --git a/include/verilated_types.h b/include/verilated_types.h index 20e71f142..342c1b997 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -214,7 +214,7 @@ public: }; static_assert(sizeof(WDataInP) == sizeof(EData*), "WDataInP should be a single pointer"); -static int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE; +inline int _vl_cmp_w(int words, WDataInP const lwp, WDataInP const rwp) VL_PURE; template bool VlWide::operator<(const VlWide& rhs) const VL_PURE { @@ -2119,7 +2119,7 @@ public: VlClassRef() = default; // Init with nullptr // cppcheck-suppress noExplicitConstructor - VlClassRef(VlNull){}; + VlClassRef(VlNull) {}; template VlClassRef(VlDeleter& deleter, T_Args&&... args) : m_objp{new T_Class} { @@ -2240,7 +2240,7 @@ public: }; template -static inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr) { +inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr) { if (!in) { outr = VlNull{}; return true; @@ -2254,7 +2254,7 @@ static inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr } template -static inline bool VL_CAST_DYNAMIC(VlNull, VlClassRef& outr) { +inline bool VL_CAST_DYNAMIC(VlNull, VlClassRef& outr) { outr = VlNull{}; return true; } diff --git a/include/verilatedos.h b/include/verilatedos.h index d7e251987..57add8d69 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -537,10 +537,10 @@ using ssize_t = uint32_t; ///< signed size_t; returned from read() // #defines, to avoid requiring math.h on all compile runs #ifdef _MSC_VER -static inline double VL_TRUNC(double n) { +inline double VL_TRUNC(double n) { return (n < 0) ? std::ceil(n) : std::floor(n); } -static inline double VL_ROUND(double n) { +inline double VL_ROUND(double n) { return (n < 0) ? std::ceil(n-0.5) : std::floor(n + 0.5); } #else