gatemate: Fix minor issues with `memory_libmap` (#3343)
authorPatrick Urban <patrick.urban@web.de>
Fri, 27 May 2022 21:35:26 +0000 (23:35 +0200)
committerGitHub <noreply@github.com>
Fri, 27 May 2022 21:35:26 +0000 (23:35 +0200)
techlibs/gatemate/brams.txt
techlibs/gatemate/brams_map.v

index a0b500060a7fb83eb368661766e5fc4e1869057a..be22856ac82f05697a65f5f956e66fbfba094d9d 100644 (file)
@@ -34,8 +34,10 @@ ram block $__CC_BRAM_TDP_ {
                }
                portoption "WR_MODE" "WRITE_THROUGH" {
                        rdwr new;
+                       wrtrans all new;
                }
                wrbe_separate;
+               optional_rw;
        }
 }
 
@@ -61,6 +63,7 @@ ram block $__CC_BRAM_SDP_ {
                }
                clock anyedge;
                clken;
+               optional;
        }
        port sw "W" {
                option "MODE" "20K" {
@@ -72,5 +75,6 @@ ram block $__CC_BRAM_SDP_ {
                clock anyedge;
                clken;
                wrbe_separate;
+               optional;
        }
 }
index 7023f5ef29e793b054b7960efe6d45b8f03c502b..171825f498774d156cea4242cf9900c02def4e71 100644 (file)
@@ -4,12 +4,16 @@ parameter INIT = 0;
 parameter OPTION_MODE = "20K";\r
 \r
 parameter PORT_A_CLK_POL = 1;\r
+parameter PORT_A_RD_USED = 1;\r
+parameter PORT_A_WR_USED = 1;\r
 parameter PORT_A_RD_WIDTH = 1;\r
 parameter PORT_A_WR_WIDTH = 1;\r
 parameter PORT_A_WR_BE_WIDTH = 1;\r
 parameter PORT_A_OPTION_WR_MODE = "NO_CHANGE";\r
 \r
 parameter PORT_B_CLK_POL = 1;\r
+parameter PORT_B_RD_USED = 1;\r
+parameter PORT_B_WR_USED = 1;\r
 parameter PORT_B_RD_WIDTH = 1;\r
 parameter PORT_B_WR_WIDTH = 1;\r
 parameter PORT_B_WR_BE_WIDTH = 1;\r
@@ -98,10 +102,10 @@ generate
                        .INIT_3D(INIT['h3d*320+:320]),\r
                        .INIT_3E(INIT['h3e*320+:320]),\r
                        .INIT_3F(INIT['h3f*320+:320]),\r
-                       .A_RD_WIDTH(PORT_A_RD_WIDTH),\r
-                       .A_WR_WIDTH(PORT_A_WR_WIDTH),\r
-                       .B_RD_WIDTH(PORT_B_RD_WIDTH),\r
-                       .B_WR_WIDTH(PORT_B_WR_WIDTH),\r
+                       .A_RD_WIDTH(PORT_A_RD_USED ? PORT_A_RD_WIDTH : 0),\r
+                       .A_WR_WIDTH(PORT_A_WR_USED ? PORT_A_WR_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_B_RD_USED ? PORT_B_RD_WIDTH : 0),\r
+                       .B_WR_WIDTH(PORT_B_WR_USED ? PORT_B_WR_WIDTH : 0),\r
                        .RAM_MODE("TDP"),\r
                        .A_WR_MODE(PORT_A_OPTION_WR_MODE),\r
                        .B_WR_MODE(PORT_B_OPTION_WR_MODE),\r
@@ -119,7 +123,7 @@ generate
                        .B_EN(PORT_B_CLK_EN),\r
                        .B_WE(PORT_B_WR_EN),\r
                        .B_BM(PORT_B_WR_BE),\r
-                       .B_DI(PORT_A_WR_DATA),\r
+                       .B_DI(PORT_B_WR_DATA),\r
                        .B_ADDR({PORT_B_ADDR[13:5], 1'b0, PORT_B_ADDR[4:0], 1'b0}),\r
                        .B_DO(PORT_B_RD_DATA),\r
                );\r
@@ -253,10 +257,10 @@ generate
                        .INIT_7D(INIT['h7d*320+:320]),\r
                        .INIT_7E(INIT['h7e*320+:320]),\r
                        .INIT_7F(INIT['h7f*320+:320]),\r
-                       .A_RD_WIDTH(PORT_A_RD_WIDTH),\r
-                       .A_WR_WIDTH(PORT_A_WR_WIDTH),\r
-                       .B_RD_WIDTH(PORT_B_RD_WIDTH),\r
-                       .B_WR_WIDTH(PORT_B_WR_WIDTH),\r
+                       .A_RD_WIDTH(PORT_A_RD_USED ? PORT_A_RD_WIDTH : 0),\r
+                       .A_WR_WIDTH(PORT_A_WR_USED ? PORT_A_WR_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_B_RD_USED ? PORT_B_RD_WIDTH : 0),\r
+                       .B_WR_WIDTH(PORT_B_WR_USED ? PORT_B_WR_WIDTH : 0),\r
                        .RAM_MODE("TDP"),\r
                        .A_WR_MODE(PORT_A_OPTION_WR_MODE),\r
                        .B_WR_MODE(PORT_B_OPTION_WR_MODE),\r
@@ -274,7 +278,7 @@ generate
                        .B_EN(PORT_B_CLK_EN),\r
                        .B_WE(PORT_B_WR_EN),\r
                        .B_BM(PORT_B_WR_BE),\r
-                       .B_DI(PORT_A_WR_DATA),\r
+                       .B_DI(PORT_B_WR_DATA),\r
                        .B_ADDR({PORT_B_ADDR[14:0], 1'b0}),\r
                        .B_DO(PORT_B_RD_DATA),\r
                );\r
@@ -409,10 +413,10 @@ generate
                        .INIT_7D(INIT['h7d*320+:320]),\r
                        .INIT_7E(INIT['h7e*320+:320]),\r
                        .INIT_7F(INIT['h7f*320+:320]),\r
-                       .A_RD_WIDTH(PORT_A_RD_WIDTH),\r
-                       .A_WR_WIDTH(PORT_A_WR_WIDTH),\r
-                       .B_RD_WIDTH(PORT_B_RD_WIDTH),\r
-                       .B_WR_WIDTH(PORT_B_WR_WIDTH),\r
+                       .A_RD_WIDTH(PORT_A_RD_USED ? PORT_A_RD_WIDTH : 0),\r
+                       .A_WR_WIDTH(PORT_A_WR_USED ? PORT_A_WR_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_B_RD_USED ? PORT_B_RD_WIDTH : 0),\r
+                       .B_WR_WIDTH(PORT_B_WR_USED ? PORT_B_WR_WIDTH : 0),\r
                        .RAM_MODE("TDP"),\r
                        .A_WR_MODE(PORT_A_OPTION_WR_MODE),\r
                        .B_WR_MODE(PORT_B_OPTION_WR_MODE),\r
@@ -432,7 +436,7 @@ generate
                        .B_EN(PORT_B_CLK_EN),\r
                        .B_WE(PORT_B_WR_EN),\r
                        .B_BM(PORT_B_WR_BE),\r
-                       .B_DI(PORT_A_WR_DATA),\r
+                       .B_DI(PORT_B_WR_DATA),\r
                        .B_ADDR({PORT_B_ADDR[14:0], PORT_B_ADDR[15]}),\r
                );\r
                CC_BRAM_40K #(\r
@@ -564,10 +568,10 @@ generate
                        .INIT_7D(INIT['hfd*320+:320]),\r
                        .INIT_7E(INIT['hfe*320+:320]),\r
                        .INIT_7F(INIT['hff*320+:320]),\r
-                       .A_RD_WIDTH(PORT_A_RD_WIDTH),\r
-                       .A_WR_WIDTH(PORT_A_WR_WIDTH),\r
-                       .B_RD_WIDTH(PORT_B_RD_WIDTH),\r
-                       .B_WR_WIDTH(PORT_B_WR_WIDTH),\r
+                       .A_RD_WIDTH(PORT_A_RD_USED ? PORT_A_RD_WIDTH : 0),\r
+                       .A_WR_WIDTH(PORT_A_WR_USED ? PORT_A_WR_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_B_RD_USED ? PORT_B_RD_WIDTH : 0),\r
+                       .B_WR_WIDTH(PORT_B_WR_USED ? PORT_B_WR_WIDTH : 0),\r
                        .RAM_MODE("TDP"),\r
                        .A_WR_MODE(PORT_A_OPTION_WR_MODE),\r
                        .B_WR_MODE(PORT_B_OPTION_WR_MODE),\r
@@ -588,7 +592,7 @@ generate
                        .B_EN(PORT_B_CLK_EN),\r
                        .B_WE(PORT_B_WR_EN),\r
                        .B_BM(PORT_B_WR_BE),\r
-                       .B_DI(PORT_A_WR_DATA),\r
+                       .B_DI(PORT_B_WR_DATA),\r
                        .B_DO(PORT_B_RD_DATA),\r
                        .B_ADDR({PORT_B_ADDR[14:0], PORT_B_ADDR[15]}),\r
                );\r
@@ -602,12 +606,15 @@ module $__CC_BRAM_SDP_(...);
 \r
 parameter INIT = 0;\r
 parameter OPTION_MODE = "20K";\r
+parameter OPTION_WR_MODE = "NO_CHANGE";\r
 \r
 parameter PORT_W_CLK_POL = 1;\r
+parameter PORT_W_USED = 1;\r
 parameter PORT_W_WIDTH = 40;\r
 parameter PORT_W_WR_BE_WIDTH = 40;\r
 \r
 parameter PORT_R_CLK_POL = 1;\r
+parameter PORT_R_USED = 1;\r
 parameter PORT_R_WIDTH = 40;\r
 \r
 input PORT_W_CLK;\r
@@ -690,12 +697,12 @@ generate
                        .INIT_3E(INIT['h3e*320+:320]),\r
                        .INIT_3F(INIT['h3f*320+:320]),\r
                        .A_RD_WIDTH(0),\r
-                       .A_WR_WIDTH(PORT_W_WIDTH),\r
-                       .B_RD_WIDTH(PORT_R_WIDTH),\r
+                       .A_WR_WIDTH(PORT_W_USED ? PORT_W_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_R_USED ? PORT_R_WIDTH : 0),\r
                        .B_WR_WIDTH(0),\r
                        .RAM_MODE("SDP"),\r
-                       .A_WR_MODE("NO_CHANGE"),\r
-                       .B_WR_MODE("NO_CHANGE"),\r
+                       .A_WR_MODE(OPTION_WR_MODE),\r
+                       .B_WR_MODE(OPTION_WR_MODE),\r
                        .A_CLK_INV(!PORT_W_CLK_POL),\r
                        .B_CLK_INV(!PORT_R_CLK_POL),\r
                ) _TECHMAP_REPLACE_ (\r
@@ -845,12 +852,12 @@ generate
                        .INIT_7E(INIT['h7e*320+:320]),\r
                        .INIT_7F(INIT['h7f*320+:320]),\r
                        .A_RD_WIDTH(0),\r
-                       .A_WR_WIDTH(PORT_W_WIDTH),\r
-                       .B_RD_WIDTH(PORT_R_WIDTH),\r
+                       .A_WR_WIDTH(PORT_W_USED ? PORT_W_WIDTH : 0),\r
+                       .B_RD_WIDTH(PORT_R_USED ? PORT_R_WIDTH : 0),\r
                        .B_WR_WIDTH(0),\r
                        .RAM_MODE("SDP"),\r
-                       .A_WR_MODE("NO_CHANGE"),\r
-                       .B_WR_MODE("NO_CHANGE"),\r
+                       .A_WR_MODE(OPTION_WR_MODE),\r
+                       .B_WR_MODE(OPTION_WR_MODE),\r
                        .A_CLK_INV(!PORT_W_CLK_POL),\r
                        .B_CLK_INV(!PORT_R_CLK_POL),\r
                ) _TECHMAP_REPLACE_ (\r