From cf1e458ccfdc8e8486f6cf29bde574db85202dd0 Mon Sep 17 00:00:00 2001 From: David Harris Date: Wed, 25 Aug 2021 06:46:41 -0400 Subject: [PATCH] simplified or_rows generation and renamed oneHotDecoder to onehotdecoder --- wally-pipelined/src/cache/cacheLRU.sv | 8 ++++---- wally-pipelined/src/cache/dcache.sv | 4 ++-- .../src/generic/{oneHotDecoder.sv => onehotdecoder.sv} | 2 +- wally-pipelined/src/generic/or_rows.sv | 7 +++++++ 4 files changed, 14 insertions(+), 7 deletions(-) rename wally-pipelined/src/generic/{oneHotDecoder.sv => onehotdecoder.sv} (98%) diff --git a/wally-pipelined/src/cache/cacheLRU.sv b/wally-pipelined/src/cache/cacheLRU.sv index 8228e50d9..e40deddc0 100644 --- a/wally-pipelined/src/cache/cacheLRU.sv +++ b/wally-pipelined/src/cache/cacheLRU.sv @@ -67,8 +67,8 @@ module cacheLRU assign EncVicWay[1] = LRUIn[2]; assign EncVicWay[0] = LRUIn[2] ? LRUIn[0] : LRUIn[1]; - oneHotDecoder #(2) - oneHotDecoder(.bin(EncVicWay), + onehotdecoder #(2) + waydec(.bin(EncVicWay), .decoded({VictimWay[0], VictimWay[1], VictimWay[2], VictimWay[3]})); end else if (NUMWAYS == 8) begin : EightWay @@ -100,8 +100,8 @@ module cacheLRU LRUIn[2] ? LRUIn[1] : LRUIn[0]; - oneHotDecoder #(3) - oneHotDecoder(.bin(EncVicWay), + onehotdecoder #(3) + waydec(.bin(EncVicWay), .decoded({VictimWay[0], VictimWay[1], VictimWay[2], VictimWay[3], VictimWay[4], VictimWay[5], VictimWay[6], VictimWay[7]})); end diff --git a/wally-pipelined/src/cache/dcache.sv b/wally-pipelined/src/cache/dcache.sv index d1dd34d75..682a8be77 100644 --- a/wally-pipelined/src/cache/dcache.sv +++ b/wally-pipelined/src/cache/dcache.sv @@ -197,8 +197,8 @@ module dcache .y(SRAMAdr)); - oneHotDecoder #(LOGWPL) - oneHotDecoder(.bin(MemPAdrM[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), + onehotdecoder #(LOGWPL) + adrdec(.bin(MemPAdrM[LOGWPL+LOGXLENBYTES-1:LOGXLENBYTES]), .decoded(MemPAdrDecodedW)); diff --git a/wally-pipelined/src/generic/oneHotDecoder.sv b/wally-pipelined/src/generic/onehotdecoder.sv similarity index 98% rename from wally-pipelined/src/generic/oneHotDecoder.sv rename to wally-pipelined/src/generic/onehotdecoder.sv index 08bd2e01c..b77bdc644 100644 --- a/wally-pipelined/src/generic/oneHotDecoder.sv +++ b/wally-pipelined/src/generic/onehotdecoder.sv @@ -25,7 +25,7 @@ `include "wally-config.vh" -module oneHotDecoder +module onehotdecoder #(parameter WIDTH = 2) (input logic [WIDTH-1:0] bin, output logic [2**WIDTH-1:0] decoded diff --git a/wally-pipelined/src/generic/or_rows.sv b/wally-pipelined/src/generic/or_rows.sv index 4ea1dba75..4c74f62e9 100644 --- a/wally-pipelined/src/generic/or_rows.sv +++ b/wally-pipelined/src/generic/or_rows.sv @@ -36,12 +36,19 @@ module or_rows #(parameter ROWS = 8, COLS=2) ( logic [COLS-1:0] mid[ROWS-1:0]; genvar row, col; generate + assign mid[1] = a[0] | a[1]; + for (row=2; row < ROWS; row++) + assign mid[row] = mid[row-1] | a[row]; + assign y = mid[ROWS-1]; + + /* for (col = 0; col < COLS; col++) begin assign mid[1][col] = a[0][col] | a[1][col]; for (row=2; row < ROWS; row++) assign mid[row][col] = mid[row-1][col] | a[row][col]; assign y[col] = mid[ROWS-1][col]; end + */ endgenerate endmodule