mirror of
https://gitlab.com/brendanhaines/cpu.git
synced 2024-12-26 11:06:50 -07:00
Log levels are great but need more than one bit. oops
This commit is contained in:
parent
d3844129d3
commit
e264602c1b
|
@ -10,7 +10,7 @@ package bh_assert;
|
||||||
localparam BH_ASSERT_LOG_LEVEL_WARN = 2;
|
localparam BH_ASSERT_LOG_LEVEL_WARN = 2;
|
||||||
localparam BH_ASSERT_LOG_LEVEL_INFO = 3;
|
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_RED = "\033[31m";
|
||||||
localparam COLOR_YELLOW = "\033[33m";
|
localparam COLOR_YELLOW = "\033[33m";
|
||||||
|
@ -52,17 +52,17 @@ package bh_assert;
|
||||||
endtask
|
endtask
|
||||||
|
|
||||||
task bh_info(string description);
|
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);
|
$timeformat(-9, 2, " ns", 20);
|
||||||
$display("%t: INFO: %s", $time, description);
|
$display("%t: INFO: %s", $time, description);
|
||||||
// end
|
end
|
||||||
endtask
|
endtask
|
||||||
|
|
||||||
task bh_warn(string description);
|
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);
|
$timeformat(-9, 2, " ns", 20);
|
||||||
$display("%t: %sWARN%s: %s", $time, COLOR_YELLOW, COLOR_NORMAL, description);
|
$display("%t: %sWARN%s: %s", $time, COLOR_YELLOW, COLOR_NORMAL, description);
|
||||||
// end
|
end
|
||||||
bh_assert_warn_count = bh_assert_warn_count + 1;
|
bh_assert_warn_count = bh_assert_warn_count + 1;
|
||||||
endtask
|
endtask
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user