Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix macro operator precedence problem #30

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading