`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company:CZ123 MSXBO www.osrc.cn // Engineer: tjy // Create Date: 2019/04/02 12:39:25 // Design Name: // Module Name: fdma_top // Project Name: AXI_FDMA // Target Devices: // Tool Versions: VIVADO // Description: test DDR // Dependencies: // Revision: // Revision 0.01 - File Created // Additional Comments: ////////////////////////////////////////////////////////////////////////////////// module fdma_top( inout [14:0]DDR_addr, inout [2:0]DDR_ba, inout DDR_cas_n, inout DDR_ck_n, inout DDR_ck_p, inout DDR_cke, inout DDR_cs_n, inout [3:0]DDR_dm, inout [31:0]DDR_dq, inout [3:0]DDR_dqs_n, inout [3:0]DDR_dqs_p, inout DDR_odt, inout DDR_ras_n, inout DDR_reset_n, inout DDR_we_n, inout FIXED_IO_ddr_vrn, inout FIXED_IO_ddr_vrp, inout [53:0]FIXED_IO_mio, inout FIXED_IO_ps_clk, inout FIXED_IO_ps_porb, inout FIXED_IO_ps_srstb ); wire [0:0]ui_rstn; wire ui_clk; //-----------------fmda signals-------------------------------------- wire [31:0] pkg_wr_addr; (*mark_debug = "true"*) wire [31:0] pkg_wr_data; (*mark_debug = "true"*) (* KEEP = "TRUE" *) reg pkg_wr_areq; (*mark_debug = "true"*) wire pkg_wr_en; (*mark_debug = "true"*) wire pkg_wr_last; wire [31:0] pkg_wr_size; wire [31:0] pkg_rd_addr; (*mark_debug = "true"*) wire [31:0] pkg_rd_data; (*mark_debug = "true"*) (* KEEP = "TRUE" *) reg pkg_rd_areq; (*mark_debug = "true"*) wire pkg_rd_en; (*mark_debug = "true"*) wire pkg_rd_last; wire [31:0] pkg_rd_size; //--------------------------------------------------------------------- reg [31:0]pkg_wr_cnt; (*mark_debug = "true"*) (* KEEP = "TRUE" *) reg [31:0]pkg_rd_cnt; (*mark_debug = "true"*) (* KEEP = "TRUE" *) reg [1:0] T_S; reg [31:0] pkg_addr; parameter WRITE1 = 0; parameter WRITE2 = 1; parameter READ1 = 2; parameter READ2 = 3; //----------------- assign pkg_wr_size = 1024; assign pkg_rd_size = 1024; assign pkg_wr_data = pkg_wr_cnt; (*mark_debug = "true"*) wire test_error; assign test_error = (pkg_rd_en && (pkg_rd_cnt != pkg_rd_data)); parameter DDR_BASE = (10*1024*1024); assign pkg_wr_addr = pkg_addr+ DDR_BASE; assign pkg_rd_addr = pkg_addr+ DDR_BASE; always @(posedge ui_clk) begin if(!ui_rstn)begin T_S <=0; pkg_wr_areq <= 1'b0; pkg_rd_areq <= 1'b0; pkg_wr_cnt<=0; pkg_rd_cnt<=0; pkg_addr<=0; end else begin case(T_S) WRITE1:begin if(pkg_addr>=32'd536870911) pkg_addr<=0; pkg_wr_areq <= 1'b1; T_S <= WRITE2; end WRITE2:begin pkg_wr_areq <= 1'b0; if(pkg_wr_last) begin T_S <= READ1; pkg_wr_cnt <= 32'd0; end else if(pkg_wr_en) begin pkg_wr_cnt <= pkg_wr_cnt + 1'b1; end end READ1:begin pkg_rd_areq <= 1'b1; T_S <= READ2; end READ2:begin pkg_rd_areq <= 1'b0; if(pkg_rd_last) begin T_S <= WRITE1; pkg_addr <= pkg_addr + 4096; pkg_rd_cnt <= 32'd0; end else if(pkg_rd_en) begin pkg_rd_cnt <= pkg_rd_cnt + 1'b1; end end endcase end end system system_i (.DDR_addr(DDR_addr), .DDR_ba(DDR_ba), .DDR_cas_n(DDR_cas_n), .DDR_ck_n(DDR_ck_n), .DDR_ck_p(DDR_ck_p), .DDR_cke(DDR_cke), .DDR_cs_n(DDR_cs_n), .DDR_dm(DDR_dm), .DDR_dq(DDR_dq), .DDR_dqs_n(DDR_dqs_n), .DDR_dqs_p(DDR_dqs_p), .DDR_odt(DDR_odt), .DDR_ras_n(DDR_ras_n), .DDR_reset_n(DDR_reset_n), .DDR_we_n(DDR_we_n), .FIXED_IO_ddr_vrn(FIXED_IO_ddr_vrn), .FIXED_IO_ddr_vrp(FIXED_IO_ddr_vrp), .FIXED_IO_mio(FIXED_IO_mio), .FIXED_IO_ps_clk(FIXED_IO_ps_clk), .FIXED_IO_ps_porb(FIXED_IO_ps_porb), .FIXED_IO_ps_srstb(FIXED_IO_ps_srstb), .pkg_wr_addr(pkg_wr_addr), .pkg_wr_data(pkg_wr_data), .pkg_wr_areq(pkg_wr_areq), .pkg_wr_en (pkg_wr_en), .pkg_wr_last(pkg_wr_last), .pkg_wr_size(pkg_wr_size), .pkg_rd_addr(pkg_rd_addr), .pkg_rd_data(pkg_rd_data), .pkg_rd_areq(pkg_rd_areq), .pkg_rd_en (pkg_rd_en), .pkg_rd_last(pkg_rd_last), .pkg_rd_size(pkg_rd_size), .ui_clk(ui_clk), .fdma_rstn(ui_rstn) ); endmodule |