cache module

This commit is contained in:
Core_kingdom
2025-08-26 16:53:22 +08:00
commit 79dee10db1
124 changed files with 13283 additions and 0 deletions

27
rtl/data_cache/rst_sync.v Normal file
View File

@@ -0,0 +1,27 @@
module rst_sync #(
parameter SYNC_STAGE = 2 // 同步级数推荐2级
) (
input wire clk,
input wire rst_n_in,
output reg rst_n_out
);
reg [SYNC_STAGE-1:0] rst_sync_reg;
always @(posedge clk or negedge rst_n_in) begin
if (!rst_n_in) begin
rst_sync_reg <= {SYNC_STAGE{1'b0}};
end else begin
rst_sync_reg <= {rst_sync_reg[SYNC_STAGE-2:0], 1'b1};
end
end
always @(posedge clk or negedge rst_n_in) begin
if (!rst_n_in) begin
rst_n_out <= 1'b0;
end else begin
rst_n_out <= rst_sync_reg[SYNC_STAGE-1];
end
end
endmodule