Skip to content

Commit

Permalink
Merge pull request #30 from ping-ee/fix/macro-operator-precedence
Browse files Browse the repository at this point in the history
Fix macro operator precedence problem (#29)
  • Loading branch information
dpretet authored Sep 23, 2024
2 parents d2b4d62 + 9594a8d commit 5dc682b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions svut/svut_h.sv
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ endfunction
`define FAIL_IF_NOT(exp, message="") \
svut_status = 0; \
svut_msg = create_msg("FAIL_IF_NOT", message); \
if (!exp) begin \
if (!(exp)) begin \
`ERROR(svut_msg); \
svut_status = 1; \
end
Expand All @@ -156,7 +156,7 @@ endfunction
`define ASSERT(exp, message="") \
svut_status = 0; \
svut_msg = create_msg("ASSERT", message); \
if (!exp) begin \
if (!(exp)) begin \
`ERROR(svut_msg); \
svut_status = 1; \
end
Expand Down
2 changes: 1 addition & 1 deletion svut/template.sv
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ${module_inst}
// - `FAIL_IF_EQUAL(aSignal, 23): Increment error counter if evaluation is equal
// - `FAIL_IF_NOT_EQUAL(aSignal, 45): Increment error counter if evaluation is not equal
// - `ASSERT(aSignal): Increment error counter if evaluation is not true
// - `ASSERT((aSignal == 0)): Increment error counter if evaluation is not true
// - `ASSERT(aSignal == 0): Increment error counter if evaluation is not true
//
// Available flag:
//
Expand Down
2 changes: 2 additions & 0 deletions test/Adder_KO_testsuite.sv
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ module Adder_unit_test_KO;
`FAIL_IF_NOT_EQUAL(out, 8'd0);
`INFO("Test FAIL_IF_NOT_EQUAL");
`FAIL_IF_EQUAL(out, 8'd1);
`INFO("Test ASSERT");
`ASSERT(inc === 1'b1);

`ERROR("Test finished");

Expand Down
2 changes: 2 additions & 0 deletions test/Adder_OK_testsuite.sv
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ module Adder_unit_test_OK;
`FAIL_IF_EQUAL(out, 8'd0);
`INFO("Test FAIL_IF_NOT_EQUAL");
`FAIL_IF_NOT_EQUAL(out, 8'd1);
`INFO("Test ASSERT");
`ASSERT(inc === 1'b0);

`SUCCESS("Test finished");

Expand Down
2 changes: 1 addition & 1 deletion test/testsuite_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test_run_ko_testsuite() { #@test
test_run_ko_testsuite_error_count() { #@test

run exe_ko_to_log
error_num=9
error_num=10
[ $(grep -c "ERROR:" log) -eq "$error_num" ]
}

Expand Down

0 comments on commit 5dc682b

Please sign in to comment.