Skip to content

Commit

Permalink
set raw_config1 properly for NX_RAM
Browse files Browse the repository at this point in the history
  • Loading branch information
mmicko committed May 23, 2024
1 parent 7e21c3e commit a11d8fc
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion techlibs/nanoxplore/brams_map.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module $__NX_RAM_ (...);

parameter INIT = 0;
parameter OPTION_STD_MODE = "";
parameter OPTION_STD_MODE = "NOECC_24kx2";

parameter WIDTH = 24;
parameter PORT_A_CLK_POL = 1;
Expand All @@ -24,6 +24,35 @@ input [WIDTH-1:0] PORT_B_WR_DATA;
wire [24-1:0] B_DATA;
output [WIDTH-1:0] PORT_B_RD_DATA;

function [15:0] raw_config1_func;
begin
if (OPTION_STD_MODE == "NOECC_48kx1") begin
raw_config1_func = 16'b0000000000000000;
end
else if (OPTION_STD_MODE == "NOECC_24kx2") begin
raw_config1_func = 16'b0000001001001001;
end
else if (OPTION_STD_MODE == "NOECC_16kx3") begin
raw_config1_func = 16'b0000111111111111;
end
else if (OPTION_STD_MODE == "NOECC_12kx4") begin
raw_config1_func = 16'b0000010010010010;
end
else if (OPTION_STD_MODE == "NOECC_8kx6") begin
raw_config1_func = 16'b0000110110110110;
end
else if (OPTION_STD_MODE == "NOECC_6kx8") begin
raw_config1_func = 16'b0000011011011011;
end
else if (OPTION_STD_MODE == "NOECC_4kx12") begin
raw_config1_func = 16'b0000100100100100;
end
else if (OPTION_STD_MODE == "NOECC_2kx24") begin
raw_config1_func = 16'b0000101101101101;
end
end
endfunction

generate
if (OPTION_STD_MODE == "NOECC_48kx1") begin
assign A_DATA = {24{PORT_A_WR_DATA[WIDTH-1:0]}};
Expand Down Expand Up @@ -57,12 +86,19 @@ generate
assign A_DATA = PORT_A_WR_DATA;
assign B_DATA = PORT_B_WR_DATA;
end
else
$error("Unknown NX_RAM mode");
endgenerate

NX_RAM_WRAP #(
.std_mode(OPTION_STD_MODE),
.mcka_edge(PORT_A_CLK_POL == 1 ? 1'b0 : 1'b1),
.mckb_edge(PORT_B_CLK_POL == 1 ? 1'b0 : 1'b1),
.pcka_edge(PORT_A_CLK_POL == 1 ? 1'b0 : 1'b1),
.pckb_edge(PORT_B_CLK_POL == 1 ? 1'b0 : 1'b1),
.raw_config0(4'b0000),
.raw_config1(raw_config1_func()),
.mem_ctxt("")
) _TECHMAP_REPLACE_ (
.ACK(PORT_A_CLK),
//.ACKS(PORT_A_CLK),
Expand Down

0 comments on commit a11d8fc

Please sign in to comment.