OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [channelif/] [channelif4.v] - Blame information for rev 11

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
// FCP Channel Interface
2
 
3
module channelif4
4
(
5
        // To ethernet platform
6
        input                                   in_sof,
7
        input                                   in_eof,
8
        input                                   in_src_rdy,
9
        output                          in_dst_rdy,
10
        input           [7:0]            in_data,
11
        input           [3:0]            inport_addr,
12
        output                          out_sof,
13
        output                          out_eof,
14
        output                          out_src_rdy,
15
        input                                   out_dst_rdy,
16
        output  [7:0]            out_data,
17
        input           [3:0]            outport_addr,
18
        // Channel 1 
19
        input                                   ch1_in_sof,
20
        input                                   ch1_in_eof,
21
        input                                   ch1_in_src_rdy,
22
        output                          ch1_in_dst_rdy,
23
        input           [7:0]            ch1_in_data,
24
        output                          ch1_out_sof,
25
        output                          ch1_out_eof,
26
        output                          ch1_out_src_rdy,
27
        input                                   ch1_out_dst_rdy,
28
        output  [7:0]            ch1_out_data,
29
        output                          ch1_wen,
30
        output                          ch1_ren,
31
        // Channel 2 
32
        input                                   ch2_in_sof,
33
        input                                   ch2_in_eof,
34
        input                                   ch2_in_src_rdy,
35
        output                          ch2_in_dst_rdy,
36
        input           [7:0]            ch2_in_data,
37
        output                          ch2_out_sof,
38
        output                          ch2_out_eof,
39
        output                          ch2_out_src_rdy,
40
        input                                   ch2_out_dst_rdy,
41
        output  [7:0]            ch2_out_data,
42
        output                          ch2_wen,
43
        output                          ch2_ren,
44
        // Channel 3 
45
        input                                   ch3_in_sof,
46
        input                                   ch3_in_eof,
47
        input                                   ch3_in_src_rdy,
48
        output                          ch3_in_dst_rdy,
49
        input           [7:0]            ch3_in_data,
50
        output                          ch3_out_sof,
51
        output                          ch3_out_eof,
52
        output                          ch3_out_src_rdy,
53
        input                                   ch3_out_dst_rdy,
54
        output  [7:0]            ch3_out_data,
55
        output                          ch3_wen,
56
        output                          ch3_ren,
57
        // Channel 4 
58
        input                                   ch4_in_sof,
59
        input                                   ch4_in_eof,
60
        input                                   ch4_in_src_rdy,
61
        output                          ch4_in_dst_rdy,
62
        input           [7:0]            ch4_in_data,
63
        output                          ch4_out_sof,
64
        output                          ch4_out_eof,
65
        output                          ch4_out_src_rdy,
66
        input                                   ch4_out_dst_rdy,
67
        output  [7:0]            ch4_out_data,
68
        output                          ch4_wen,
69
        output                          ch4_ren,
70
 
71
        // To user logic
72
        output  [15:0]   wenables,
73
        output  [15:0]   renables
74
);
75
 
76
//-------------------------------------------------------------------------------------
77
//-------------------------------------------------------------------------------------
78
//                                          Channel-Enable Decoders
79
//-------------------------------------------------------------------------------------
80
//-------------------------------------------------------------------------------------
81
 
82
reg [15:0]               wenables_i;
83
reg [15:0]               renables_i;
84
 
85
always @(inport_addr)
86
begin
87
        case (inport_addr)
88
                4'h0 : wenables_i = 16'b0000000000000001;
89
                4'h1 : wenables_i = 16'b0000000000000010;
90
                4'h2 : wenables_i = 16'b0000000000000100;
91
                4'h3 : wenables_i = 16'b0000000000001000;
92
                4'h4 : wenables_i = 16'b0000000000010000;
93
                4'h5 : wenables_i = 16'b0000000000100000;
94
                4'h6 : wenables_i = 16'b0000000001000000;
95
                4'h7 : wenables_i = 16'b0000000010000000;
96
                4'h8 : wenables_i = 16'b0000000100000000;
97
                4'h9 : wenables_i = 16'b0000001000000000;
98
                4'hA : wenables_i = 16'b0000010000000000;
99
                4'hB : wenables_i = 16'b0000100000000000;
100
                4'hC : wenables_i = 16'b0001000000000000;
101
                4'hD : wenables_i = 16'b0010000000000000;
102
                4'hE : wenables_i = 16'b0100000000000000;
103
                4'hF : wenables_i = 16'b1000000000000000;
104
                default: wenables_i = 16'b0000000000000000;
105
        endcase
106
end
107
 
108
always @(outport_addr)
109
begin
110
        case (outport_addr)
111
                4'h0 : renables_i = 16'b0000000000000001;
112
                4'h1 : renables_i = 16'b0000000000000010;
113
                4'h2 : renables_i = 16'b0000000000000100;
114
                4'h3 : renables_i = 16'b0000000000001000;
115
                4'h4 : renables_i = 16'b0000000000010000;
116
                4'h5 : renables_i = 16'b0000000000100000;
117
                4'h6 : renables_i = 16'b0000000001000000;
118
                4'h7 : renables_i = 16'b0000000010000000;
119
                4'h8 : renables_i = 16'b0000000100000000;
120
                4'h9 : renables_i = 16'b0000001000000000;
121
                4'hA : renables_i = 16'b0000010000000000;
122
                4'hB : renables_i = 16'b0000100000000000;
123
                4'hC : renables_i = 16'b0001000000000000;
124
                4'hD : renables_i = 16'b0010000000000000;
125
                4'hE : renables_i = 16'b0100000000000000;
126
                4'hF : renables_i = 16'b1000000000000000;
127
                default: renables_i = 16'b0000000000000000;
128
        endcase
129
end
130
 
131
assign wenables = wenables_i;
132
assign renables = renables_i;
133
 
134
 
135
//-------------------------------------------------------------------------------------
136
//-------------------------------------------------------------------------------------
137
//                                          Multiplexers
138
//-------------------------------------------------------------------------------------
139
//-------------------------------------------------------------------------------------
140
 
141
 
142
assign in_dst_rdy = (ch1_wen & ch1_out_dst_rdy) | (ch2_wen & ch2_out_dst_rdy) | (ch3_wen & ch3_out_dst_rdy) | (ch4_wen & ch4_out_dst_rdy);
143
assign out_sof = (ch1_ren & ch1_in_sof) | (ch2_ren & ch2_in_sof) | (ch3_ren & ch3_in_sof) | (ch4_ren & ch4_in_sof);
144
assign out_eof = (ch1_ren & ch1_in_eof) | (ch2_ren & ch2_in_eof) | (ch3_ren & ch3_in_eof) | (ch4_ren & ch4_in_eof);
145
assign out_src_rdy = (ch1_ren & ch1_in_src_rdy) | (ch2_ren & ch2_in_src_rdy) | (ch3_ren & ch3_in_src_rdy) | (ch4_ren & ch4_in_src_rdy);
146
assign out_data = ({8{ch1_ren}} & ch1_in_data) | ({8{ch2_ren}} & ch2_in_data) | ({8{ch3_ren}} & ch3_in_data) | ({8{ch4_ren}} & ch4_in_data);
147
 
148
//-------------------------------------------------------------------------------------
149
//-------------------------------------------------------------------------------------
150
//                                          Passthroughs
151
//-------------------------------------------------------------------------------------
152
//-------------------------------------------------------------------------------------
153
 
154
assign ch1_in_dst_rdy = out_dst_rdy;
155
assign ch1_out_src_rdy = in_src_rdy;
156
assign ch1_out_sof = in_sof;
157
assign ch1_out_eof = in_eof;
158
assign ch1_out_data = in_data;
159
assign ch1_wen = wenables_i[1];
160
assign ch1_ren = renables_i[1];
161
 
162
assign ch2_in_dst_rdy = out_dst_rdy;
163
assign ch2_out_src_rdy = in_src_rdy;
164
assign ch2_out_sof = in_sof;
165
assign ch2_out_eof = in_eof;
166
assign ch2_out_data = in_data;
167
assign ch2_wen = wenables_i[2];
168
assign ch2_ren = renables_i[2];
169
 
170
assign ch3_in_dst_rdy = out_dst_rdy;
171
assign ch3_out_src_rdy = in_src_rdy;
172
assign ch3_out_sof = in_sof;
173
assign ch3_out_eof = in_eof;
174
assign ch3_out_data = in_data;
175
assign ch3_wen = wenables_i[3];
176
assign ch3_ren = renables_i[3];
177
 
178
assign ch4_in_dst_rdy = out_dst_rdy;
179
assign ch4_out_src_rdy = in_src_rdy;
180
assign ch4_out_sof = in_sof;
181
assign ch4_out_eof = in_eof;
182
assign ch4_out_data = in_data;
183
assign ch4_wen = wenables_i[4];
184
assign ch4_ren = renables_i[4];
185
 
186
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.