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.
|
|
|
|
//
|
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.
|
2017-05-17 08:44:52 +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:
|
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
|
|
|
//
|
|
|
|
// ***************************************************************************
|
|
|
|
// ***************************************************************************
|
|
|
|
|
2018-08-27 07:14:54 +00:00
|
|
|
`timescale 1ns/100ps
|
|
|
|
|
2022-03-22 10:27:47 +00:00
|
|
|
module dest_axi_mm #(
|
2017-07-15 07:52:12 +00:00
|
|
|
|
|
|
|
parameter ID_WIDTH = 3,
|
|
|
|
parameter DMA_DATA_WIDTH = 64,
|
|
|
|
parameter DMA_ADDR_WIDTH = 32,
|
|
|
|
parameter BYTES_PER_BEAT_WIDTH = $clog2(DMA_DATA_WIDTH/8),
|
|
|
|
parameter BEATS_PER_BURST_WIDTH = 4,
|
2018-08-10 14:47:21 +00:00
|
|
|
parameter MAX_BYTES_PER_BURST = 128,
|
|
|
|
parameter BYTES_PER_BURST_WIDTH = $clog2(MAX_BYTES_PER_BURST),
|
2022-05-05 08:35:34 +00:00
|
|
|
parameter AXI_LENGTH_WIDTH = 8,
|
|
|
|
parameter CACHE_COHERENT = 0)(
|
2017-07-15 07:52:12 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
input m_axi_aclk,
|
|
|
|
input m_axi_aresetn,
|
|
|
|
|
|
|
|
input req_valid,
|
|
|
|
output req_ready,
|
2017-04-06 07:30:22 +00:00
|
|
|
input [DMA_ADDR_WIDTH-1:BYTES_PER_BEAT_WIDTH] req_address,
|
2018-07-27 14:06:53 +00:00
|
|
|
|
|
|
|
input bl_valid,
|
|
|
|
output bl_ready,
|
|
|
|
input [BEATS_PER_BURST_WIDTH-1:0] measured_last_burst_length,
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
input enable,
|
|
|
|
output enabled,
|
|
|
|
|
|
|
|
output response_valid,
|
|
|
|
input response_ready,
|
|
|
|
output [1:0] response_resp,
|
|
|
|
output response_resp_eot,
|
2018-08-10 14:47:21 +00:00
|
|
|
output response_resp_partial,
|
|
|
|
output [BYTES_PER_BURST_WIDTH-1:0] response_data_burst_length,
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
input [ID_WIDTH-1:0] request_id,
|
|
|
|
output [ID_WIDTH-1:0] response_id,
|
|
|
|
|
|
|
|
output [ID_WIDTH-1:0] address_id,
|
|
|
|
input address_eot,
|
|
|
|
input response_eot,
|
|
|
|
|
|
|
|
input fifo_valid,
|
|
|
|
output fifo_ready,
|
|
|
|
input [DMA_DATA_WIDTH-1:0] fifo_data,
|
2018-10-18 13:58:53 +00:00
|
|
|
input [DMA_DATA_WIDTH/8-1:0] fifo_strb,
|
2018-05-22 12:40:08 +00:00
|
|
|
input fifo_last,
|
2016-10-01 15:13:42 +00:00
|
|
|
|
2018-08-10 14:47:21 +00:00
|
|
|
input [BYTES_PER_BURST_WIDTH-1:0] dest_burst_info_length,
|
|
|
|
input dest_burst_info_partial,
|
|
|
|
input [ID_WIDTH-1:0] dest_burst_info_id,
|
|
|
|
input dest_burst_info_write,
|
2016-10-01 15:13:42 +00:00
|
|
|
// Write address
|
|
|
|
input m_axi_awready,
|
|
|
|
output m_axi_awvalid,
|
2017-04-06 07:30:22 +00:00
|
|
|
output [DMA_ADDR_WIDTH-1:0] m_axi_awaddr,
|
2017-03-30 14:33:46 +00:00
|
|
|
output [AXI_LENGTH_WIDTH-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,
|
|
|
|
|
|
|
|
// Write data
|
|
|
|
output [DMA_DATA_WIDTH-1:0] m_axi_wdata,
|
|
|
|
output [(DMA_DATA_WIDTH/8)-1:0] m_axi_wstrb,
|
|
|
|
input m_axi_wready,
|
|
|
|
output m_axi_wvalid,
|
|
|
|
output m_axi_wlast,
|
|
|
|
|
|
|
|
// Write response
|
|
|
|
input m_axi_bvalid,
|
|
|
|
input [ 1:0] m_axi_bresp,
|
|
|
|
output m_axi_bready
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
wire address_enabled;
|
2014-03-13 12:20:10 +00:00
|
|
|
|
2022-03-22 10:27:47 +00:00
|
|
|
address_generator #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH),
|
|
|
|
.BEATS_PER_BURST_WIDTH(BEATS_PER_BURST_WIDTH),
|
|
|
|
.BYTES_PER_BEAT_WIDTH(BYTES_PER_BEAT_WIDTH),
|
2017-03-30 14:33:46 +00:00
|
|
|
.DMA_DATA_WIDTH(DMA_DATA_WIDTH),
|
2017-04-06 07:30:22 +00:00
|
|
|
.LENGTH_WIDTH(AXI_LENGTH_WIDTH),
|
2022-05-05 08:35:34 +00:00
|
|
|
.DMA_ADDR_WIDTH(DMA_ADDR_WIDTH),
|
|
|
|
.CACHE_COHERENT(CACHE_COHERENT)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_addr_gen (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(m_axi_aclk),
|
|
|
|
.resetn(m_axi_aresetn),
|
|
|
|
|
|
|
|
.enable(enable),
|
|
|
|
.enabled(address_enabled),
|
|
|
|
|
|
|
|
.id(address_id),
|
|
|
|
.request_id(request_id),
|
|
|
|
|
2018-05-22 12:40:08 +00:00
|
|
|
.req_valid(req_valid),
|
|
|
|
.req_ready(req_ready),
|
2016-10-01 15:13:42 +00:00
|
|
|
.req_address(req_address),
|
2018-07-27 14:06:53 +00:00
|
|
|
|
|
|
|
.bl_valid(bl_valid),
|
|
|
|
.bl_ready(bl_ready),
|
|
|
|
.measured_last_burst_length(measured_last_burst_length),
|
2016-10-01 15:13:42 +00:00
|
|
|
|
|
|
|
.eot(address_eot),
|
|
|
|
|
|
|
|
.addr_ready(m_axi_awready),
|
|
|
|
.addr_valid(m_axi_awvalid),
|
|
|
|
.addr(m_axi_awaddr),
|
|
|
|
.len(m_axi_awlen),
|
|
|
|
.size(m_axi_awsize),
|
|
|
|
.burst(m_axi_awburst),
|
|
|
|
.prot(m_axi_awprot),
|
|
|
|
.cache(m_axi_awcache)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2018-05-22 12:40:08 +00:00
|
|
|
assign m_axi_wvalid = fifo_valid;
|
|
|
|
assign fifo_ready = m_axi_wready;
|
|
|
|
assign m_axi_wlast = fifo_last;
|
|
|
|
assign m_axi_wdata = fifo_data;
|
2018-10-18 13:58:53 +00:00
|
|
|
assign m_axi_wstrb = fifo_strb;
|
2017-07-15 07:52:12 +00:00
|
|
|
|
2022-03-22 10:27:47 +00:00
|
|
|
response_handler #(
|
2016-10-01 15:13:42 +00:00
|
|
|
.ID_WIDTH(ID_WIDTH)
|
2014-03-06 16:16:02 +00:00
|
|
|
) i_response_handler (
|
2016-10-01 15:13:42 +00:00
|
|
|
.clk(m_axi_aclk),
|
|
|
|
.resetn(m_axi_aresetn),
|
|
|
|
.bvalid(m_axi_bvalid),
|
|
|
|
.bready(m_axi_bready),
|
|
|
|
.bresp(m_axi_bresp),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2018-05-04 12:17:11 +00:00
|
|
|
.enable(address_enabled),
|
2016-10-01 15:13:42 +00:00
|
|
|
.enabled(enabled),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.id(response_id),
|
2018-05-04 12:17:11 +00:00
|
|
|
.request_id(address_id),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.eot(response_eot),
|
2014-03-06 16:16:02 +00:00
|
|
|
|
2016-10-01 15:13:42 +00:00
|
|
|
.resp_valid(response_valid),
|
|
|
|
.resp_ready(response_ready),
|
|
|
|
.resp_resp(response_resp),
|
|
|
|
.resp_eot(response_resp_eot)
|
2014-03-06 16:16:02 +00:00
|
|
|
);
|
|
|
|
|
2018-08-10 14:47:21 +00:00
|
|
|
reg [BYTES_PER_BURST_WIDTH+1-1:0] bl_mem [0:2**(ID_WIDTH)-1];
|
|
|
|
|
|
|
|
assign {response_resp_partial,
|
|
|
|
response_data_burst_length} = bl_mem[response_id];
|
|
|
|
|
|
|
|
always @(posedge m_axi_aclk) begin
|
|
|
|
if (dest_burst_info_write) begin
|
|
|
|
bl_mem[dest_burst_info_id] <= {dest_burst_info_partial,
|
|
|
|
dest_burst_info_length};
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2014-03-06 16:16:02 +00:00
|
|
|
endmodule
|