Skip to content

Commit

Permalink
Merge pull request #88 from os-fpga/no_fatal_in_always
Browse files Browse the repository at this point in the history
Cannot use  in always blocks
  • Loading branch information
alaindargelas authored Jul 15, 2024
2 parents 713583a + 13715fa commit 7f3ce3e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions sim_models/verilog/DSP19X2.v
Original file line number Diff line number Diff line change
Expand Up @@ -381,21 +381,21 @@ module DSP19X2 #(
always @(ACC_FIR)
if (ACC_FIR > 21)
begin
$fatal(1,"WARNING: DSP19x2 instance %m ACC_FIR input is %d which is greater than 21 which serves no function", ACC_FIR);
$display("WARNING: DSP19x2 instance %m ACC_FIR input is %d which is greater than 21 which serves no function", ACC_FIR);
end
// If SHIFT_RIGHT is greater than 31, result is invalid
always @(SHIFT_RIGHT)
if (SHIFT_RIGHT > 31)
begin
$fatal(1,"WARNING: DSP19x2 instance %m SHIFT_RIGHT input is %d which is greater than 31 which serves no function", SHIFT_RIGHT);
$display("WARNING: DSP19x2 instance %m SHIFT_RIGHT input is %d which is greater than 31 which serves no function", SHIFT_RIGHT);
end

always@(*)
begin
case(DSP_MODE)
"MULTIPLY_ACCUMULATE": begin
if(FEEDBACK>1)
$fatal(1,"\nWARNING: DSP19x2 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
$display("\nWARNING: DSP19x2 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
end
endcase

Expand Down
4 changes: 2 additions & 2 deletions sim_models/verilog/DSP38.v
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ module DSP38 #(
// If ACC_FIR is greater than 43, result is invalid
always @(ACC_FIR)
if (ACC_FIR > 43)
$fatal(1,"\nWARNING: DSP38 instance %m ACC_FIR input is %d which is greater than 43 which serves no function", ACC_FIR);
$display("\nWARNING: DSP38 instance %m ACC_FIR input is %d which is greater than 43 which serves no function", ACC_FIR);

always@(*)
begin
case(DSP_MODE)
"MULTIPLY_ACCUMULATE": begin
if(FEEDBACK>1)
$fatal(1,"\nWARNING: DSP38 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
$display("\nWARNING: DSP38 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
end
endcase

Expand Down
6 changes: 3 additions & 3 deletions sim_models_internal/verilog/DSP19X2.v
Original file line number Diff line number Diff line change
Expand Up @@ -381,21 +381,21 @@ module DSP19X2 #(
always @(ACC_FIR)
if (ACC_FIR > 21)
begin
$fatal(1,"WARNING: DSP19x2 instance %m ACC_FIR input is %d which is greater than 21 which serves no function", ACC_FIR);
$display("WARNING: DSP19x2 instance %m ACC_FIR input is %d which is greater than 21 which serves no function", ACC_FIR);
end
// If SHIFT_RIGHT is greater than 31, result is invalid
always @(SHIFT_RIGHT)
if (SHIFT_RIGHT > 31)
begin
$fatal(1,"WARNING: DSP19x2 instance %m SHIFT_RIGHT input is %d which is greater than 31 which serves no function", SHIFT_RIGHT);
$display("WARNING: DSP19x2 instance %m SHIFT_RIGHT input is %d which is greater than 31 which serves no function", SHIFT_RIGHT);
end

always@(*)
begin
case(DSP_MODE)
"MULTIPLY_ACCUMULATE": begin
if(FEEDBACK>1)
$fatal(1,"\nWARNING: DSP19x2 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
$display("\nWARNING: DSP19x2 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
end
endcase

Expand Down
4 changes: 2 additions & 2 deletions sim_models_internal/verilog/DSP38.v
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,14 @@ module DSP38 #(
// If ACC_FIR is greater than 43, result is invalid
always @(ACC_FIR)
if (ACC_FIR > 43)
$fatal(1,"\nWARNING: DSP38 instance %m ACC_FIR input is %d which is greater than 43 which serves no function", ACC_FIR);
$display("\nWARNING: DSP38 instance %m ACC_FIR input is %d which is greater than 43 which serves no function", ACC_FIR);

always@(*)
begin
case(DSP_MODE)
"MULTIPLY_ACCUMULATE": begin
if(FEEDBACK>1)
$fatal(1,"\nWARNING: DSP38 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
$display("\nWARNING: DSP38 instance %m has parameter DSP_MODE set to %s and FEEDBACK set to %0d. Valid values of FEEDBACK for this mode are 0,1 \n", DSP_MODE,FEEDBACK);
end
endcase

Expand Down

0 comments on commit 7f3ce3e

Please sign in to comment.