Log levels are great but need more than one bit. oops

This commit is contained in:
Brendan Haines 2022-12-01 02:12:27 -07:00
parent d3844129d3
commit e264602c1b

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_INFO; // 0 = errors only, 1 = all assertions, 2 = warnings, 3 = info
int 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";
@ -52,17 +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