//////////////////////////////////////////////////////////////////////////// // _____ // / _______ Copyright (C) 2013-2022 Efinix Inc. All rights reserved. // / / \ // / / .. / tb_top.v // / / .' / // __/ /.' / Description: // __ \ / // /_/ /\ \_____/ / // ____/ \_______/ // // ******************************* // Revisions: // 0.0 Initial rev // // ******************************* module bram_wrapper_mwm #( //parameter FAMILY = 0, //0:Trion, 1:Titanium //Trion and Titanium parameters parameter WCLK_POLARITY = 1'b1, //wclk polarity, 0:falling edge, 1:rising edge parameter WCLKE_POLARITY = 1'b1, //wclke polarity, 0:active low, 1:active high parameter WE_POLARITY = 1'b1, //we polarity, 0:active low, 1:active high parameter WRITE_MODE = "READ_FIRST",//write mode, "READ_FIRST" :Old memory content is read. (default) // "WRITE_FIRST" :Write data is passed to the read port. // "READ_UNKNOWN": Read and writes are unsynchronized, therefore, the results of the address can conflict. parameter RCLK_POLARITY = 1'b1, // rclk polarity, 0:falling edge, 1:rising edge parameter RE_POLARITY = 1'b1, // re polarity, 0:active low , 1:active high parameter OUTPUT_REG = 1'b0, // Output register enable, 1:add pipe-line read register parameter BYTEEN_POLARITY = 1'b1, // byteen polarity 0:active low, 1:active high //Titanium extra paramters parameter RST_POLARITY = 1'b1, // rst polarity parameter RESET_RAM = "ASYNC", // reset mode on ram, "NONE": RST signals does not affect the RAM output. // "ASYNC": RAM output resets asynchronously to RCLK. // "SYNC": RAM output resets synchronously to RCLK. parameter RESET_OUTREG = "ASYNC", // reset mode on output register // "NONE": RST signals does not affect the RAM output register // "ASYNC": RAM output register resets asynchronously to RCLK. parameter WADDREN_POLARITY = 1'b1, // waddren polarity parameter RADDREN_POLARITY = 1'b1 // raddren polarity ) ( //Trion and Titanium ports wclk, // Write clock input wclke, // Write clock-enable input byteen, // Byteen input we, // Write-enable input waddr, // Write address input wdata, // Write data input rclk, // Read clock input re, // Read-enable input raddr, // Read address input rdata, // Read data output //Titanium extra ports reset, // reset waddren, // write address enable raddren // read address enable ); `include "bram_decompose.vh" //`include "bram_feature.vh" input wclk; input wclke; input we; input [BYTEEN_WIDTH-1:0] byteen; input [ADDR_WIDTH_A-1:0 ] waddr; input [DATA_WIDTH_A-1:0 ] wdata; input rclk; input re; input [ADDR_WIDTH_B-1:0 ] raddr; output [DATA_WIDTH_B-1:0 ]rdata; input reset; input waddren; input raddren; wire [ADDR_WIDTH_A-1:0 ] w_waddr_map; wire [DATA_WIDTH_A-1:0 ] w_wdata_map; wire [ADDR_WIDTH_B-1:0 ] w_raddr_map; wire [DATA_WIDTH_B-1:0 ] w_rdata_map; function integer get_current_row_index; input integer row;//Mode type integer x; begin get_current_row_index = 0; for (x=0; x1) begin assign w_we[1] = ((we == WE_POLARITY) & wen_decode[WRSEL_INDEX] & (byteen[BYTEEN_INDEX] == BYTEEN_POLARITY) ) ? WE_POLARITY: !WE_POLARITY; end bram_primitive #( .FAMILY(FAMILY), //0:Trion, 1:Titanium //Trion and Titanium parameters .WRITE_WIDTH(WDATA_WIDTH_ROW), .WCLK_POLARITY(WCLK_POLARITY), .WCLKE_POLARITY(WCLKE_POLARITY), .WE_POLARITY(WE_POLARITY), .WRITE_MODE(WRITE_MODE), .READ_WIDTH(RDATA_WIDTH_ROW), .RCLK_POLARITY(RCLK_POLARITY), .RE_POLARITY(RE_POLARITY), .OUTPUT_REG(OUTPUT_REG), //Titanium extra paramters .RST_POLARITY(RST_POLARITY), .RESET_RAM(RESET_RAM), .RESET_OUTREG(RESET_OUTREG), .WADDREN_POLARITY(WADDREN_POLARITY), .RADDREN_POLARITY(RADDREN_POLARITY), .WEN_WIDTH(WEN_WIDTH_ROW), .ini_index(DATA_MAP_INDEX) ) bram ( //Trion and Titanium ports .WCLK(wclk), // Write clock input .WCLKE(wclke), // Write clock-enable input .WE(w_we), // Write-enable input .WADDR(w_waddr), // Write address input .WDATA(w_wdata), // Write data input .RCLK(rclk), // Read clock input .RE(re), // Read-enable input .RADDR(w_raddr), // Read address input .RDATA(w_rdata), // Read data output //Titanium extra ports .RST(reset), // reset .WADDREN(waddren), // write address enable .RADDREN(raddren) // read address enable ); end end end else if (bram_table_loop_mode == 1 ) begin:scan_row for (gen_y=0; gen_y1) begin assign w_we[1] = ((we == WE_POLARITY) & wen_decode[WRSEL_INDEX] & (byteen[BYTEEN_INDEX] == BYTEEN_POLARITY)) ? WE_POLARITY: !WE_POLARITY;; end bram_primitive #( .FAMILY(FAMILY), //0:Trion, 1:Titanium //Trion and Titanium parameters .WRITE_WIDTH(WDATA_WIDTH_ROW), .WCLK_POLARITY(WCLK_POLARITY), .WCLKE_POLARITY(WCLKE_POLARITY), .WE_POLARITY(WE_POLARITY), .WRITE_MODE(WRITE_MODE), .READ_WIDTH(RDATA_WIDTH_ROW), .RCLK_POLARITY(RCLK_POLARITY), .RE_POLARITY(RE_POLARITY), .OUTPUT_REG(OUTPUT_REG), //Titanium extra paramters .RST_POLARITY(RST_POLARITY), .RESET_RAM(RESET_RAM), .RESET_OUTREG(RESET_OUTREG), .WADDREN_POLARITY(WADDREN_POLARITY), .RADDREN_POLARITY(RADDREN_POLARITY), .WEN_WIDTH(WEN_WIDTH_ROW), .ini_index(DATA_MAP_INDEX) ) bram ( //Trion and Titanium ports .WCLK(wclk), // Write clock input .WCLKE(wclke), // Write clock-enable input .WE(w_we), // Write-enable input .WADDR(w_waddr), // Write address input .WDATA(w_wdata), // Write data input .RCLK(rclk), // Read clock input .RE(re), // Read-enable input .RADDR(w_raddr), // Read address input .RDATA(w_rdata), // Read data output //Titanium extra ports .RST(reset), // reset .WADDREN(waddren), // write address enable .RADDREN(raddren) // read address enable ); end end end endgenerate endmodule