1 |
32 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2017 Authors and OPENCORES.ORG ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This source file may be used and distributed without ////
|
6 |
|
|
//// restriction provided that this copyright statement is not ////
|
7 |
|
|
//// removed from the file and that any derivative work contains ////
|
8 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// This source file is free software; you can redistribute it ////
|
11 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
12 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
13 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
14 |
|
|
//// later version. ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source is distributed in the hope that it will be ////
|
17 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
18 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
19 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
20 |
|
|
//// details. ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
23 |
|
|
//// Public License along with this source; if not, download it ////
|
24 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
25 |
|
|
//// ////
|
26 |
|
|
//////////////////////////////////////////////////////////////////////
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
module
|
30 |
|
|
riffa_chnl_w
|
31 |
|
|
#(
|
32 |
|
|
parameter C_NUM_CHNL,
|
33 |
|
|
parameter C_PCI_DATA_WIDTH,
|
34 |
|
|
parameter SIG_CHNL_LENGTH_W,
|
35 |
|
|
parameter SIG_CHNL_OFFSET_W
|
36 |
|
|
)
|
37 |
|
|
(
|
38 |
|
|
// RIFFA Interface Signals
|
39 |
|
|
output [C_NUM_CHNL-1:0] CHNL_RX_CLK, // Channel read clock
|
40 |
|
|
input [C_NUM_CHNL-1:0] CHNL_RX, // Channel read receive signal
|
41 |
|
|
output [C_NUM_CHNL-1:0] CHNL_RX_ACK, // Channel read received signal
|
42 |
|
|
input [C_NUM_CHNL-1:0] CHNL_RX_LAST, // Channel last read
|
43 |
|
|
input [(C_NUM_CHNL*SIG_CHNL_LENGTH_W)-1:0] CHNL_RX_LEN, // Channel read length
|
44 |
|
|
input [(C_NUM_CHNL*SIG_CHNL_OFFSET_W)-1:0] CHNL_RX_OFF, // Channel read offset
|
45 |
|
|
input [(C_NUM_CHNL*C_PCI_DATA_WIDTH)-1:0] CHNL_RX_DATA, // Channel read data
|
46 |
|
|
input [C_NUM_CHNL-1:0] CHNL_RX_DATA_VALID, // Channel read data valid
|
47 |
|
|
output [C_NUM_CHNL-1:0] CHNL_RX_DATA_REN, // Channel read data has been received
|
48 |
|
|
|
49 |
|
|
output [C_NUM_CHNL-1:0] CHNL_TX_CLK, // Channel write clock
|
50 |
|
|
output [C_NUM_CHNL-1:0] CHNL_TX, // Channel write receive signal
|
51 |
|
|
input [C_NUM_CHNL-1:0] CHNL_TX_ACK, // Channel write acknowledgment signal
|
52 |
|
|
output [C_NUM_CHNL-1:0] CHNL_TX_LAST, // Channel last write
|
53 |
|
|
output [(C_NUM_CHNL*SIG_CHNL_LENGTH_W)-1:0] CHNL_TX_LEN, // Channel write length (in 32 bit words)
|
54 |
|
|
output [(C_NUM_CHNL*SIG_CHNL_OFFSET_W)-1:0] CHNL_TX_OFF, // Channel write offset
|
55 |
|
|
output [(C_NUM_CHNL*C_PCI_DATA_WIDTH)-1:0] CHNL_TX_DATA, // Channel write data
|
56 |
|
|
output [C_NUM_CHNL-1:0] CHNL_TX_DATA_VALID, // Channel write data valid
|
57 |
|
|
input [C_NUM_CHNL-1:0] CHNL_TX_DATA_REN, // Channel write data has been received
|
58 |
|
|
|
59 |
39 |
qaztronic |
riffa_chnl_if chnl_bus[C_NUM_CHNL]
|
60 |
32 |
qaztronic |
);
|
61 |
|
|
|
62 |
|
|
// --------------------------------------------------------------------
|
63 |
|
|
//
|
64 |
|
|
genvar i;
|
65 |
|
|
generate
|
66 |
|
|
for (i = 0; i < C_NUM_CHNL; i = i + 1)
|
67 |
|
|
begin : channels
|
68 |
39 |
qaztronic |
assign CHNL_RX_CLK[i] = chnl_bus[i].rx_clk;
|
69 |
|
|
assign chnl_bus[i].rx = CHNL_RX[i];
|
70 |
|
|
assign CHNL_RX_ACK[i] = chnl_bus[i].rx_ack;
|
71 |
|
|
assign chnl_bus[i].rx_last = CHNL_RX_LAST[i];
|
72 |
|
|
assign chnl_bus[i].rx_len = CHNL_RX_LEN[SIG_CHNL_LENGTH_W*i +:SIG_CHNL_LENGTH_W];
|
73 |
|
|
assign chnl_bus[i].rx_off = CHNL_RX_OFF[SIG_CHNL_OFFSET_W*i +:SIG_CHNL_OFFSET_W];
|
74 |
|
|
assign chnl_bus[i].rx_data = CHNL_RX_DATA[C_PCI_DATA_WIDTH*i +:C_PCI_DATA_WIDTH];
|
75 |
|
|
assign chnl_bus[i].rx_data_valid = CHNL_RX_DATA_VALID[i];
|
76 |
|
|
assign CHNL_RX_DATA_REN[i] = chnl_bus[i].rx_data_ren;
|
77 |
32 |
qaztronic |
|
78 |
39 |
qaztronic |
assign CHNL_TX_CLK[i] = chnl_bus[i].tx_clk;
|
79 |
|
|
assign CHNL_TX[i] = chnl_bus[i].tx;
|
80 |
|
|
assign chnl_bus[i].tx_ack = CHNL_TX_ACK[i];
|
81 |
|
|
assign CHNL_TX_LAST[i] = chnl_bus[i].tx_last;
|
82 |
|
|
assign CHNL_TX_LEN[SIG_CHNL_LENGTH_W*i +:SIG_CHNL_LENGTH_W] = chnl_bus[i].tx_len;
|
83 |
|
|
assign CHNL_TX_OFF[SIG_CHNL_OFFSET_W*i +:SIG_CHNL_OFFSET_W] = chnl_bus[i].tx_off;
|
84 |
|
|
assign CHNL_TX_DATA[C_PCI_DATA_WIDTH*i +:C_PCI_DATA_WIDTH] = chnl_bus[i].tx_data;
|
85 |
|
|
assign CHNL_TX_DATA_VALID[i] = chnl_bus[i].tx_data_valid;
|
86 |
|
|
assign chnl_bus[i].tx_data_ren = CHNL_TX_DATA_REN[i];
|
87 |
32 |
qaztronic |
end
|
88 |
|
|
endgenerate
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
// // --------------------------------------------------------------------
|
92 |
|
|
// //
|
93 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX_CLK;
|
94 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX;
|
95 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX_ACK;
|
96 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX_LAST;
|
97 |
|
|
// wire [(C_NUM_CHNL*32)-1:0] CHNL_RX_LEN;
|
98 |
|
|
// wire [(C_NUM_CHNL*31)-1:0] CHNL_RX_OFF;
|
99 |
|
|
// wire [(C_NUM_CHNL*C_PCI_DATA_WIDTH)-1:0] CHNL_RX_DATA;
|
100 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX_DATA_VALID;
|
101 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_RX_DATA_REN;
|
102 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX_CLK;
|
103 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX;
|
104 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX_ACK;
|
105 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX_LAST;
|
106 |
|
|
// wire [(C_NUM_CHNL*32)-1:0] CHNL_TX_LEN;
|
107 |
|
|
// wire [(C_NUM_CHNL*31)-1:0] CHNL_TX_OFF;
|
108 |
|
|
// wire [(C_NUM_CHNL*C_PCI_DATA_WIDTH)-1:0] CHNL_TX_DATA;
|
109 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX_DATA_VALID;
|
110 |
|
|
// wire [C_NUM_CHNL-1:0] CHNL_TX_DATA_REN;
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
// --------------------------------------------------------------------
|
114 |
|
|
//
|
115 |
|
|
endmodule
|
116 |
|
|
|