Skip to content

Commit

Permalink
hw: Clean up snitch_regfile_ff
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Jul 3, 2024
1 parent 8a105b1 commit 94d6060
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions hw/snitch/src/snitch_regfile_ff.sv
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// SPDX-License-Identifier: SHL-0.51

// Author: Florian Zaruba <[email protected]>

`include "common_cells/registers.svh"

// Description: Variable Register File
// verilog_lint: waive module-filename
module snitch_regfile #(
Expand Down Expand Up @@ -30,29 +33,13 @@ module snitch_regfile #(
logic [NR_WRITE_PORTS-1:0][NumWords-1:0] we_dec;


always_comb begin : we_decoder
for (int unsigned j = 0; j < NR_WRITE_PORTS; j++) begin
for (int unsigned i = 0; i < NumWords; i++) begin
if (waddr_i[j] == i) we_dec[j][i] = we_i[j];
else we_dec[j][i] = 1'b0;
end
end
end

// loop from 1 to NumWords-1 as R0 is nil
always_ff @(posedge clk_i, negedge rst_ni) begin : register_write_behavioral
for (int unsigned j = 0; j < NR_WRITE_PORTS; j++) begin
for (int unsigned i = 0; i < NumWords; i++) begin
if (~rst_ni) begin
mem[i] <= '0;
end else begin
if (we_dec[j][i]) begin
mem[i] <= wdata_i[j];
end
end
end
if (ZERO_REG_ZERO) begin
mem[0] <= '0;
for (genvar j = 0; j < NR_WRITE_PORTS; j++) begin : gen_write_port
for (genvar i = 0; i < NumWords; i++) begin : gen_we_dec
assign we_dec[j][i] = (i == waddr_i[j]) ? we_i[j] : 1'b0;
if (i == 0 && ZERO_REG_ZERO) begin

Check warning on line 39 in hw/snitch/src/snitch_regfile_ff.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/snitch/src/snitch_regfile_ff.sv#L39

All generate block statements must have a label [Style: generate-statements] [generate-label]
Raw output
message:"All generate block statements must have a label [Style: generate-statements] [generate-label]" location:{path:"./hw/snitch/src/snitch_regfile_ff.sv" range:{start:{line:39 column:36}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
assign mem[0] = '0;
end else begin

Check warning on line 41 in hw/snitch/src/snitch_regfile_ff.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/snitch/src/snitch_regfile_ff.sv#L41

All generate block statements must have a label [Style: generate-statements] [generate-label]
Raw output
message:"All generate block statements must have a label [Style: generate-statements] [generate-label]" location:{path:"./hw/snitch/src/snitch_regfile_ff.sv" range:{start:{line:41 column:16}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
`FFL(mem[i], wdata[i], we_dec[j][i], '0, clk_i, rst_ni)
end
end
end
Expand Down

0 comments on commit 94d6060

Please sign in to comment.