Skip to content

Commit

Permalink
Catch and report cross-lane accumulation overflow in simulation.
Browse files Browse the repository at this point in the history
  • Loading branch information
preusser committed May 15, 2024
1 parent 282af2c commit dc98558
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions finn-rtllib/mvu/mvu_8sx8u_dsp48.sv
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,15 @@ module mvu_8sx8u_dsp48 #(
// High Sideband Accumulation
logic signed [HI_WIDTH-1:0] Hi4 = 0;
always_ff @(posedge clk) begin
if(rst) Hi4 <= 0;
else if(en) Hi4 <= $signed(L[4]? 0 : Hi4) + $signed(tree[0]);
if(rst) Hi4 <= 0;
else if(en) begin
automatic logic signed [HI_WIDTH:0] h = $signed(L[4]? 0 : Hi4) + $signed(tree[0]);
assert(h[HI_WIDTH] == h[HI_WIDTH-1]) else begin
$error("%m: Accumulation overflow for ACCU_WIDTH=%0d", ACCU_WIDTH);
$stop;
end
Hi4 <= h;
end
end
assign hi4 = Hi4;
end : genHi
Expand Down

0 comments on commit dc98558

Please sign in to comment.