2014-03-06 16:16:02 +00:00
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
2017-05-17 08:44:52 +00:00
|
|
|
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
|
2015-08-19 11:11:47 +00:00
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// In this HDL repository, there are many different and unique modules, consisting
|
|
|
|
// of various HDL (Verilog or VHDL) components. The individual modules are
|
|
|
|
// developed independently, and may be accompanied by separate and unique license
|
|
|
|
// terms.
|
|
|
|
//
|
|
|
|
// The user should read each of these license terms, and understand the
|
2018-03-14 14:45:47 +00:00
|
|
|
// freedoms and responsibilities that he or she has by using this source/core.
|
2017-05-31 15:15:24 +00:00
|
|
|
//
|
|
|
|
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
|
2017-05-29 06:55:41 +00:00
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE.
|
2015-08-19 11:11:47 +00:00
|
|
|
//
|
2017-05-29 06:55:41 +00:00
|
|
|
// Redistribution and use of source or resulting binaries, with or without modification
|
|
|
|
// of this file, are permitted under one of the following two license terms:
|
2015-08-19 11:11:47 +00:00
|
|
|
//
|
2017-05-17 08:44:52 +00:00
|
|
|
// 1. The GNU General Public License version 2 as published by the
|
2017-05-31 15:15:24 +00:00
|
|
|
// Free Software Foundation, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_GPL2), and also online at:
|
|
|
|
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
|
2017-05-17 08:44:52 +00:00
|
|
|
//
|
|
|
|
// OR
|
|
|
|
//
|
2017-05-31 15:15:24 +00:00
|
|
|
// 2. An ADI specific BSD license, which can be found in the top level directory
|
|
|
|
// of this repository (LICENSE_ADIBSD), and also on-line at:
|
2017-05-29 06:55:41 +00:00
|
|
|
// https://github.com/analogdevicesinc/hdl/blob/master/LICENSE_ADIBSD
|
|
|
|
// This will allow to generate bit files and not release the source code,
|
|
|
|
// as long as it attaches to an ADI device.
|
2014-03-06 16:16:02 +00:00
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
2017-07-15 07:52:12 +00:00
|
|
|
module dmac_request_arb #(
|
|
|
|
parameter DMA_DATA_WIDTH_SRC = 64,
|
|
|
|
parameter DMA_DATA_WIDTH_DEST = 64,
|
|
|
|
parameter DMA_LENGTH_WIDTH = 24,
|
|
|
|
parameter BYTES_PER_BEAT_WIDTH_DEST = $clog2(DMA_DATA_WIDTH_DEST/8),
|
|
|
|
parameter BYTES_PER_BEAT_WIDTH_SRC = $clog2(DMA_DATA_WIDTH_SRC/8),
|
2018-04-06 08:57:02 +00:00
|
|
|
parameter DMA_TYPE_DEST = 0,
|
|
|
|
parameter DMA_TYPE_SRC = 2,
|
2017-07-15 07:52:12 +00:00
|
|
|
parameter DMA_AXI_ADDR_WIDTH = 32,
|
|
|
|
parameter ASYNC_CLK_REQ_SRC = 1,
|
|
|
|
parameter ASYNC_CLK_SRC_DEST = 1,
|
|
|
|
parameter ASYNC_CLK_DEST_REQ = 1,
|
|
|
|
parameter AXI_SLICE_DEST = 0,
|
|
|
|
parameter AXI_SLICE_SRC = 0,
|
|
|
|
parameter MAX_BYTES_PER_BURST = 128,
|
2018-05-29 09:04:34 +00:00
|
|
|
parameter FIFO_SIZE = 8,
|
2017-07-15 07:52:12 +00:00
|
|
|
parameter ID_WIDTH = $clog2(FIFO_SIZE*2),
|
2018-02-06 11:22:19 +00:00
|
|
|
parameter AXI_LENGTH_WIDTH_SRC = 8,
|
|
|
|
parameter AXI_LENGTH_WIDTH_DEST = 8)(
|
2017-07-15 07:52:12 +00:00
|
|
|
|
2017-09-21 14:02:44 +00:00
|
|
|
input req_clk,
|
|
|
|
input req_resetn,
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
input req_valid,
|
|
|
|
output req_ready,
|
2017-04-06 07:30:22 +00:00
|
|
|
input [DMA_AXI_ADDR_WIDTH-1:BYTES_PER_BEAT_WIDTH_DEST] req_dest_address,
|
|
|
|
input [DMA_AXI_ADDR_WIDTH-1:BYTES_PER_BEAT_WIDTH_SRC] req_src_address,
|
2016-10-01 15:13:42 +00:00
|
|
|
input [DMA_LENGTH_WIDTH-1:0] req_length,
|
2017-05-12 11:46:25 +00:00
|
|
|
input req_xlast,
|
2016-10-01 15:13:42 +00:00
|
|
|
input req_sync_transfer_start,
|
|
|
|
|
|
|
|
output reg eot,
|
|
|
|
|
|
|
|
// Master AXI interface
|
|
|
|
input m_dest_axi_aclk,
|
|
|
|
input m_dest_axi_aresetn,
|
|
|
|
input m_src_axi_aclk,
|
|
|
|
input m_src_axi_aresetn,
|
|
|
|
|
|
|
|
// Write address
|
2017-04-06 07:30:22 +00:00
|
|
|
output [DMA_AXI_ADDR_WIDTH-1:0] m_axi_awaddr,
|
2018-02-06 11:22:19 +00:00
|
|
|
output [AXI_LENGTH_WIDTH_DEST-1:0] m_axi_awlen,
|
2016-10-01 15:13:42 +00:00
|
|
|
output [ 2:0] m_axi_awsize,
|
|
|
|
output [ 1:0] m_axi_awburst,
|
|
|
|
output [ 2:0] m_axi_awprot,
|
|
|
|
output [ 3:0] m_axi_awcache,
|
|
|
|
output m_axi_awvalid,
|
|
|
|
input m_axi_awready,
|
|
|
|
|
|
|
|
// Write data
|
|
|
|
output [DMA_DATA_WIDTH_DEST-1:0] m_axi_wdata,
|
|
|
|
output [(DMA_DATA_WIDTH_DEST/8)-1:0] m_axi_wstrb,
|
2017-05-12 11:46:25 +00:00
|
|
|
input m_axi_wready,
|
|
|
|
output m_axi_wvalid,
|
|
|
|
output m_axi_wlast,
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
// Write response
|
|
|
|
input m_axi_bvalid,
|
|
|
|
input [ 1:0] m_axi_bresp,
|
|
|
|
output m_axi_bready,
|
|
|
|
|
|
|
|
// Read address
|
|
|
|
input m_axi_arready,
|
|
|
|
output m_axi_arvalid,
|
2017-04-06 07:30:22 +00:00
|
|
|
output [DMA_AXI_ADDR_WIDTH-1:0] m_axi_araddr,
|
2018-02-06 11:22:19 +00:00
|
|
|
output [AXI_LENGTH_WIDTH_SRC-1:0] m_axi_arlen,
|
2016-10-01 15:13:42 +00:00
|
|
|
output [ 2:0] m_axi_arsize,
|
|
|
|
output [ 1:0] m_axi_arburst,
|
|
|
|
output [ 2:0] m_axi_arprot,
|
|
|
|
output [ 3:0] m_axi_arcache,
|
|
|
|
|
|
|
|
// Read data and response
|
2017-05-12 11:46:25 +00:00
|
|
|
input [DMA_DATA_WIDTH_SRC-1:0] m_axi_rdata,
|
2016-10-01 15:13:42 +00:00
|
|
|
output m_axi_rready,
|
|
|
|
input m_axi_rvalid,
|
2017-09-08 09:12:44 +00:00
|
|
|
input m_axi_rlast,
|
2016-10-01 15:13:42 +00:00
|
|
|
input [ 1:0] m_axi_rresp,
|
|
|
|
|
|
|
|
// Slave streaming AXI interface
|
|
|
|
input s_axis_aclk,
|
|
|
|
output s_axis_ready,
|
|
|
|
input s_axis_valid,
|
2017-05-12 11:46:25 +00:00
|
|
|
input [DMA_DATA_WIDTH_SRC-1:0] s_axis_data,
|
2017-12-07 17:31:10 +00:00
|
|
|
input s_axis_last,
|
2016-10-01 15:13:42 +00:00
|
|
|
input [0:0] s_axis_user,
|
|
|
|
output s_axis_xfer_req,
|
|
|
|
|
|
|
|
// Master streaming AXI interface
|
|
|
|
input m_axis_aclk,
|
|
|
|
input m_axis_ready,
|
|
|
|
output m_axis_valid,
|
2017-05-12 11:46:25 +00:00
|
|
|
output [DMA_DATA_WIDTH_DEST-1:0] m_axis_data,
|
|
|
|
output m_axis_last,
|
|
|
|
output m_axis_xfer_req,
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
// Input FIFO interface
|
|
|
|
input fifo_wr_clk,
|
|
|
|
input fifo_wr_en,
|
2017-05-12 11:46:25 +00:00
|
|
|
input [DMA_DATA_WIDTH_SRC-1:0] fifo_wr_din,
|
2016-10-01 15:13:42 +00:00
|
|
|
output fifo_wr_overflow,
|
|
|
|
input fifo_wr_sync,
|
|
|
|
output fifo_wr_xfer_req,
|
|
|
|
|
|
|
|
// Input FIFO interface
|
|
|
|
input fifo_rd_clk,
|
|
|
|
input fifo_rd_en,
|
|
|
|
output fifo_rd_valid,
|
2017-05-12 11:46:25 +00:00
|
|
|
output [DMA_DATA_WIDTH_DEST-1:0] fifo_rd_dout,
|
2016-10-01 15:13:42 +00:00
|
|
|
output fifo_rd_underflow,
|
2017-05-12 11:46:25 +00:00
|
|
|
output fifo_rd_xfer_req,
|
|
|
|
|
|
|
|
output [ID_WIDTH-1:0] dbg_dest_request_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_dest_address_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_dest_data_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_dest_response_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_src_request_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_src_address_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_src_data_id,
|
|
|
|
output [ID_WIDTH-1:0] dbg_src_response_id,
|
2017-09-21 14:02:44 +00:00
|
|
|
|
|
|
|
input req_enable,
|
|
|
|
|
|
|
|
output dest_clk,
|
|
|
|
input dest_resetn,
|
|
|
|
output dest_ext_resetn,
|
|
|
|
input dest_enable,
|
|
|
|
output dest_enabled,
|
|
|
|
|
|
|
|
output src_clk,
|
|
|
|
input src_resetn,
|
|
|
|
output src_ext_resetn,
|
|
|
|
input src_enable,
|
|
|
|
output src_enabled
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
localparam DMA_TYPE_MM_AXI = 0;
|
|
|
|
localparam DMA_TYPE_STREAM_AXI = 1;
|
|
|
|
localparam DMA_TYPE_FIFO = 2;
|
|
|
|
|
2017-04-06 07:30:22 +00:00
|
|
|
localparam DMA_ADDRESS_WIDTH_DEST = DMA_AXI_ADDR_WIDTH - BYTES_PER_BEAT_WIDTH_DEST;
|
|
|
|
localparam DMA_ADDRESS_WIDTH_SRC = DMA_AXI_ADDR_WIDTH - BYTES_PER_BEAT_WIDTH_SRC;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2014-03-13 12:20:10 +00:00
|
|
|
// Bytes per burst is the same for both dest and src, but bytes per beat may
|
|
|
|
// differ, so beats per burst may also differ
|
2018-06-04 12:10:28 +00:00
|
|
|
localparam BYTES_PER_BURST_WIDTH =
|
|
|
|
MAX_BYTES_PER_BURST > 2048 ? 12 :
|
|
|
|
MAX_BYTES_PER_BURST > 1024 ? 11 :
|
|
|
|
MAX_BYTES_PER_BURST > 512 ? 10 :
|
|
|
|
MAX_BYTES_PER_BURST > 256 ? 9 :
|
|
|
|
MAX_BYTES_PER_BURST > 128 ? 8 :
|
|
|
|
MAX_BYTES_PER_BURST > 64 ? 7 :
|
|
|
|
MAX_BYTES_PER_BURST > 32 ? 6 :
|
|
|
|
MAX_BYTES_PER_BURST > 16 ? 5 :
|
|
|
|
MAX_BYTES_PER_BURST > 8 ? 4 :
|
|
|
|
MAX_BYTES_PER_BURST > 4 ? 3 :
|
|
|
|
MAX_BYTES_PER_BURST > 2 ? 2 : 1;
|
2015-08-19 11:11:47 +00:00
|
|
|
localparam BEATS_PER_BURST_WIDTH_SRC = BYTES_PER_BURST_WIDTH - BYTES_PER_BEAT_WIDTH_SRC;
|
|
|
|
localparam BEATS_PER_BURST_WIDTH_DEST = BYTES_PER_BURST_WIDTH - BYTES_PER_BEAT_WIDTH_DEST;
|
2014-03-13 12:20:10 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
localparam BURSTS_PER_TRANSFER_WIDTH = DMA_LENGTH_WIDTH - BYTES_PER_BURST_WIDTH;
|
2014-03-13 12:20:10 +00:00
|
|
|
|
2018-04-27 16:00:20 +00:00
|
|
|
reg eot_mem[0:2**ID_WIDTH-1];
|
2014-03-06 16:16:02 +00:00
|
|
|
wire request_eot;
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] request_id;
|
|
|
|
wire [ID_WIDTH-1:0] response_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire enabled_src;
|
|
|
|
wire enabled_dest;
|
|
|
|
|
2017-07-17 12:47:35 +00:00
|
|
|
wire req_gen_valid;
|
|
|
|
wire req_gen_ready;
|
2014-03-06 16:16:02 +00:00
|
|
|
wire req_dest_valid;
|
|
|
|
wire req_dest_ready;
|
|
|
|
wire req_src_valid;
|
|
|
|
wire req_src_ready;
|
|
|
|
|
|
|
|
wire dest_req_valid;
|
|
|
|
wire dest_req_ready;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [DMA_ADDRESS_WIDTH_DEST-1:0] dest_req_address;
|
2014-03-13 12:20:10 +00:00
|
|
|
wire [BEATS_PER_BURST_WIDTH_DEST-1:0] dest_req_last_burst_length;
|
2015-05-06 13:08:56 +00:00
|
|
|
wire dest_req_xlast;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire dest_response_valid;
|
|
|
|
wire dest_response_ready;
|
|
|
|
wire dest_response_empty;
|
|
|
|
wire [1:0] dest_response_resp;
|
|
|
|
wire dest_response_resp_eot;
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] dest_request_id;
|
2018-05-22 12:40:08 +00:00
|
|
|
wire [ID_WIDTH-1:0] dest_data_request_id;
|
|
|
|
wire [ID_WIDTH-1:0] dest_data_response_id;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] dest_response_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire dest_valid;
|
|
|
|
wire dest_ready;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [DMA_DATA_WIDTH_DEST-1:0] dest_data;
|
2018-05-22 12:40:08 +00:00
|
|
|
wire dest_last;
|
2014-03-06 16:16:02 +00:00
|
|
|
wire dest_fifo_valid;
|
|
|
|
wire dest_fifo_ready;
|
2018-05-09 16:02:41 +00:00
|
|
|
wire [DMA_DATA_WIDTH_DEST-1:0] dest_fifo_data;
|
2018-05-22 12:40:08 +00:00
|
|
|
wire dest_fifo_last;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire src_req_valid;
|
|
|
|
wire src_req_ready;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [DMA_ADDRESS_WIDTH_SRC-1:0] src_req_address;
|
2014-03-13 12:20:10 +00:00
|
|
|
wire [BEATS_PER_BURST_WIDTH_SRC-1:0] src_req_last_burst_length;
|
2014-03-06 16:16:02 +00:00
|
|
|
wire src_req_sync_transfer_start;
|
2017-12-07 17:31:10 +00:00
|
|
|
wire src_req_xlast;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2017-07-31 07:06:54 +00:00
|
|
|
/* TODO
|
2014-03-06 16:16:02 +00:00
|
|
|
wire src_response_valid;
|
|
|
|
wire src_response_ready;
|
|
|
|
wire src_response_empty;
|
|
|
|
wire [1:0] src_response_resp;
|
2017-07-31 07:06:54 +00:00
|
|
|
*/
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] src_request_id;
|
2018-05-29 09:40:32 +00:00
|
|
|
reg [ID_WIDTH-1:0] src_throttled_request_id;
|
|
|
|
wire [ID_WIDTH-1:0] src_data_request_id;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] src_response_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire src_valid;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [DMA_DATA_WIDTH_SRC-1:0] src_data;
|
2018-05-09 16:02:41 +00:00
|
|
|
wire src_last;
|
2014-03-06 16:16:02 +00:00
|
|
|
wire src_fifo_valid;
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [DMA_DATA_WIDTH_SRC-1:0] src_fifo_data;
|
2018-05-09 16:02:41 +00:00
|
|
|
wire src_fifo_last;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
wire response_dest_valid;
|
|
|
|
wire response_dest_ready = 1'b1;
|
|
|
|
wire [1:0] response_dest_resp;
|
|
|
|
wire response_dest_resp_eot;
|
|
|
|
|
2015-04-15 12:26:25 +00:00
|
|
|
/* Unused for now
|
2014-03-06 16:16:02 +00:00
|
|
|
wire response_src_valid;
|
|
|
|
wire response_src_ready = 1'b1;
|
|
|
|
wire [1:0] response_src_resp;
|
2015-04-15 12:26:25 +00:00
|
|
|
*/
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dbg_dest_request_id = dest_request_id;
|
|
|
|
assign dbg_dest_response_id = dest_response_id;
|
|
|
|
assign dbg_src_request_id = src_request_id;
|
|
|
|
assign dbg_src_response_id = src_response_id;
|
|
|
|
|
2017-09-21 14:02:44 +00:00
|
|
|
always @(posedge req_clk)
|
2014-03-06 16:16:02 +00:00
|
|
|
begin
|
2016-10-01 15:13:42 +00:00
|
|
|
eot_mem[request_id] <= request_eot;
|
2014-03-06 16:16:02 +00:00
|
|
|
end
|
|
|
|
|
2017-09-21 14:02:44 +00:00
|
|
|
always @(posedge req_clk)
|
2014-03-06 16:16:02 +00:00
|
|
|
begin
|
2017-09-21 14:02:44 +00:00
|
|
|
if (req_resetn == 1'b0) begin
|
2016-10-01 15:13:42 +00:00
|
|
|
eot <= 1'b0;
|
|
|
|
end else begin
|
|
|
|
eot <= response_dest_valid & response_dest_ready & response_dest_resp_eot;
|
|
|
|
end
|
2014-03-06 16:16:02 +00:00
|
|
|
end
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
generate if (DMA_TYPE_DEST == DMA_TYPE_MM_AXI) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dest_clk = m_dest_axi_aclk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign dest_ext_resetn = m_dest_axi_aresetn;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] dest_address_id;
|
2015-04-14 17:53:36 +00:00
|
|
|
wire dest_address_eot = eot_mem[dest_address_id];
|
|
|
|
wire dest_response_eot = eot_mem[dest_response_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dbg_dest_address_id = dest_address_id;
|
2018-05-22 12:40:08 +00:00
|
|
|
assign dbg_dest_data_id = dest_data_response_id;
|
|
|
|
|
|
|
|
assign dest_data_request_id = dest_address_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
dmac_dest_mm_axi #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.DMA_DATA_WIDTH(DMA_DATA_WIDTH_DEST),
|
2017-04-06 07:30:22 +00:00
|
|
|
.DMA_ADDR_WIDTH(DMA_AXI_ADDR_WIDTH),
|
2016-10-01 15:13:42 +00:00
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_DEST),
|
2017-03-30 14:33:46 +00:00
|
|
|
.BYTES_PER_BEAT_WIDTH(BYTES_PER_BEAT_WIDTH_DEST),
|
2018-02-06 11:22:19 +00:00
|
|
|
.AXI_LENGTH_WIDTH(AXI_LENGTH_WIDTH_DEST)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_dest_dma_mm (
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axi_aclk(m_dest_axi_aclk),
|
|
|
|
.m_axi_aresetn(dest_resetn),
|
|
|
|
|
|
|
|
.enable(dest_enable),
|
|
|
|
.enabled(dest_enabled),
|
|
|
|
|
|
|
|
.req_valid(dest_req_valid),
|
|
|
|
.req_ready(dest_req_ready),
|
|
|
|
.req_address(dest_req_address),
|
|
|
|
.req_last_burst_length(dest_req_last_burst_length),
|
|
|
|
|
|
|
|
.response_valid(dest_response_valid),
|
|
|
|
.response_ready(dest_response_ready),
|
|
|
|
.response_resp(dest_response_resp),
|
|
|
|
.response_resp_eot(dest_response_resp_eot),
|
|
|
|
|
|
|
|
.request_id(dest_request_id),
|
|
|
|
.response_id(dest_response_id),
|
|
|
|
|
|
|
|
.address_id(dest_address_id),
|
|
|
|
|
|
|
|
.address_eot(dest_address_eot),
|
|
|
|
.response_eot(dest_response_eot),
|
|
|
|
|
|
|
|
.fifo_valid(dest_valid),
|
|
|
|
.fifo_ready(dest_ready),
|
|
|
|
.fifo_data(dest_data),
|
2018-05-22 12:40:08 +00:00
|
|
|
.fifo_last(dest_last),
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
.m_axi_awready(m_axi_awready),
|
|
|
|
.m_axi_awvalid(m_axi_awvalid),
|
|
|
|
.m_axi_awaddr(m_axi_awaddr),
|
|
|
|
.m_axi_awlen(m_axi_awlen),
|
|
|
|
.m_axi_awsize(m_axi_awsize),
|
|
|
|
.m_axi_awburst(m_axi_awburst),
|
|
|
|
.m_axi_awprot(m_axi_awprot),
|
|
|
|
.m_axi_awcache(m_axi_awcache),
|
|
|
|
.m_axi_wready(m_axi_wready),
|
|
|
|
.m_axi_wvalid(m_axi_wvalid),
|
|
|
|
.m_axi_wdata(m_axi_wdata),
|
|
|
|
.m_axi_wstrb(m_axi_wstrb),
|
|
|
|
.m_axi_wlast(m_axi_wlast),
|
|
|
|
|
|
|
|
.m_axi_bvalid(m_axi_bvalid),
|
|
|
|
.m_axi_bresp(m_axi_bresp),
|
|
|
|
.m_axi_bready(m_axi_bready)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
assign m_axi_awvalid = 1'b0;
|
|
|
|
assign m_axi_awaddr = 'h00;
|
|
|
|
assign m_axi_awlen = 'h00;
|
|
|
|
assign m_axi_awsize = 'h00;
|
|
|
|
assign m_axi_awburst = 'h00;
|
|
|
|
assign m_axi_awprot = 'h00;
|
|
|
|
assign m_axi_awcache = 'h00;
|
|
|
|
|
|
|
|
assign m_axi_wvalid = 1'b0;
|
|
|
|
assign m_axi_wdata = 'h00;
|
|
|
|
assign m_axi_wstrb = 'h00;
|
|
|
|
assign m_axi_wlast = 1'b0;
|
|
|
|
|
|
|
|
assign m_axi_bready = 1'b0;
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
if (DMA_TYPE_DEST == DMA_TYPE_STREAM_AXI) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dest_clk = m_axis_aclk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign dest_ext_resetn = 1'b1;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] data_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-04-14 17:53:36 +00:00
|
|
|
wire data_eot = eot_mem[data_id];
|
|
|
|
wire response_eot = eot_mem[dest_response_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2018-05-22 12:40:08 +00:00
|
|
|
assign dest_data_request_id = dest_request_id;
|
|
|
|
|
2014-03-13 12:20:10 +00:00
|
|
|
assign dbg_dest_address_id = 'h00;
|
2014-03-06 16:16:02 +00:00
|
|
|
assign dbg_dest_data_id = data_id;
|
|
|
|
|
|
|
|
dmac_dest_axi_stream #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.S_AXIS_DATA_WIDTH(DMA_DATA_WIDTH_DEST),
|
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_DEST)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_dest_dma_stream (
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_aclk(m_axis_aclk),
|
|
|
|
.s_axis_aresetn(dest_resetn),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.enable(dest_enable),
|
|
|
|
.enabled(dest_enabled),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.req_valid(dest_req_valid),
|
|
|
|
.req_ready(dest_req_ready),
|
|
|
|
.req_last_burst_length(dest_req_last_burst_length),
|
2017-05-12 11:46:25 +00:00
|
|
|
.req_xlast(dest_req_xlast),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_valid(dest_response_valid),
|
|
|
|
.response_ready(dest_response_ready),
|
|
|
|
.response_resp(dest_response_resp),
|
|
|
|
.response_resp_eot(dest_response_resp_eot),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_id(dest_response_id),
|
|
|
|
.data_id(data_id),
|
2017-05-12 11:46:25 +00:00
|
|
|
.xfer_req(m_axis_xfer_req),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.data_eot(data_eot),
|
|
|
|
.response_eot(response_eot),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.fifo_valid(dest_valid),
|
|
|
|
.fifo_ready(dest_ready),
|
|
|
|
.fifo_data(dest_data),
|
2018-05-22 12:40:08 +00:00
|
|
|
.fifo_last(dest_last),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axis_valid(m_axis_valid),
|
|
|
|
.m_axis_ready(m_axis_ready),
|
|
|
|
.m_axis_data(m_axis_data),
|
2017-05-12 11:46:25 +00:00
|
|
|
.m_axis_last(m_axis_last)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
|
|
|
|
|
|
|
assign m_axis_valid = 1'b0;
|
2015-09-21 15:30:42 +00:00
|
|
|
assign m_axis_last = 1'b0;
|
|
|
|
assign m_axis_xfer_req = 1'b0;
|
2014-03-18 19:58:56 +00:00
|
|
|
assign m_axis_data = 'h00;
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
end
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
if (DMA_TYPE_DEST == DMA_TYPE_FIFO) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dest_clk = fifo_rd_clk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign dest_ext_resetn = 1'b1;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] data_id;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-04-14 17:53:36 +00:00
|
|
|
wire data_eot = eot_mem[data_id];
|
|
|
|
wire response_eot = eot_mem[dest_response_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2018-05-22 12:40:08 +00:00
|
|
|
assign dest_data_request_id = dest_request_id;
|
|
|
|
|
2014-03-13 12:20:10 +00:00
|
|
|
assign dbg_dest_address_id = 'h00;
|
|
|
|
assign dbg_dest_data_id = data_id;
|
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
dmac_dest_fifo_inf #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.DATA_WIDTH(DMA_DATA_WIDTH_DEST),
|
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_DEST)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_dest_dma_fifo (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(fifo_rd_clk),
|
|
|
|
.resetn(dest_resetn),
|
|
|
|
|
|
|
|
.enable(dest_enable),
|
|
|
|
.enabled(dest_enabled),
|
|
|
|
|
|
|
|
.req_valid(dest_req_valid),
|
|
|
|
.req_ready(dest_req_ready),
|
|
|
|
|
|
|
|
.response_valid(dest_response_valid),
|
|
|
|
.response_ready(dest_response_ready),
|
|
|
|
.response_resp(dest_response_resp),
|
|
|
|
.response_resp_eot(dest_response_resp_eot),
|
|
|
|
|
|
|
|
.response_id(dest_response_id),
|
|
|
|
.data_id(data_id),
|
|
|
|
|
|
|
|
.data_eot(data_eot),
|
|
|
|
.response_eot(response_eot),
|
|
|
|
|
|
|
|
.fifo_valid(dest_valid),
|
|
|
|
.fifo_ready(dest_ready),
|
|
|
|
.fifo_data(dest_data),
|
2018-05-22 12:40:08 +00:00
|
|
|
.fifo_last(dest_last),
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
.en(fifo_rd_en),
|
|
|
|
.valid(fifo_rd_valid),
|
|
|
|
.dout(fifo_rd_dout),
|
|
|
|
.underflow(fifo_rd_underflow),
|
2017-05-12 11:46:25 +00:00
|
|
|
.xfer_req(fifo_rd_xfer_req)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
|
|
|
|
|
|
|
assign fifo_rd_valid = 1'b0;
|
|
|
|
assign fifo_rd_dout = 'h0;
|
|
|
|
assign fifo_rd_underflow = 1'b0;
|
2015-09-21 15:30:42 +00:00
|
|
|
assign fifo_rd_xfer_req = 1'b0;
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
end endgenerate
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
generate if (DMA_TYPE_SRC == DMA_TYPE_MM_AXI) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign src_clk = m_src_axi_aclk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign src_ext_resetn = m_src_axi_aresetn;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
wire [ID_WIDTH-1:0] src_data_id;
|
|
|
|
wire [ID_WIDTH-1:0] src_address_id;
|
2015-04-14 17:53:36 +00:00
|
|
|
wire src_address_eot = eot_mem[src_address_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign dbg_src_address_id = src_address_id;
|
|
|
|
assign dbg_src_data_id = src_data_id;
|
|
|
|
|
|
|
|
dmac_src_mm_axi #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.DMA_DATA_WIDTH(DMA_DATA_WIDTH_SRC),
|
2017-04-06 07:30:22 +00:00
|
|
|
.DMA_ADDR_WIDTH(DMA_AXI_ADDR_WIDTH),
|
2016-10-01 15:13:42 +00:00
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_SRC),
|
2017-03-30 14:33:46 +00:00
|
|
|
.BYTES_PER_BEAT_WIDTH(BYTES_PER_BEAT_WIDTH_SRC),
|
2018-02-06 11:22:19 +00:00
|
|
|
.AXI_LENGTH_WIDTH(AXI_LENGTH_WIDTH_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_dma_mm (
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axi_aclk(m_src_axi_aclk),
|
|
|
|
.m_axi_aresetn(src_resetn),
|
|
|
|
|
|
|
|
.enable(src_enable),
|
|
|
|
.enabled(src_enabled),
|
|
|
|
|
|
|
|
.req_valid(src_req_valid),
|
|
|
|
.req_ready(src_req_ready),
|
|
|
|
.req_address(src_req_address),
|
|
|
|
.req_last_burst_length(src_req_last_burst_length),
|
|
|
|
|
2017-07-31 07:06:54 +00:00
|
|
|
/* TODO
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_valid(src_response_valid),
|
|
|
|
.response_ready(src_response_ready),
|
|
|
|
.response_resp(src_response_resp),
|
2017-07-31 07:06:54 +00:00
|
|
|
*/
|
2016-10-01 15:13:42 +00:00
|
|
|
|
2018-05-29 09:40:32 +00:00
|
|
|
.request_id(src_throttled_request_id),
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_id(src_response_id),
|
|
|
|
.address_id(src_address_id),
|
|
|
|
.data_id(src_data_id),
|
|
|
|
|
|
|
|
.address_eot(src_address_eot),
|
|
|
|
|
|
|
|
.fifo_valid(src_valid),
|
|
|
|
.fifo_data(src_data),
|
2018-05-09 16:02:41 +00:00
|
|
|
.fifo_last(src_last),
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
.m_axi_arready(m_axi_arready),
|
|
|
|
.m_axi_arvalid(m_axi_arvalid),
|
|
|
|
.m_axi_araddr(m_axi_araddr),
|
|
|
|
.m_axi_arlen(m_axi_arlen),
|
|
|
|
.m_axi_arsize(m_axi_arsize),
|
|
|
|
.m_axi_arburst(m_axi_arburst),
|
|
|
|
.m_axi_arprot(m_axi_arprot),
|
|
|
|
.m_axi_arcache(m_axi_arcache),
|
|
|
|
|
|
|
|
.m_axi_rready(m_axi_rready),
|
|
|
|
.m_axi_rvalid(m_axi_rvalid),
|
|
|
|
.m_axi_rdata(m_axi_rdata),
|
2017-09-08 09:12:44 +00:00
|
|
|
.m_axi_rlast(m_axi_rlast),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axi_rresp(m_axi_rresp)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
|
|
|
|
|
|
|
assign m_axi_arvalid = 1'b0;
|
|
|
|
assign m_axi_araddr = 'h00;
|
|
|
|
assign m_axi_arlen = 'h00;
|
|
|
|
assign m_axi_arsize = 'h00;
|
|
|
|
assign m_axi_arburst = 'h00;
|
|
|
|
assign m_axi_arcache = 'h00;
|
|
|
|
assign m_axi_arprot = 'h00;
|
|
|
|
assign m_axi_rready = 1'b0;
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
end
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
if (DMA_TYPE_SRC == DMA_TYPE_STREAM_AXI) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign src_clk = s_axis_aclk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign src_ext_resetn = 1'b1;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-04-14 17:53:36 +00:00
|
|
|
wire src_eot = eot_mem[src_response_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2014-03-13 12:20:10 +00:00
|
|
|
assign dbg_src_address_id = 'h00;
|
|
|
|
assign dbg_src_data_id = 'h00;
|
|
|
|
|
2017-07-31 07:06:54 +00:00
|
|
|
/* TODO
|
2014-03-18 19:58:56 +00:00
|
|
|
assign src_response_valid = 1'b0;
|
|
|
|
assign src_response_resp = 2'b0;
|
2017-07-31 07:06:54 +00:00
|
|
|
*/
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
dmac_src_axi_stream #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.S_AXIS_DATA_WIDTH(DMA_DATA_WIDTH_SRC),
|
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_dma_stream (
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_aclk(s_axis_aclk),
|
|
|
|
.s_axis_aresetn(src_resetn),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.enable(src_enable),
|
|
|
|
.enabled(src_enabled),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.req_valid(src_req_valid),
|
|
|
|
.req_ready(src_req_ready),
|
|
|
|
.req_last_burst_length(src_req_last_burst_length),
|
|
|
|
.req_sync_transfer_start(src_req_sync_transfer_start),
|
2017-12-07 17:31:10 +00:00
|
|
|
.req_xlast(src_req_xlast),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2018-05-29 09:40:32 +00:00
|
|
|
.request_id(src_throttled_request_id),
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_id(src_response_id),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.eot(src_eot),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.fifo_valid(src_valid),
|
|
|
|
.fifo_data(src_data),
|
2018-05-09 16:02:41 +00:00
|
|
|
.fifo_last(src_last),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_valid(s_axis_valid),
|
|
|
|
.s_axis_ready(s_axis_ready),
|
|
|
|
.s_axis_data(s_axis_data),
|
2017-12-07 17:31:10 +00:00
|
|
|
.s_axis_last(s_axis_last),
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_user(s_axis_user),
|
|
|
|
.s_axis_xfer_req(s_axis_xfer_req)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
|
|
|
|
|
|
|
assign s_axis_ready = 1'b0;
|
2015-09-21 15:30:42 +00:00
|
|
|
assign s_axis_xfer_req = 1'b0;
|
2014-03-18 19:58:56 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-08-19 11:11:47 +00:00
|
|
|
if (DMA_TYPE_SRC == DMA_TYPE_FIFO) begin
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
assign src_clk = fifo_wr_clk;
|
2017-09-21 14:02:44 +00:00
|
|
|
assign src_ext_resetn = 1'b1;
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2015-04-14 17:53:36 +00:00
|
|
|
wire src_eot = eot_mem[src_response_id];
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2014-03-13 12:20:10 +00:00
|
|
|
assign dbg_src_address_id = 'h00;
|
|
|
|
assign dbg_src_data_id = 'h00;
|
|
|
|
|
2017-07-31 07:06:54 +00:00
|
|
|
/* TODO
|
2014-03-18 19:58:56 +00:00
|
|
|
assign src_response_valid = 1'b0;
|
|
|
|
assign src_response_resp = 2'b0;
|
2017-07-31 07:06:54 +00:00
|
|
|
*/
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
dmac_src_fifo_inf #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.DATA_WIDTH(DMA_DATA_WIDTH_SRC),
|
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_dma_fifo (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(fifo_wr_clk),
|
|
|
|
.resetn(src_resetn),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.enable(src_enable),
|
|
|
|
.enabled(src_enabled),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.req_valid(src_req_valid),
|
|
|
|
.req_ready(src_req_ready),
|
|
|
|
.req_last_burst_length(src_req_last_burst_length),
|
|
|
|
.req_sync_transfer_start(src_req_sync_transfer_start),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2018-05-29 09:40:32 +00:00
|
|
|
.request_id(src_throttled_request_id),
|
2016-10-01 15:13:42 +00:00
|
|
|
.response_id(src_response_id),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.eot(src_eot),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.fifo_valid(src_valid),
|
|
|
|
.fifo_data(src_data),
|
2018-05-09 16:02:41 +00:00
|
|
|
.fifo_last(src_last),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.en(fifo_wr_en),
|
|
|
|
.din(fifo_wr_din),
|
|
|
|
.overflow(fifo_wr_overflow),
|
|
|
|
.sync(fifo_wr_sync),
|
|
|
|
.xfer_req(fifo_wr_xfer_req)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2014-03-18 19:58:56 +00:00
|
|
|
end else begin
|
|
|
|
|
|
|
|
assign fifo_wr_overflow = 1'b0;
|
2014-09-29 17:55:46 +00:00
|
|
|
assign fifo_wr_xfer_req = 1'b0;
|
2014-03-18 19:58:56 +00:00
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
end endgenerate
|
|
|
|
|
|
|
|
sync_bits #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.NUM_OF_BITS(ID_WIDTH),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_REQ_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_sync_src_request_id (
|
2016-10-01 15:13:42 +00:00
|
|
|
.out_clk(src_clk),
|
2017-09-21 14:02:44 +00:00
|
|
|
.out_resetn(1'b1),
|
2016-10-01 15:13:42 +00:00
|
|
|
.in(request_id),
|
|
|
|
.out(src_request_id)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2018-05-29 09:40:32 +00:00
|
|
|
`include "inc_id.h"
|
|
|
|
|
|
|
|
function compare_id;
|
|
|
|
input [ID_WIDTH-1:0] a;
|
|
|
|
input [ID_WIDTH-1:0] b;
|
|
|
|
begin
|
|
|
|
compare_id = a[ID_WIDTH-1] == b[ID_WIDTH-1];
|
|
|
|
if (ID_WIDTH >= 2) begin
|
|
|
|
if (a[ID_WIDTH-2] == b[ID_WIDTH-2]) begin
|
|
|
|
compare_id = 1'b1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if (ID_WIDTH >= 3) begin
|
|
|
|
if (a[ID_WIDTH-3:0] != b[ID_WIDTH-3:0]) begin
|
|
|
|
compare_id = 1'b1;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Make sure that we do not request more data than what fits into the
|
|
|
|
* store-and-forward burst memory.
|
|
|
|
*/
|
|
|
|
always @(posedge src_clk) begin
|
|
|
|
if (src_resetn == 1'b0) begin
|
|
|
|
src_throttled_request_id <= 'h00;
|
|
|
|
end else if (src_throttled_request_id != src_request_id &&
|
|
|
|
compare_id(src_throttled_request_id, src_data_request_id)) begin
|
|
|
|
src_throttled_request_id <= inc_id(src_throttled_request_id);
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
sync_bits #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.NUM_OF_BITS(ID_WIDTH),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_DEST_REQ)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_sync_req_response_id (
|
2017-09-21 14:02:44 +00:00
|
|
|
.out_clk(req_clk),
|
|
|
|
.out_resetn(1'b1),
|
2016-10-01 15:13:42 +00:00
|
|
|
.in(dest_response_id),
|
|
|
|
.out(response_id)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
axi_register_slice #(
|
2018-05-09 16:02:41 +00:00
|
|
|
.DATA_WIDTH(DMA_DATA_WIDTH_SRC + 1),
|
2016-10-01 15:13:42 +00:00
|
|
|
.FORWARD_REGISTERED(AXI_SLICE_SRC),
|
2018-05-14 08:16:04 +00:00
|
|
|
.BACKWARD_REGISTERED(0)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_slice (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(src_clk),
|
|
|
|
.resetn(src_resetn),
|
|
|
|
.s_axi_valid(src_valid),
|
2018-05-14 08:16:04 +00:00
|
|
|
.s_axi_ready(),
|
2018-05-09 16:02:41 +00:00
|
|
|
.s_axi_data({src_data,src_last}),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axi_valid(src_fifo_valid),
|
2018-05-14 08:16:04 +00:00
|
|
|
.m_axi_ready(1'b1), /* No backpressure */
|
2018-05-09 16:02:41 +00:00
|
|
|
.m_axi_data({src_fifo_data,src_fifo_last})
|
2014-03-13 12:20:10 +00:00
|
|
|
);
|
|
|
|
|
2018-05-09 16:02:41 +00:00
|
|
|
axi_dmac_burst_memory #(
|
|
|
|
.DATA_WIDTH_SRC(DMA_DATA_WIDTH_SRC),
|
|
|
|
.DATA_WIDTH_DEST(DMA_DATA_WIDTH_DEST),
|
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.MAX_BYTES_PER_BURST(MAX_BYTES_PER_BURST),
|
2016-10-01 15:13:42 +00:00
|
|
|
.ASYNC_CLK(ASYNC_CLK_SRC_DEST)
|
2018-05-09 16:02:41 +00:00
|
|
|
) i_store_and_forward (
|
|
|
|
.src_clk(src_clk),
|
|
|
|
.src_reset(~src_resetn),
|
|
|
|
.src_data_valid(src_fifo_valid),
|
|
|
|
.src_data(src_fifo_data),
|
|
|
|
.src_data_last(src_fifo_last),
|
|
|
|
|
2018-05-29 09:40:32 +00:00
|
|
|
.src_data_request_id(src_data_request_id),
|
|
|
|
|
2018-05-09 16:02:41 +00:00
|
|
|
.dest_clk(dest_clk),
|
|
|
|
.dest_reset(~dest_resetn),
|
|
|
|
.dest_data_valid(dest_fifo_valid),
|
|
|
|
.dest_data_ready(dest_fifo_ready),
|
2018-05-10 09:13:22 +00:00
|
|
|
.dest_data(dest_fifo_data),
|
2018-05-22 12:40:08 +00:00
|
|
|
.dest_data_last(dest_fifo_last),
|
2018-05-10 09:13:22 +00:00
|
|
|
|
2018-05-22 12:40:08 +00:00
|
|
|
.dest_request_id(dest_request_id),
|
|
|
|
.dest_data_request_id(dest_data_request_id),
|
|
|
|
.dest_data_response_id(dest_data_response_id)
|
2014-03-13 12:20:10 +00:00
|
|
|
);
|
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
axi_register_slice #(
|
2018-05-22 12:40:08 +00:00
|
|
|
.DATA_WIDTH(DMA_DATA_WIDTH_DEST + 1),
|
2018-05-18 09:21:44 +00:00
|
|
|
.FORWARD_REGISTERED(AXI_SLICE_DEST),
|
|
|
|
.BACKWARD_REGISTERED(AXI_SLICE_DEST)
|
|
|
|
) i_dest_slice (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(dest_clk),
|
|
|
|
.resetn(dest_resetn),
|
2018-05-09 16:02:41 +00:00
|
|
|
.s_axi_valid(dest_fifo_valid),
|
|
|
|
.s_axi_ready(dest_fifo_ready),
|
2018-05-22 12:40:08 +00:00
|
|
|
.s_axi_data({
|
|
|
|
dest_fifo_last,
|
|
|
|
dest_fifo_data
|
|
|
|
}),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axi_valid(dest_valid),
|
|
|
|
.m_axi_ready(dest_ready),
|
2018-05-22 12:40:08 +00:00
|
|
|
.m_axi_data({
|
|
|
|
dest_last,
|
|
|
|
dest_data
|
|
|
|
})
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
splitter #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.NUM_M(3)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_req_splitter (
|
2017-09-21 14:02:44 +00:00
|
|
|
.clk(req_clk),
|
|
|
|
.resetn(req_resetn),
|
|
|
|
.s_valid(req_valid),
|
|
|
|
.s_ready(req_ready),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_valid({
|
|
|
|
req_gen_valid,
|
|
|
|
req_dest_valid,
|
|
|
|
req_src_valid
|
|
|
|
}),
|
|
|
|
.m_ready({
|
|
|
|
req_gen_ready,
|
|
|
|
req_dest_ready,
|
|
|
|
req_src_ready
|
|
|
|
})
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2015-04-09 12:30:29 +00:00
|
|
|
util_axis_fifo #(
|
2017-07-28 17:10:18 +00:00
|
|
|
.DATA_WIDTH(DMA_ADDRESS_WIDTH_DEST + BEATS_PER_BURST_WIDTH_DEST + 1),
|
2016-10-01 15:13:42 +00:00
|
|
|
.ADDRESS_WIDTH(0),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_DEST_REQ)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_dest_req_fifo (
|
2017-09-21 14:02:44 +00:00
|
|
|
.s_axis_aclk(req_clk),
|
|
|
|
.s_axis_aresetn(req_resetn),
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_valid(req_dest_valid),
|
|
|
|
.s_axis_ready(req_dest_ready),
|
2017-09-21 14:02:44 +00:00
|
|
|
.s_axis_empty(),
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_data({
|
|
|
|
req_dest_address,
|
|
|
|
req_length[BYTES_PER_BURST_WIDTH-1:BYTES_PER_BEAT_WIDTH_DEST],
|
2017-07-28 17:10:18 +00:00
|
|
|
req_xlast
|
2016-10-01 15:13:42 +00:00
|
|
|
}),
|
|
|
|
.s_axis_room(),
|
|
|
|
|
|
|
|
.m_axis_aclk(dest_clk),
|
|
|
|
.m_axis_aresetn(dest_resetn),
|
|
|
|
.m_axis_valid(dest_req_valid),
|
|
|
|
.m_axis_ready(dest_req_ready),
|
|
|
|
.m_axis_data({
|
|
|
|
dest_req_address,
|
|
|
|
dest_req_last_burst_length,
|
2017-07-28 17:10:18 +00:00
|
|
|
dest_req_xlast
|
2016-10-01 15:13:42 +00:00
|
|
|
}),
|
|
|
|
.m_axis_level()
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2015-04-09 12:30:29 +00:00
|
|
|
util_axis_fifo #(
|
2017-12-07 17:31:10 +00:00
|
|
|
.DATA_WIDTH(DMA_ADDRESS_WIDTH_SRC + BEATS_PER_BURST_WIDTH_SRC + 2),
|
2016-10-01 15:13:42 +00:00
|
|
|
.ADDRESS_WIDTH(0),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_REQ_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_req_fifo (
|
2017-09-21 14:02:44 +00:00
|
|
|
.s_axis_aclk(req_clk),
|
|
|
|
.s_axis_aresetn(req_resetn),
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_valid(req_src_valid),
|
|
|
|
.s_axis_ready(req_src_ready),
|
2017-09-21 14:02:44 +00:00
|
|
|
.s_axis_empty(),
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_data({
|
|
|
|
req_src_address,
|
|
|
|
req_length[BYTES_PER_BURST_WIDTH-1:BYTES_PER_BEAT_WIDTH_SRC],
|
2017-12-07 17:31:10 +00:00
|
|
|
req_sync_transfer_start,
|
|
|
|
req_xlast
|
2016-10-01 15:13:42 +00:00
|
|
|
}),
|
|
|
|
.s_axis_room(),
|
|
|
|
|
|
|
|
.m_axis_aclk(src_clk),
|
|
|
|
.m_axis_aresetn(src_resetn),
|
|
|
|
.m_axis_valid(src_req_valid),
|
|
|
|
.m_axis_ready(src_req_ready),
|
|
|
|
.m_axis_data({
|
|
|
|
src_req_address,
|
|
|
|
src_req_last_burst_length,
|
2017-12-07 17:31:10 +00:00
|
|
|
src_req_sync_transfer_start,
|
|
|
|
src_req_xlast
|
2016-10-01 15:13:42 +00:00
|
|
|
}),
|
|
|
|
.m_axis_level()
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2015-04-09 12:30:29 +00:00
|
|
|
util_axis_fifo #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.DATA_WIDTH(1),
|
|
|
|
.ADDRESS_WIDTH(0),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_DEST_REQ)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_dest_response_fifo (
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_aclk(dest_clk),
|
|
|
|
.s_axis_aresetn(dest_resetn),
|
|
|
|
.s_axis_valid(dest_response_valid),
|
|
|
|
.s_axis_ready(dest_response_ready),
|
|
|
|
.s_axis_empty(dest_response_empty),
|
|
|
|
.s_axis_data(dest_response_resp_eot),
|
|
|
|
.s_axis_room(),
|
|
|
|
|
2017-09-21 14:02:44 +00:00
|
|
|
.m_axis_aclk(req_clk),
|
|
|
|
.m_axis_aresetn(req_resetn),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axis_valid(response_dest_valid),
|
|
|
|
.m_axis_ready(response_dest_ready),
|
|
|
|
.m_axis_data(response_dest_resp_eot),
|
|
|
|
.m_axis_level()
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2015-04-15 12:26:25 +00:00
|
|
|
/* Unused for now
|
2015-04-09 12:30:29 +00:00
|
|
|
util_axis_fifo #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.DATA_WIDTH(2),
|
|
|
|
.ADDRESS_WIDTH(0),
|
|
|
|
.ASYNC_CLK(ASYNC_CLK_REQ_SRC)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_src_response_fifo (
|
2016-10-01 15:13:42 +00:00
|
|
|
.s_axis_aclk(src_clk),
|
|
|
|
.s_axis_aresetn(src_resetn),
|
|
|
|
.s_axis_valid(src_response_valid),
|
|
|
|
.s_axis_ready(src_response_ready),
|
|
|
|
.s_axis_empty(src_response_empty),
|
|
|
|
.s_axis_data(src_response_resp),
|
2017-09-21 14:02:44 +00:00
|
|
|
.m_axis_aclk(req_clk),
|
|
|
|
.m_axis_aresetn(req_resetn),
|
2016-10-01 15:13:42 +00:00
|
|
|
.m_axis_valid(response_src_valid),
|
|
|
|
.m_axis_ready(response_src_ready),
|
|
|
|
.m_axis_data(response_src_resp)
|
2017-07-31 07:06:54 +00:00
|
|
|
);
|
2015-04-17 17:51:04 +00:00
|
|
|
assign src_response_empty = 1'b1;
|
|
|
|
assign src_response_ready = 1'b1;
|
2017-07-31 07:06:54 +00:00
|
|
|
*/
|
2014-03-06 16:16:02 +00:00
|
|
|
|
|
|
|
dmac_request_generator #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.BURSTS_PER_TRANSFER_WIDTH(BURSTS_PER_TRANSFER_WIDTH)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_req_gen (
|
2017-09-21 14:02:44 +00:00
|
|
|
.clk(req_clk),
|
|
|
|
.resetn(req_resetn),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.request_id(request_id),
|
|
|
|
.response_id(response_id),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.req_valid(req_gen_valid),
|
|
|
|
.req_ready(req_gen_ready),
|
|
|
|
.req_burst_count(req_length[DMA_LENGTH_WIDTH-1:BYTES_PER_BURST_WIDTH]),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2017-09-21 14:02:44 +00:00
|
|
|
.enable(req_enable),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.eot(request_eot)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
endmodule
|