diff --git a/.clang-format b/.clang-format index 39b753e7a..3e8142bf7 100644 --- a/.clang-format +++ b/.clang-format @@ -112,6 +112,9 @@ SpacesBeforeTrailingComments: 2 SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false +SpacesInLineCommentPrefix: + Minimum: 0 + Maximum: -1 SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Cpp11 diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index a33b9023b..32ab2268e 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -344,8 +344,8 @@ uint64_t vl_time_pow10(int n) VL_PURE; // Output clean // EMIT_RULE: VL_CLEAN: oclean=clean; obits=lbits; -#define VL_CLEAN_II(obits, lbits, lhs) ((lhs)&VL_MASK_I(obits)) -#define VL_CLEAN_QQ(obits, lbits, lhs) ((lhs)&VL_MASK_Q(obits)) +#define VL_CLEAN_II(obits, lbits, lhs) ((lhs) & (VL_MASK_I(obits))) +#define VL_CLEAN_QQ(obits, lbits, lhs) ((lhs) & (VL_MASK_Q(obits))) // EMIT_RULE: VL_ASSIGNCLEAN: oclean=clean; obits==lbits; #define VL_ASSIGNCLEAN_W(obits, owp, lwp) VL_CLEAN_WW((obits), (owp), (lwp)) diff --git a/src/V3Number.cpp b/src/V3Number.cpp index 38e7de3a2..702c4c1ca 100644 --- a/src/V3Number.cpp +++ b/src/V3Number.cpp @@ -314,8 +314,7 @@ void V3Number::create(const char* sourcep) { case 'o': case 'c': { - switch (std::tolower(*cp)) { - // clang-format off + switch (std::tolower(*cp)) { // clang-format off case '0': setBit(obit++, 0); setBit(obit++, 0); setBit(obit++, 0); break; case '1': setBit(obit++, 1); setBit(obit++, 0); setBit(obit++, 0); break; case '2': setBit(obit++, 0); setBit(obit++, 1); setBit(obit++, 0); break; @@ -335,8 +334,7 @@ void V3Number::create(const char* sourcep) { } case 'h': { - switch (std::tolower(*cp)) { - // clang-format off + switch (std::tolower(*cp)) { // clang-format off case '0': setBit(obit++,0); setBit(obit++,0); setBit(obit++,0); setBit(obit++,0); break; case '1': setBit(obit++,1); setBit(obit++,0); setBit(obit++,0); setBit(obit++,0); break; case '2': setBit(obit++,0); setBit(obit++,1); setBit(obit++,0); setBit(obit++,0); break; diff --git a/test_regress/t/t_dpi_qw_c.cpp b/test_regress/t/t_dpi_qw_c.cpp index 7a18e6b83..751e1c331 100644 --- a/test_regress/t/t_dpi_qw_c.cpp +++ b/test_regress/t/t_dpi_qw_c.cpp @@ -33,7 +33,7 @@ void poke_value(int i) { const char* const scopeNamep = svGetNameFromScope(svGetScope()); printf("svGetNameFromScope=\"%s\"\n", scopeNamep); -// clang-format off + // clang-format off #ifdef VERILATOR static int didDump = 0; if (didDump++ == 0) { diff --git a/test_regress/t/t_dpi_var.cpp b/test_regress/t/t_dpi_var.cpp index eac0571fe..13c3020e0 100644 --- a/test_regress/t/t_dpi_var.cpp +++ b/test_regress/t/t_dpi_var.cpp @@ -121,7 +121,7 @@ int main(int argc, char** argv) { // Note null name - we're flattening it out ""}}; -// clang-format off + // clang-format off #ifdef VERILATOR # ifdef TEST_VERBOSE contextp->scopesDump(); diff --git a/test_regress/t/t_mem_multi_io2.cpp b/test_regress/t/t_mem_multi_io2.cpp index 14e71c1a4..24269b14c 100644 --- a/test_regress/t/t_mem_multi_io2.cpp +++ b/test_regress/t/t_mem_multi_io2.cpp @@ -48,7 +48,7 @@ int main() #endif // loop through every possibility and check the result -// clang-format off + // clang-format off #ifdef SYSTEMC_VERSION sc_start(1, SC_NS); # define ASSIGN(s, v) s.write(v) diff --git a/test_regress/t/t_trace_two_cc.cpp b/test_regress/t/t_trace_two_cc.cpp index 92d9d33f9..46ad12913 100644 --- a/test_regress/t/t_trace_two_cc.cpp +++ b/test_regress/t/t_trace_two_cc.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv) { ap = new VM_PREFIX{contextp.get(), "topa"}; bp = new Vt_trace_two_b{contextp.get(), "topb"}; -// clang-format off + // clang-format off #ifdef TEST_HDR_TRACE contextp->traceEverOn(true); # ifdef TEST_FST diff --git a/test_regress/t/t_var_sc_bv.cpp b/test_regress/t/t_var_sc_bv.cpp index 306810635..cb0b93ed2 100644 --- a/test_regress/t/t_var_sc_bv.cpp +++ b/test_regress/t/t_var_sc_bv.cpp @@ -108,21 +108,20 @@ int main() #endif -// clang-format off #ifdef SYSTEMC_VERSION sc_start(1, SC_NS); #else tb->eval(); #endif // This testcase is testing multi-thread safe VL_ASSIGN_SBW and VL_ASSIGN_WSB macros. - // Testbench is assigning different number of bits from VlWide input_var variable to different inputs. - // Values around multiple of 30 (i.e. BITS_PER_DIGIT defined in SystemC sc_nbdefs.h) are tested with the special care, since - // it is the value by which the data_ptr of sc_biguint underlying data type is increased by (and not expected 32, as width of uint32_t). - // Correctness of the output is compared against the 'old' macro, which is correct but has multi-threaded issue since it's using range function. - // Second part is testing VL_ASSIGN_WSB in a reverse way, it is reading signals from the previous test, - // and comparing the output with (fraction) of VlWide input_var variable. - - // clang-format on + // Testbench is assigning different number of bits from VlWide input_var variable to different + // inputs. Values around multiple of 30 (i.e. BITS_PER_DIGIT defined in SystemC sc_nbdefs.h) + // are tested with the special care, since it is the value by which the data_ptr of sc_biguint + // underlying data type is increased by (and not expected 32, as width of uint32_t). + // Correctness of the output is compared against the 'old' macro, which is correct but has + // multi-threaded issue since it's using range function. Second part is testing VL_ASSIGN_WSB + // in a reverse way, it is reading signals from the previous test, and comparing the output + // with (fraction) of VlWide input_var variable. VL_ASSIGN_SBW(29, i_29_s, input_var); VL_ASSIGN_SBW_MT_ISSUE(29, i_29_old_s, input_var); VL_ASSIGN_SBW(30, i_30_s, input_var); diff --git a/test_regress/t/t_vpi_time_cb.cpp b/test_regress/t/t_vpi_time_cb.cpp index b26a1fb1f..8bc06e2f1 100644 --- a/test_regress/t/t_vpi_time_cb.cpp +++ b/test_regress/t/t_vpi_time_cb.cpp @@ -35,11 +35,9 @@ int main(int argc, char** argv) { // Note null name - we're flattening it out ""}}; -// clang-format off #ifdef TEST_VERBOSE contextp->scopesDump(); #endif - // clang-format on #if VM_TRACE contextp->traceEverOn(true); diff --git a/test_regress/t/t_vpi_zero_time_cb.cpp b/test_regress/t/t_vpi_zero_time_cb.cpp index e94e11164..32cf2fe6a 100644 --- a/test_regress/t/t_vpi_zero_time_cb.cpp +++ b/test_regress/t/t_vpi_zero_time_cb.cpp @@ -116,7 +116,7 @@ int main(int argc, char** argv) { // Note null name - we're flattening it out ""}}; -// clang-format off + // clang-format off #ifdef VERILATOR # ifdef TEST_VERBOSE contextp->scopesDump();