From 3f2ec0499f1306afeeadfca8cff0e87d670b0c44 Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 3 May 2022 03:45:41 -0700 Subject: [PATCH] Rewriting sram1p1rw to combine CacheData into a single always_ff. Extra bits are still giving warning on VLSI that don't make sense. --- pipelined/src/cache/sram1p1rw.sv | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pipelined/src/cache/sram1p1rw.sv b/pipelined/src/cache/sram1p1rw.sv index 94ec7ce80..edd6722ec 100644 --- a/pipelined/src/cache/sram1p1rw.sv +++ b/pipelined/src/cache/sram1p1rw.sv @@ -45,6 +45,9 @@ module sram1p1rw #(parameter DEPTH=128, WIDTH=256) ( logic [$clog2(DEPTH)-1:0] AdrD; logic WriteEnableD; + localparam WM8 = WIDTH%8; + + always_ff @(posedge clk) AdrD <= Adr; integer index; @@ -62,20 +65,26 @@ module sram1p1rw #(parameter DEPTH=128, WIDTH=256) ( if (WriteEnable) begin for(index = 0; index < WIDTH/8; index++) begin if(ByteMask[index]) begin - StoredData[Adr][index*8 +: 8] <= #1 CacheWriteData[index*8 +: 8]; + StoredData[Adr][index*8 +: 8] <= #1 CacheWriteData[index*8 +: 8]; end end + if (WM8 > 0) begin + if (ByteMask[WIDTH/8]) begin + StoredData[Adr][WIDTH-1:WIDTH-WM8] <= #1 + CacheWriteData[WIDTH-1:WIDTH-WM8]; + end + end end end - // if not a multiple of 8, MSByte is not 8 bits long. +/* // if not a multiple of 8, MSByte is not 8 bits long. if(WIDTH%8 != 0) begin always_ff @(posedge clk) begin if (WriteEnable & ByteMask[WIDTH/8]) begin StoredData[Adr][WIDTH-1:WIDTH-WIDTH%8] <= #1 CacheWriteData[WIDTH-1:WIDTH-WIDTH%8]; end end - end + end */ assign ReadData = StoredData[AdrD]; endmodule