mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Possible fix for critical path timing in caches.
This commit is contained in:
parent
14e6d2c576
commit
694b3fbb6f
42
wally-pipelined/src/cache/sram1rw.sv
vendored
42
wally-pipelined/src/cache/sram1rw.sv
vendored
@ -1,6 +1,7 @@
|
|||||||
|
/* -----\/----- EXCLUDED -----\/-----
|
||||||
// Depth is number of bits in one "word" of the memory, width is number of such words
|
// Depth is number of bits in one "word" of the memory, width is number of such words
|
||||||
|
|
||||||
/* verilator lint_off ASSIGNDLY */
|
/-* verilator lint_off ASSIGNDLY *-/
|
||||||
|
|
||||||
module sram1rw #(parameter DEPTH=128, WIDTH=256) (
|
module sram1rw #(parameter DEPTH=128, WIDTH=256) (
|
||||||
input logic clk,
|
input logic clk,
|
||||||
@ -29,5 +30,44 @@ module sram1rw #(parameter DEPTH=128, WIDTH=256) (
|
|||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
/-* verilator lint_on ASSIGNDLY *-/
|
||||||
|
-----/\----- EXCLUDED -----/\----- */
|
||||||
|
|
||||||
|
|
||||||
|
// Depth is number of bits in one "word" of the memory, width is number of such words
|
||||||
|
|
||||||
|
/* verilator lint_off ASSIGNDLY */
|
||||||
|
|
||||||
|
module sram1rw #(parameter DEPTH=128, WIDTH=256) (
|
||||||
|
input logic clk,
|
||||||
|
// port 1 is read only
|
||||||
|
input logic [$clog2(WIDTH)-1:0] Addr,
|
||||||
|
output logic [DEPTH-1:0] ReadData,
|
||||||
|
|
||||||
|
// port 2 is write only
|
||||||
|
input logic [DEPTH-1:0] WriteData,
|
||||||
|
input logic WriteEnable
|
||||||
|
);
|
||||||
|
|
||||||
|
logic [WIDTH-1:0][DEPTH-1:0] StoredData;
|
||||||
|
logic [$clog2(WIDTH)-1:0] AddrD;
|
||||||
|
logic [WIDTH-1:0] WriteDataD;
|
||||||
|
logic WriteEnableD;
|
||||||
|
|
||||||
|
|
||||||
|
always_ff @(posedge clk) begin
|
||||||
|
AddrD <= Addr;
|
||||||
|
WriteDataD <= WriteData;
|
||||||
|
WriteEnableD <= WriteEnable;
|
||||||
|
if (WriteEnableD) begin
|
||||||
|
StoredData[AddrD] <= #1 WriteDataD;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
assign ReadData = StoredData[AddrD];
|
||||||
|
|
||||||
|
endmodule
|
||||||
|
|
||||||
/* verilator lint_on ASSIGNDLY */
|
/* verilator lint_on ASSIGNDLY */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user