2014-12-14 17:18:53 -05:00
|
|
|
/*
|
|
|
|
########################################################################
|
|
|
|
EPIPHANY eMesh Filter / Distributor
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
This block takes one eMesh input, selected from two available
|
|
|
|
(MMU or direct), and distributes the transactions based on type
|
|
|
|
(write, read request, read response).
|
|
|
|
*/
|
|
|
|
|
|
|
|
module erx_disty (/*AUTOARG*/
|
|
|
|
// Outputs
|
2015-04-23 18:03:10 -04:00
|
|
|
rx_rd_wait, rx_wr_wait, edma_wait, rxwr_fifo_access,
|
|
|
|
rxwr_fifo_packet, rxrd_fifo_access, rxrd_fifo_packet,
|
|
|
|
rxrr_fifo_access, rxrr_fifo_packet,
|
2014-12-14 17:18:53 -05:00
|
|
|
// Inputs
|
2015-04-23 18:03:10 -04:00
|
|
|
clk, mmu_en, emmu_access, emmu_packet, edma_access, edma_packet,
|
|
|
|
rxwr_fifo_wait, rxrd_fifo_wait, rxrr_fifo_wait
|
2014-12-14 17:18:53 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
parameter [11:0] C_READ_TAG_ADDR = 12'h810;
|
2015-04-23 18:03:10 -04:00
|
|
|
parameter AW = 32;
|
|
|
|
parameter DW = 32;
|
|
|
|
parameter PW = 104;
|
2015-03-25 19:25:12 -04:00
|
|
|
|
2014-12-14 17:18:53 -05:00
|
|
|
// RX clock
|
2015-03-24 20:44:03 -04:00
|
|
|
input clk;
|
2015-03-25 19:25:12 -04:00
|
|
|
|
|
|
|
// MMU enable
|
|
|
|
input mmu_en;
|
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
//Transaction from MMU
|
|
|
|
input emmu_access;
|
|
|
|
input [PW-1:0] emmu_packet;
|
|
|
|
output rx_rd_wait;
|
|
|
|
output rx_wr_wait;
|
|
|
|
|
|
|
|
//Transaction from DMA
|
|
|
|
input edma_access;
|
|
|
|
input [PW-1:0] edma_packet;
|
|
|
|
output edma_wait;
|
|
|
|
|
2014-12-14 17:18:53 -05:00
|
|
|
// Master FIFO port, writes
|
2015-04-23 18:03:10 -04:00
|
|
|
output rxwr_fifo_access;
|
|
|
|
output [PW-1:0] rxwr_fifo_packet;
|
|
|
|
input rxwr_fifo_wait;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
|
|
|
// Master FIFO port, read requests
|
2015-04-23 18:03:10 -04:00
|
|
|
output rxrd_fifo_access;
|
|
|
|
output [PW-1:0] rxrd_fifo_packet;
|
|
|
|
input rxrd_fifo_wait;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
|
|
|
// Master FIFO port, read responses
|
2015-04-23 18:03:10 -04:00
|
|
|
output rxrr_fifo_access;
|
|
|
|
output [PW-1:0] rxrr_fifo_packet;
|
|
|
|
input rxrr_fifo_wait;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
//wires
|
|
|
|
wire emmu_write;
|
|
|
|
wire [1:0] emmu_datamode;
|
|
|
|
wire [3:0] emmu_ctrlmode;
|
|
|
|
wire [31:0] emmu_dstaddr;
|
|
|
|
wire [31:0] emmu_srcaddr;
|
|
|
|
wire [31:0] emmu_data;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
//regs
|
|
|
|
reg rxrd_fifo_access;
|
|
|
|
reg rxrr_fifo_access;
|
|
|
|
reg rxwr_fifo_access;
|
|
|
|
reg [PW-1:0] rxrd_fifo_packet;
|
|
|
|
reg [PW-1:0] rxwr_fifo_packet;
|
2015-03-25 19:25:12 -04:00
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
packet2emesh p2e (// Outputs
|
|
|
|
.access_out (),
|
|
|
|
.write_out (emmu_write),
|
|
|
|
.datamode_out (emmu_datamode[1:0]),
|
|
|
|
.ctrlmode_out (emmu_ctrlmode[3:0]),
|
|
|
|
.dstaddr_out (emmu_dstaddr[AW-1:0]),
|
|
|
|
.data_out (emmu_data[DW-1:0]),
|
|
|
|
.srcaddr_out (emmu_srcaddr[AW-1:0]),
|
|
|
|
// Inputs
|
|
|
|
.packet_in (emmu_packet[PW-1:0])
|
|
|
|
);
|
|
|
|
|
|
|
|
//Read requests (emmu has priority over edma)
|
|
|
|
assign emmu_read = (emmu_access & ~emmu_write);
|
|
|
|
|
2015-03-24 20:44:03 -04:00
|
|
|
always @ (posedge clk)
|
2015-04-23 18:03:10 -04:00
|
|
|
if(emmu_read | edma_access )
|
|
|
|
begin
|
|
|
|
rxrd_fifo_access <= 1'b1;
|
|
|
|
rxrd_fifo_packet[PW-1:0] <= emmu_read ? emmu_packet[PW-1:0] :
|
|
|
|
edma_packet[PW-1:0];
|
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
|
|
|
rxrd_fifo_access <= 1'b0;
|
|
|
|
end
|
|
|
|
|
|
|
|
//Write and read response from emmu
|
2015-03-24 20:44:03 -04:00
|
|
|
always @ (posedge clk)
|
2015-03-25 19:25:12 -04:00
|
|
|
if(emmu_access)
|
2015-04-23 18:03:10 -04:00
|
|
|
begin
|
|
|
|
rxwr_fifo_packet[PW-1:0] <= emmu_packet[PW-1:0];
|
|
|
|
rxrr_fifo_access <= emmu_write & (emmu_dstaddr[31:20] == C_READ_TAG_ADDR);
|
|
|
|
rxwr_fifo_access <= emmu_write & (emmu_dstaddr[31:20] != C_READ_TAG_ADDR);
|
2015-03-25 19:25:12 -04:00
|
|
|
end
|
|
|
|
else
|
|
|
|
begin
|
2015-04-23 18:03:10 -04:00
|
|
|
rxrr_fifo_access <= 1'b0;
|
|
|
|
rxwr_fifo_access <= 1'b0;
|
2014-12-14 17:18:53 -05:00
|
|
|
end
|
2015-04-23 18:03:10 -04:00
|
|
|
|
|
|
|
assign rxrr_fifo_packet[PW-1:0] = rxwr_fifo_packet[PW-1:0];
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
//wait signals
|
|
|
|
assign rx_rd_wait = rxrd_fifo_wait;
|
|
|
|
assign rx_wr_wait = rxwr_fifo_wait | rxrr_fifo_wait;
|
|
|
|
assign edma_wait = rxrd_fifo_wait | emmu_read;
|
2014-12-14 17:18:53 -05:00
|
|
|
|
2015-03-25 19:25:12 -04:00
|
|
|
endmodule // erx_disty
|
2015-04-23 18:03:10 -04:00
|
|
|
// Local Variables:
|
|
|
|
// verilog-library-directories:("." "../../common/hdl")
|
|
|
|
// End:
|
2015-03-25 19:25:12 -04:00
|
|
|
|
2015-04-23 18:03:10 -04:00
|
|
|
//#############################################################################
|
2015-04-11 00:04:18 -04:00
|
|
|
/*
|
|
|
|
This file is part of the Parallella Project.
|
|
|
|
|
|
|
|
Copyright (C) 2014 Adapteva, Inc.
|
|
|
|
Contributed by Fred Huettig <fred@adapteva.com>
|
|
|
|
Contributed by Andreas Olofsson <andreas@adapteva.com>
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program (see the file COPYING). If not, see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
|
|
|
*/
|