Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial fix for X-issue #766 #416

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 14 additions & 8 deletions rtl/cv32e40s_csr.sv
Expand Up @@ -71,15 +71,21 @@ module cv32e40s_csr #(
end

end else begin : gen_unhardened

always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
rdata_q <= RESETVALUE & MASK;
end else if (wr_en_i) begin
rdata_q <= wr_data_i & MASK;
for (genvar i = 0; i < WIDTH; i++) begin : gen_csr
if (MASK[i]) begin : gen_unmasked
// Bits with mask set are actual flipflops
always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
rdata_q[i] <= RESETVALUE[i];
end else if (wr_en_i) begin
rdata_q[i] <= wr_data_i[i];
end
end
end else begin : gen_masked
// Bits with mask cleared are tied off to the reset value
assign rdata_q[i] = RESETVALUE[i];
end
end

end // for
assign rd_error_o = 1'b0;
end
endgenerate
Expand Down