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

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [channelif/] [channelif2.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
// FCP Channel Interface
2
 
3
module channelif2
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
 
45
        // To user logic
46
        output  [15:0]   wenables,
47
        output  [15:0]   renables
48
);
49
 
50
//-------------------------------------------------------------------------------------
51
//-------------------------------------------------------------------------------------
52
//                                          Channel-Enable Decoders
53
//-------------------------------------------------------------------------------------
54
//-------------------------------------------------------------------------------------
55
 
56
reg [15:0]               wenables_i;
57
reg [15:0]               renables_i;
58
 
59
always @(inport_addr)
60
begin
61
        case (inport_addr)
62
                4'h0 : wenables_i = 16'b0000000000000001;
63
                4'h1 : wenables_i = 16'b0000000000000010;
64
                4'h2 : wenables_i = 16'b0000000000000100;
65
                4'h3 : wenables_i = 16'b0000000000001000;
66
                4'h4 : wenables_i = 16'b0000000000010000;
67
                4'h5 : wenables_i = 16'b0000000000100000;
68
                4'h6 : wenables_i = 16'b0000000001000000;
69
                4'h7 : wenables_i = 16'b0000000010000000;
70
                4'h8 : wenables_i = 16'b0000000100000000;
71
                4'h9 : wenables_i = 16'b0000001000000000;
72
                4'hA : wenables_i = 16'b0000010000000000;
73
                4'hB : wenables_i = 16'b0000100000000000;
74
                4'hC : wenables_i = 16'b0001000000000000;
75
                4'hD : wenables_i = 16'b0010000000000000;
76
                4'hE : wenables_i = 16'b0100000000000000;
77
                4'hF : wenables_i = 16'b1000000000000000;
78
                default: wenables_i = 16'b0000000000000000;
79
        endcase
80
end
81
 
82
always @(outport_addr)
83
begin
84
        case (outport_addr)
85
                4'h0 : renables_i = 16'b0000000000000001;
86
                4'h1 : renables_i = 16'b0000000000000010;
87
                4'h2 : renables_i = 16'b0000000000000100;
88
                4'h3 : renables_i = 16'b0000000000001000;
89
                4'h4 : renables_i = 16'b0000000000010000;
90
                4'h5 : renables_i = 16'b0000000000100000;
91
                4'h6 : renables_i = 16'b0000000001000000;
92
                4'h7 : renables_i = 16'b0000000010000000;
93
                4'h8 : renables_i = 16'b0000000100000000;
94
                4'h9 : renables_i = 16'b0000001000000000;
95
                4'hA : renables_i = 16'b0000010000000000;
96
                4'hB : renables_i = 16'b0000100000000000;
97
                4'hC : renables_i = 16'b0001000000000000;
98
                4'hD : renables_i = 16'b0010000000000000;
99
                4'hE : renables_i = 16'b0100000000000000;
100
                4'hF : renables_i = 16'b1000000000000000;
101
                default: renables_i = 16'b0000000000000000;
102
        endcase
103
end
104
 
105
assign wenables = wenables_i;
106
assign renables = renables_i;
107
 
108
 
109
//-------------------------------------------------------------------------------------
110
//-------------------------------------------------------------------------------------
111
//                                          Multiplexers
112
//-------------------------------------------------------------------------------------
113
//-------------------------------------------------------------------------------------
114
 
115
 
116
assign in_dst_rdy = (ch1_wen & ch1_out_dst_rdy) | (ch2_wen & ch2_out_dst_rdy);
117
assign out_sof = (ch1_ren & ch1_in_sof) | (ch2_ren & ch2_in_sof);
118
assign out_eof = (ch1_ren & ch1_in_eof) | (ch2_ren & ch2_in_eof);
119
assign out_src_rdy = (ch1_ren & ch1_in_src_rdy) | (ch2_ren & ch2_in_src_rdy);
120
assign out_data = ({8{ch1_ren}} & ch1_in_data) | ({8{ch2_ren}} & ch2_in_data);
121
 
122
//-------------------------------------------------------------------------------------
123
//-------------------------------------------------------------------------------------
124
//                                          Passthroughs
125
//-------------------------------------------------------------------------------------
126
//-------------------------------------------------------------------------------------
127
 
128
assign ch1_in_dst_rdy = out_dst_rdy;
129
assign ch1_out_src_rdy = in_src_rdy;
130
assign ch1_out_sof = in_sof;
131
assign ch1_out_eof = in_eof;
132
assign ch1_out_data = in_data;
133
assign ch1_wen = wenables_i[1];
134
assign ch1_ren = renables_i[1];
135
 
136
assign ch2_in_dst_rdy = out_dst_rdy;
137
assign ch2_out_src_rdy = in_src_rdy;
138
assign ch2_out_sof = in_sof;
139
assign ch2_out_eof = in_eof;
140
assign ch2_out_data = in_data;
141
assign ch2_wen = wenables_i[2];
142
assign ch2_ren = renables_i[2];
143
 
144
endmodule

powered by: WebSVN 2.1.0

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