why does X look like 0 in my assertion for rdata?

This commit is contained in:
Brendan Haines 2022-12-01 02:04:17 -07:00
parent c63a025615
commit cb7fbe84a5
2 changed files with 128 additions and 28 deletions

View File

@ -10,7 +10,7 @@ package bh_assert;
localparam BH_ASSERT_LOG_LEVEL_WARN = 2;
localparam BH_ASSERT_LOG_LEVEL_INFO = 3;
logic bh_assert_log_level = BH_ASSERT_LOG_LEVEL_WARN; // 0 = errors only, 1 = all assertions, 2 = warnings, 3 = info
logic bh_assert_log_level = BH_ASSERT_LOG_LEVEL_INFO; // 0 = errors only, 1 = all assertions, 2 = warnings, 3 = info
localparam COLOR_RED = "\033[31m";
localparam COLOR_YELLOW = "\033[33m";
@ -23,15 +23,15 @@ package bh_assert;
$display(
"%t: %s: %d %s %d - %s",
$time,
val == expected ? {COLOR_GREEN, "PASS", COLOR_NORMAL} : {COLOR_RED, "FAIL", COLOR_NORMAL},
val === expected ? {COLOR_GREEN, "PASS", COLOR_NORMAL} : {COLOR_RED, "FAIL", COLOR_NORMAL},
val,
val == expected ? "==" : "!=",
val === expected ? "==" : "!=",
expected,
description
);
// update statistics
if (val == expected) begin
if (val === expected) begin
bh_assert_pass_count = bh_assert_pass_count + 1;
end else begin
bh_assert_fail_count = bh_assert_fail_count + 1;
@ -52,15 +52,17 @@ package bh_assert;
endtask
task bh_info(string description);
if (bh_assert_log_level >= BH_ASSERT_LOG_LEVEL_INFO) begin
// if (bh_assert_log_level >= BH_ASSERT_LOG_LEVEL_INFO) begin
$timeformat(-9, 2, " ns", 20);
$display("%t: INFO: %s", $time, description);
end
// end
endtask
task bh_warn(string description);
if (bh_assert_log_level >= BH_ASSERT_LOG_LEVEL_WARN) begin
// if (bh_assert_log_level >= BH_ASSERT_LOG_LEVEL_WARN) begin
$timeformat(-9, 2, " ns", 20);
$display("%t: %sWARN%s: %s", $time, COLOR_YELLOW, COLOR_NORMAL, description);
end
// end
bh_assert_warn_count = bh_assert_warn_count + 1;
endtask