Skip to content

Commit 448e12f

Browse files
author
Alexander Repikov
committed
added_macro
1 parent 9084281 commit 448e12f

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

source_code/caches/sram/sram.sv

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,21 @@ module sram #(
4646
// input ME;
4747
// input CLK;
4848

49+
`define SRAM_PORTS .Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK)
50+
4951
generate
5052
if (SRAM_WR_SIZE == 64 && SRAM_HEIGHT == 128)
51-
cache_128x64 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
53+
cache_128x64 sram_cache(`SRAM_PORTS);
5254
else if (SRAM_WR_SIZE == 32 && SRAM_HEIGHT == 128)
53-
cache_128x32 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
55+
cache_128x32 sram_cache(`SRAM_PORTS);
5456
else if (SRAM_WR_SIZE == 26 && SRAM_HEIGHT == 128)
55-
cache_128x26 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
56-
if (SRAM_WR_SIZE == 64 && SRAM_HEIGHT == 64)
57-
cache_64x64 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
57+
cache_128x26 sram_cache(`SRAM_PORTS);
58+
else if (SRAM_WR_SIZE == 64 && SRAM_HEIGHT == 64)
59+
cache_64x64 sram_cache(`SRAM_PORTS);
5860
else if (SRAM_WR_SIZE == 32 && SRAM_HEIGHT == 64)
59-
cache_64x32 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
61+
cache_64x32 sram_cache(`SRAM_PORTS);
6062
else if (SRAM_WR_SIZE == 26 && SRAM_HEIGHT == 64)
61-
cache_64x26 sram_cache(.Q(rVal), .ADR(SEL), .D(wVal), .WEM(~wMask), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
63+
cache_64x26 sram_cache(`SRAM_PORTS);
6264
else
6365
cache_128x64 sram_cache(.Q(rVal[63:0]), .ADR(SEL[6:0]), .D(wVal[63:0]), .WEM(~wMask[63:0]), .WE(WEN), .OE(REN), .ME(WEN | REN), .CLK(CLK));
6466
endgenerate

0 commit comments

Comments
 (0)