Skip to content

Commit

Permalink
fix wrong error reporting:
Browse files Browse the repository at this point in the history
- with single line if (...) `log_*
  • Loading branch information
LudwigCRON committed May 31, 2020
1 parent 019a98e commit d22f3c5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions digital/packages/log.svh
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,29 @@ endmodule
begin log_service.WARN_COUNT += 1; \
$write("%c[1;33m",27); \
$display("Warning : [%t] %s", $time, msg); \
#1 $write("%c[0m",27); end
$write("%c[0m",27); end

`define log_Error(msg) \
begin log_service.ERROR_COUNT += 1; \
$write("%c[1;31m",27); \
$display("Error : [%t] %s", $time, msg); \
#1 $write("%c[0m",27); end
$write("%c[0m",27); end

`define log_Fatal(msg) \
begin $write("%c[1;31m",27); \
$display("Fatal : [%t] %s", $time, msg); \
$write("%c[0m",27); \
$finish; end

// use $sformat for compatibility since $sformat is
// use $sformat for compatibility since $sformatf is
// not always supported
`define log_InfoF(template, a) $sformat(log_service.__xstr__, template, a);`log_Info(log_service.__xstr__);
`define log_NoteF(template, a) $sformat(log_service.__xstr__, template, a);`log_Note(log_service.__xstr__);
`define log_WarningF(template, a) $sformat(log_service.__xstr__, template, a);`log_Warning(log_service.__xstr__);
`define log_ErrorF(template, a) $sformat(log_service.__xstr__, template, a);`log_Error(log_service.__xstr__);

`define log_Terminate \
$write("%c[1;37m",27); \
begin $write("%c[1;37m",27); \
if(log_service.ERROR_COUNT > 0 && log_service.WARN_COUNT > 0) \
$display("Simulation Failed with %0d Errors and %0d Warnings", log_service.ERROR_COUNT, log_service.WARN_COUNT); \
else if(log_service.ERROR_COUNT > 0) \
Expand All @@ -78,4 +78,4 @@ endmodule
else \
$display("Simulation Successful"); \
$write("%c[0m",27); \
$finish;
$finish; end

0 comments on commit d22f3c5

Please sign in to comment.