OpenCores
URL https://opencores.org/ocsvn/mac_layer_switch/mac_layer_switch/trunk

Subversion Repositories mac_layer_switch

[/] [mac_layer_switch/] [trunk/] [rtl/] [verilog/] [switch.v] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ranm11
/*****************************************************************************/
2
// Id ..........switch.v                                                 //
3
// Author.......Ran Minerbi                                                   //
4
//                                                                            //
5
//   Unit Description   :                                                     //
6
//     Top module of MAC Layer Ethernet Switch.                               //
7
//     The system has 6 ports , each one connected                            //
8
//     to Network Adapter (in hosts).                                         //
9
//     The system can  receive and transmit packets                           //
10
//     Simultaneously in full wire speed (100 MB/s).                          //
11
//                                                                            //
12
/*****************************************************************************/
13
 
14
 
15
`include "eth_phy_defines.v"
16
`include "wb_model_defines.v"
17
`include "tb_eth_defines.v"
18
`include "ethmac_defines.v"
19
`include "timescale.v"
20
`include "iba_modules.v"
21
`include "dcp_modules.v"
22
`include "dpq_modules.v"
23
`include "plu_moduls.v"
24 5 ranm11
//`include "Xbar_modules.v"
25 2 ranm11
 
26
 
27
 
28
//llu (, detect new frame,check crc, s2p) -> 
29
//parser check correctness , seperate from L2-> 
30
//iba (packet storage)-> 
31
//dcp(fdb)-> 
32
// dpq set in tq
33
`define NUM_OF_PORTS 6
34
module switch(pi1,pi2,pi3,pi4,pi5,pi6,po1,po2,po3,po4,po5,po6);
35
 
36
 //inout
37
 input [3:0] pi1,pi2,pi3,pi4,pi5,pi6;
38
 output [3:0] po1,po2,po3,po4,po5,po6;
39
 //wires
40
 wire  [31:0] Dw1_iba_i,Dw2_iba_i,Dw3_iba_i,Dw4_iba_i,Dw5_iba_i,Dw6_iba_i , Dw1_iba_o,Dw2_iba_o,Dw3_iba_o,Dw4_iba_o,Dw5_iba_o,Dw6_iba_o;
41
 wire  plu2iba_start_pack_1 , plu2iba_start_pack_2,plu2iba_start_pack_3,plu2iba_start_pack_4,plu2iba_start_pack_5,plu2iba_start_pack_6;
42
 wire  iba2plu_start_pack_1 , iba2plu_start_pack_2,iba2plu_start_pack_3,iba2plu_start_pack_4,iba2plu_start_pack_5,iba2plu_start_pack_6;
43
 wire  plu2iba_end_pack_1 , plu2iba_end_pack_2,plu2iba_end_pack_3,plu2iba_end_pack_4,plu2iba_end_pack_5,plu2iba_end_pack_6;
44
 wire  iba2plu_end_pack_1 , iba2plu_end_pack_2,iba2plu_end_pack_3,iba2plu_end_pack_4,iba2plu_end_pack_5,iba2plu_end_pack_6;
45
 
46
 
47
  reg clk , reset;
48
 
49
 
50
 
51
 initial
52
  begin
53
    clk=1 ;
54
 
55
              reset = 0;
56
     #62327   reset = 1;
57
     #60   reset = 0;
58
     end
59
always begin
60
     #20  clk = ~clk;
61
 end
62
 
63
 
64
plu plu1(   // need to add 6 inputs and 6 outputs to plu
65
     .reset(reset),.clk(clk) ,.pi1(pi1),.po1(po1),.Dw1i(Dw1_iba_o),.Dw1o(Dw1_iba_i),.plu2iba_start_pack_1(plu2iba_start_pack_1),.iba2plu_start_pack_1(iba2plu_start_pack_1),.plu2iba_end_pack_1(plu2iba_end_pack_1),.iba2plu_end_pack_1(iba2plu_end_pack_1),
66
                              .pi2(pi2),.po2(po2),.Dw2i(Dw2_iba_o),.Dw2o(Dw2_iba_i),.plu2iba_start_pack_2(plu2iba_start_pack_2),.iba2plu_start_pack_2(iba2plu_start_pack_2),.plu2iba_end_pack_2(plu2iba_end_pack_2),.iba2plu_end_pack_2(iba2plu_end_pack_2),
67
                              .pi3(pi3),.po3(po3),.Dw3i(Dw3_iba_o),.Dw3o(Dw3_iba_i),.plu2iba_start_pack_3(plu2iba_start_pack_3),.iba2plu_start_pack_3(iba2plu_start_pack_3),.plu2iba_end_pack_3(plu2iba_end_pack_3),.iba2plu_end_pack_3(iba2plu_end_pack_3),
68
                              .pi4(pi4),.po4(po4),.Dw4i(Dw4_iba_o),.Dw4o(Dw4_iba_i),.plu2iba_start_pack_4(plu2iba_start_pack_4),.iba2plu_start_pack_4(iba2plu_start_pack_4),.plu2iba_end_pack_4(plu2iba_end_pack_4),.iba2plu_end_pack_4(iba2plu_end_pack_4),
69
                              .pi5(pi5),.po5(po5),.Dw5i(Dw5_iba_o),.Dw5o(Dw5_iba_i),.plu2iba_start_pack_5(plu2iba_start_pack_5),.iba2plu_start_pack_5(iba2plu_start_pack_5),.plu2iba_end_pack_5(plu2iba_end_pack_5),.iba2plu_end_pack_5(iba2plu_end_pack_5),
70
                              .pi6(pi6),.po6(po6),.Dw6i(Dw6_iba_o),.Dw6o(Dw6_iba_i),.plu2iba_start_pack_6(plu2iba_start_pack_6),.iba2plu_start_pack_6(iba2plu_start_pack_6),.plu2iba_end_pack_6(plu2iba_end_pack_6),.iba2plu_end_pack_6(iba2plu_end_pack_6));
71
 
72
 
73
 
74
     IBA iba1(.reset(reset),.clk(clk),.Dw1_iba_i(Dw1_iba_i),.Dw1_iba_o(Dw1_iba_o),.plu2iba_start_pack_1(plu2iba_start_pack_1),.iba2plu_start_pack_1(iba2plu_start_pack_1),.plu2iba_end_pack_1(plu2iba_end_pack_1),.iba2plu_end_pack_1(iba2plu_end_pack_1),.headers_o1(headers_o1),.start_length1(start_length1),.transmit_done1(transmit_done1),.adr_valid1(adr_valid1),
75
                                      .Dw2_iba_i(Dw2_iba_i),.Dw2_iba_o(Dw2_iba_o),.plu2iba_start_pack_2(plu2iba_start_pack_2),.iba2plu_start_pack_2(iba2plu_start_pack_2),.plu2iba_end_pack_2(plu2iba_end_pack_2),.iba2plu_end_pack_2(iba2plu_end_pack_2),.headers_o2(headers_o2),.start_length2(start_length2),.transmit_done2(transmit_done2),.adr_valid2(adr_valid2),
76
                                      .Dw3_iba_i(Dw3_iba_i),.Dw3_iba_o(Dw3_iba_o),.plu2iba_start_pack_3(plu2iba_start_pack_3),.iba2plu_start_pack_3(iba2plu_start_pack_3),.plu2iba_end_pack_3(plu2iba_end_pack_3),.iba2plu_end_pack_3(iba2plu_end_pack_3),.headers_o3(headers_o3),.start_length3(start_length3),.transmit_done3(transmit_done3),.adr_valid3(adr_valid3),
77
                                      .Dw4_iba_i(Dw4_iba_i),.Dw4_iba_o(Dw4_iba_o),.plu2iba_start_pack_4(plu2iba_start_pack_4),.iba2plu_start_pack_4(iba2plu_start_pack_4),.plu2iba_end_pack_4(plu2iba_end_pack_4),.iba2plu_end_pack_4(iba2plu_end_pack_4),.headers_o4(headers_o4),.start_length4(start_length4),.transmit_done4(transmit_done4),.adr_valid4(adr_valid4),
78
                                      .Dw5_iba_i(Dw5_iba_i),.Dw5_iba_o(Dw5_iba_o),.plu2iba_start_pack_5(plu2iba_start_pack_5),.iba2plu_start_pack_5(iba2plu_start_pack_5),.plu2iba_end_pack_5(plu2iba_end_pack_5),.iba2plu_end_pack_5(iba2plu_end_pack_5),.headers_o5(headers_o5),.start_length5(start_length5),.transmit_done5(transmit_done5),.adr_valid5(adr_valid5),
79
                                      .Dw6_iba_i(Dw6_iba_i),.Dw6_iba_o(Dw6_iba_o),.plu2iba_start_pack_6(plu2iba_start_pack_6),.iba2plu_start_pack_6(iba2plu_start_pack_6),.plu2iba_end_pack_6(plu2iba_end_pack_6),.iba2plu_end_pack_6(iba2plu_end_pack_6),.headers_o6(headers_o6),.start_length6(start_length6),.transmit_done6(transmit_done6),.adr_valid6(adr_valid6));
80
 
81
 
82
  wire [31:0] headers_o1,headers_o2,headers_o3,headers_o4,headers_o5,headers_o6;
83
  wire  transmit_done1,transmit_done2,transmit_done3,transmit_done4,transmit_done5,transmit_done6;    // iba -> dpq 
84
 
85
    DCP dcp1(.reset(reset),.clk(clk),.headers_i1(headers_o1), .start_addr1(start_addr1),
86
                                      .headers_i2(headers_o2),.start_addr2(start_addr2),
87
                                      .headers_i3(headers_o3),.start_addr3(start_addr3),
88
                                      .headers_i4(headers_o4),.start_addr4(start_addr4),
89
                                      .headers_i5(headers_o5),.start_addr5(start_addr5),
90
                                      .headers_i6(headers_o6),.start_addr6(start_addr6));
91
 
92
  wire [31:0] start_addr1,start_addr2,start_addr3,start_addr4,start_addr5,start_addr6; //to dpq
93
 
94
  DPQ dpq1(.reset(reset),.clk(clk),.start_addr1(start_addr1),.T_q1(T_q1),.start_length1(start_length1),.transmit_done1(transmit_done1),.adr_valid1(adr_valid1),
95
                                   .start_addr2(start_addr2),.T_q2(T_q2),.start_length2(start_length2),.transmit_done2(transmit_done2),.adr_valid2(adr_valid2),
96
                                   .start_addr3(start_addr3),.T_q3(T_q3),.start_length3(start_length3),.transmit_done3(transmit_done3),.adr_valid3(adr_valid3),
97
                                   .start_addr4(start_addr4),.T_q4(T_q4),.start_length4(start_length4),.transmit_done4(transmit_done4),.adr_valid4(adr_valid4),
98
                                   .start_addr5(start_addr5),.T_q5(T_q5),.start_length5(start_length5),.transmit_done5(transmit_done5),.adr_valid5(adr_valid5),
99
                                   .start_addr6(start_addr6),.T_q6(T_q6),.start_length6(start_length6),.transmit_done6(transmit_done6),.adr_valid6(adr_valid6));
100
 
101
 
102
 
103
  wire [7:0] T_q1,T_q2,T_q3,T_q4,T_q5,T_q6; // dpq->Xbar     
104
  wire [15:0] start_length1,start_length2,start_length3,start_length4,start_length5,start_length6,start_length7,start_length8;//to IBA
105
  wire adr_valid1,adr_valid2,adr_valid3,adr_valid4,adr_valid5,adr_valid6;
106
 
107
  Xbar xbar1 (.reset(reset),.clk(clk),.T_q1(T_q1),.Data_i1(Dw1_iba_o),.Data_o1(xbar_2_plu1),.xbar2plu_start_pack_1(xbar2plu_start_pack_1),.xbar2plu_end_pack_1(xbar2plu_end_pack_1), //  iba2xbar_start_pack_1,iba2xbar_end_pack_1,
108
                                      .T_q2(T_q2),.Data_i2(Dw2_iba_o),.Data_o2(xbar_2_plu2),.xbar2plu_start_pack_2(xbar2plu_start_pack_2),.xbar2plu_end_pack_2(xbar2plu_end_pack_2), //  iba2xbar_start_pack_2,iba2xbar_end_pack_2,
109
                                      .T_q3(T_q3),.Data_i3(Dw3_iba_o),.Data_o3(xbar_2_plu3),.xbar2plu_start_pack_3(xbar2plu_start_pack_3),.xbar2plu_end_pack_3(xbar2plu_end_pack_3), //  iba2xbar_start_pack_3,iba2xbar_end_pack_3,
110
                                      .T_q4(T_q4),.Data_i4(Dw4_iba_o),.Data_o4(xbar_2_plu4),.xbar2plu_start_pack_4(xbar2plu_start_pack_4),.xbar2plu_end_pack_4(xbar2plu_end_pack_4), //  iba2xbar_start_pack_4,iba2xbar_end_pack_4,
111
                                      .T_q5(T_q5),.Data_i5(Dw5_iba_o),.Data_o5(xbar_2_plu5),.xbar2plu_start_pack_5(xbar2plu_start_pack_5),.xbar2plu_end_pack_5(xbar2plu_end_pack_5), //  iba2xbar_start_pack_5,iba2xbar_end_pack_5,
112
                                      .T_q6(T_q6),.Data_i6(Dw6_iba_o),.Data_o6(xbar_2_plu6),.xbar2plu_start_pack_6(xbar2plu_start_pack_6),.xbar2plu_end_pack_6(xbar2plu_end_pack_6));//  iba2xbar_start_pack_6,iba2xbar_end_pack_6,
113
 
114
  wire [31:0] xbar_2_plu1,xbar_2_plu2,xbar_2_plu3,xbar_2_plu4,xbar_2_plu5,xbar_2_plu6;
115
  wire xbar2plu_start_pack_1,xbar2plu_end_pack_1,
116
       xbar2plu_start_pack_2,xbar2plu_end_pack_2,
117
       xbar2plu_start_pack_3,xbar2plu_end_pack_3,
118
       xbar2plu_start_pack_4,xbar2plu_end_pack_4,
119
       xbar2plu_start_pack_5,xbar2plu_end_pack_5,
120
       xbar2plu_start_pack_6,xbar2plu_end_pack_6;
121
 
122
 
123
 
124
endmodule
125
 
126
 
127
// serial 4 inputs to parallel 32       
128
//  4 inputs to 4 outputs
129
module plu (reset,clk , pi1,pi2,pi3,pi4,pi5,pi6, po1, po2,po3, po4,po5, po6, Dw1i,Dw2i,Dw3i,Dw4i,Dw5i,Dw6i , Dw1o,Dw2o,Dw3o,Dw4o,Dw5o,Dw6o,
130
            plu2iba_start_pack_1 , plu2iba_start_pack_2,plu2iba_start_pack_3,plu2iba_start_pack_4,plu2iba_start_pack_5,plu2iba_start_pack_6,
131
            iba2plu_start_pack_1 , iba2plu_start_pack_2,iba2plu_start_pack_3,iba2plu_start_pack_4,iba2plu_start_pack_5,iba2plu_start_pack_6,
132
            plu2iba_end_pack_1 , plu2iba_end_pack_2,plu2iba_end_pack_3,plu2iba_end_pack_4,plu2iba_end_pack_5,plu2iba_end_pack_6,
133
            iba2plu_end_pack_1 , iba2plu_end_pack_2,iba2plu_end_pack_3,iba2plu_end_pack_4,iba2plu_end_pack_5,iba2plu_end_pack_6
134
 
135
);
136
   input  reset , clk;
137
   input  [3:0] pi1,pi2,pi3,pi4,pi5,pi6;
138
   output [3:0] po1, po2,po3, po4,po5, po6;
139
   output [31:0]  Dw1o,Dw2o,Dw3o,Dw4o,Dw5o,Dw6o;//  to IBA
140 4 ranm11
   input  [31:0] Dw1i,Dw2i,Dw3i,Dw4i,Dw5i,Dw6i;//  from Xbar
141 2 ranm11
   output  plu2iba_start_pack_1 , plu2iba_start_pack_2,plu2iba_start_pack_3,plu2iba_start_pack_4,plu2iba_start_pack_5,plu2iba_start_pack_6;
142
   input   iba2plu_start_pack_1 , iba2plu_start_pack_2,iba2plu_start_pack_3,iba2plu_start_pack_4,iba2plu_start_pack_5,iba2plu_start_pack_6;
143
    output    plu2iba_end_pack_1 , plu2iba_end_pack_2,plu2iba_end_pack_3,plu2iba_end_pack_4,plu2iba_end_pack_5,plu2iba_end_pack_6;
144
    input    iba2plu_end_pack_1 , iba2plu_end_pack_2,iba2plu_end_pack_3,iba2plu_end_pack_4,iba2plu_end_pack_5,iba2plu_end_pack_6;
145
 
146
   wire  RxStartFrm1 , RxEndFrm1;
147
   wire  RxStartFrm2 , RxEndFrm2;
148
   wire  RxStartFrm3 , RxEndFrm3;
149
   wire  RxStartFrm4 , RxEndFrm4;
150
   wire  RxStartFrm5 , RxEndFrm5;
151
   wire  RxStartFrm6 , RxEndFrm6;
152
 
153
   wire [31:0] Dw1,Dw2,Dw3,Dw4,Dw5,Dw6;
154
   wire [7:0] word1,word2,word3,word4,word5,word6;
155
   wire [7:0] word_back1,word_back2,word_back3,word_back4,word_back5,word_back6;
156
 
157
   wire  TxStartFrm1_dw , TxEndFrm1_dw;
158
   wire  TxStartFrm2_dw , TxEndFrm2_dw;
159
   wire  TxStartFrm3_dw , TxEndFrm3_dw;
160
   wire  TxStartFrm4_dw , TxEndFrm4_dw;
161
   wire  TxStartFrm5_dw , TxEndFrm5_dw;
162
   wire  TxStartFrm6_dw , TxEndFrm6_dw;
163
   // start/ end  frames from Dw_2_word to  word_2_nibble
164
   wire  TxStartFrm1 , TxEndFrm1;
165
   wire  TxStartFrm2 , TxEndFrm2;
166
   wire  TxStartFrm3 , TxEndFrm3;
167
   wire  TxStartFrm4 , TxEndFrm4;
168
   wire  TxStartFrm5 , TxEndFrm5;
169
   wire  TxStartFrm6 , TxEndFrm6;
170
 
171
    //  plu_serdes plu_serdes1(.reset(reset),.clk(clk) ,.pi1(pi1),.po1(po1),.RxStartFrm_out(RxStartFrm1) , .RxEndFrm_out(RxEndFrm1));
172
      // plu_serdes plu_serdes2(.reset(reset),.clk(clk) ,.pi1(pi2),.po1(po2),.RxStartFrm_out(RxStartFrm2) , .RxEndFrm_out(RxEndFrm2));
173
 
174
       nibble_2_word nibble_2_word1(.reset(reset),.clk(clk) , .pi1(pi1),   .Tx7in(word1) ,.RxStartFrm_out(RxStartFrm1) , .RxEndFrm_out(RxEndFrm1));
175
       word_2_nibble word_2_nibble1(.reset(reset),.clk(clk) , .po1(po1) , .RxData(word_back1) ,    .RxStartFrm(TxStartFrm1) ,     .RxEndFrm(TxEndFrm1));
176
       nibble_2_word nibble_2_word2(.reset(reset),.clk(clk) , .pi1(pi2),   .Tx7in(word2) ,.RxStartFrm_out(RxStartFrm2) , .RxEndFrm_out(RxEndFrm2));
177
       word_2_nibble word_2_nibble2(.reset(reset),.clk(clk) , .po1(po2) , .RxData(word_back2) ,    .RxStartFrm(TxStartFrm2) ,     .RxEndFrm(TxEndFrm2));
178
       nibble_2_word nibble_2_word3(.reset(reset),.clk(clk)  ,.pi1(pi3),   .Tx7in(word3) ,.RxStartFrm_out(RxStartFrm3) , .RxEndFrm_out(RxEndFrm3));
179
       word_2_nibble word_2_nibble3(.reset(reset),.clk(clk) , .po1(po3) , .RxData(word3) ,    .RxStartFrm(RxStartFrm3) ,     .RxEndFrm(RxEndFrm3));
180
       nibble_2_word nibble_2_word4(.reset(reset),.clk(clk)  ,.pi1(pi4),   .Tx7in(word4) ,.RxStartFrm_out(RxStartFrm4) , .RxEndFrm_out(RxEndFrm4));
181
       word_2_nibble word_2_nibble4(.reset(reset),.clk(clk) , .po1(po4) , .RxData(word4) ,    .RxStartFrm(RxStartFrm4) ,     .RxEndFrm(RxEndFrm4));
182
       nibble_2_word nibble_2_word5(.reset(reset),.clk(clk)  ,.pi1(pi5),   .Tx7in(word5) ,.RxStartFrm_out(RxStartFrm5) , .RxEndFrm_out(RxEndFrm5));
183
       word_2_nibble word_2_nibble5(.reset(reset),.clk(clk) , .po1(po5) , .RxData(word5) ,    .RxStartFrm(RxStartFrm5) ,     .RxEndFrm(RxEndFrm5));
184
       nibble_2_word nibble_2_word6(.reset(reset),.clk(clk)  ,.pi1(pi6),   .Tx7in(word6) ,.RxStartFrm_out(RxStartFrm6) , .RxEndFrm_out(RxEndFrm6));
185
       word_2_nibble word_2_nibble6(.reset(reset),.clk(clk) , .po1(po6) , .RxData(word6) ,    .RxStartFrm(RxStartFrm6) ,     .RxEndFrm(RxEndFrm6));
186
 
187
 
188
       word_to_Dword word_to_Dword1(.reset(reset),.clk(clk) ,.in1({word1,RxStartFrm1,RxEndFrm1}),
189
                                                             .in2({word2,RxStartFrm2,RxEndFrm2}),
190
                                                             .in3({word3,RxStartFrm3,RxEndFrm3}),
191
                                                             .in4({word4,RxStartFrm4,RxEndFrm4}),
192
                                                             .in5({word5,RxStartFrm5,RxEndFrm5}),
193
                                                             .in6({word6,RxStartFrm6,RxEndFrm6}),
194
                                                             .out1(Dw1o),.RxStartFrm1(plu2iba_start_pack_1) ,.RxEndFrm1(plu2iba_end_pack_1),
195
                                                             .out2(Dw2o),.RxStartFrm2(plu2iba_start_pack_2) ,.RxEndFrm2(plu2iba_end_pack_2),
196
                                                             .out3(Dw3o),.RxStartFrm3(plu2iba_start_pack_3) ,.RxEndFrm3(plu2iba_end_pack_3),
197
                                                             .out4(Dw4o),.RxStartFrm4(plu2iba_start_pack_4) ,.RxEndFrm4(plu2iba_end_pack_4),
198
                                                             .out5(Dw5o),.RxStartFrm5(plu2iba_start_pack_5) ,.RxEndFrm5(plu2iba_end_pack_5),
199
                                                             .out6(Dw6o),.RxStartFrm6(plu2iba_start_pack_6) ,.RxEndFrm6(plu2iba_end_pack_6));
200
 
201
        //insert mem   IBA
202
 
203
       Dword_to_byte Dword_to_byte1(.reset(reset),.clk(clk), .byte(word_back1) ,.Dword(Dw1i) ,.TxStartFrm(iba2plu_start_pack_1),.TxEndFrm(iba2plu_end_pack_1),.TxStartFrm_0(TxStartFrm1),.TxEndFrm_1(TxEndFrm1));
204
       Dword_to_byte Dword_to_byte2(.reset(reset),.clk(clk), .byte(word_back2) ,.Dword(Dw2i) ,.TxStartFrm(iba2plu_start_pack_2),.TxEndFrm(iba2plu_end_pack_2),.TxStartFrm_0(TxStartFrm2),.TxEndFrm_1(TxEndFrm2));
205 6 ranm11
       Dword_to_byte Dword_to_byte3(.reset(reset),.clk(clk), .byte(word_back3) ,.Dword(Dw3i) ,.TxStartFrm(iba2plu_start_pack_3),.TxEndFrm(iba2plu_end_pack_3),.TxStartFrm_0(TxStartFrm3),.TxEndFrm_1(TxEndFrm3));
206
       Dword_to_byte Dword_to_byte4(.reset(reset),.clk(clk), .byte(word_back4) ,.Dword(Dw4i) ,.TxStartFrm(iba2plu_start_pack_4),.TxEndFrm(iba2plu_end_pack_4),.TxStartFrm_0(TxStartFrm4),.TxEndFrm_1(TxEndFrm4));
207
       Dword_to_byte Dword_to_byte5(.reset(reset),.clk(clk), .byte(word_back5) ,.Dword(Dw5i) ,.TxStartFrm(iba2plu_start_pack_5),.TxEndFrm(iba2plu_end_pack_5),.TxStartFrm_0(TxStartFrm5),.TxEndFrm_1(TxEndFrm5));
208
       Dword_to_byte Dword_to_byte6(.reset(reset),.clk(clk), .byte(word_back6) ,.Dword(Dw6i) ,.TxStartFrm(iba2plu_start_pack_6),.TxEndFrm(iba2plu_end_pack_6),.TxStartFrm_0(TxStartFrm6),.TxEndFrm_1(TxEndFrm6));
209 2 ranm11
 
210
  endmodule
211
 
212
   //need an output of start/end Frm goes to Xbar to PLU           
213
   module IBA(reset,clk ,Dw1_iba_i,Dw1_iba_o,plu2iba_start_pack_1,iba2plu_start_pack_1,plu2iba_end_pack_1,iba2plu_end_pack_1,headers_o1,start_length1,transmit_done1,adr_valid1,
214
                         Dw2_iba_i,Dw2_iba_o,plu2iba_start_pack_2,iba2plu_start_pack_2,plu2iba_end_pack_2,iba2plu_end_pack_2,headers_o2,start_length2,transmit_done2,adr_valid2,
215
                         Dw3_iba_i,Dw3_iba_o,plu2iba_start_pack_3,iba2plu_start_pack_3,plu2iba_end_pack_3,iba2plu_end_pack_3,headers_o3,start_length3,transmit_done3,adr_valid3,
216
                         Dw4_iba_i,Dw4_iba_o,plu2iba_start_pack_4,iba2plu_start_pack_4,plu2iba_end_pack_4,iba2plu_end_pack_4,headers_o4,start_length4,transmit_done4,adr_valid4,
217
                         Dw5_iba_i,Dw5_iba_o,plu2iba_start_pack_5,iba2plu_start_pack_5,plu2iba_end_pack_5,iba2plu_end_pack_5,headers_o5,start_length5,transmit_done5,adr_valid5,
218
                         Dw6_iba_i,Dw6_iba_o,plu2iba_start_pack_6,iba2plu_start_pack_6,plu2iba_end_pack_6,iba2plu_end_pack_6,headers_o6,start_length6,transmit_done6,adr_valid6
219
 
220
 
221
 
222
 
223
   );
224
       input reset, clk;
225
       input [31:0] Dw1_iba_i,Dw2_iba_i,Dw3_iba_i,Dw4_iba_i,Dw5_iba_i,Dw6_iba_i;
226
       output [31:0] Dw1_iba_o,Dw2_iba_o,Dw3_iba_o,Dw4_iba_o,Dw5_iba_o,Dw6_iba_o;
227
       output [31:0] headers_o1,headers_o2,headers_o3,headers_o4,headers_o5,headers_o6;
228
       input    plu2iba_start_pack_1 , plu2iba_start_pack_2,plu2iba_start_pack_3,plu2iba_start_pack_4,plu2iba_start_pack_5,plu2iba_start_pack_6;
229
       output   iba2plu_start_pack_1 , iba2plu_start_pack_2,iba2plu_start_pack_3,iba2plu_start_pack_4,iba2plu_start_pack_5,iba2plu_start_pack_6;
230
       input    plu2iba_end_pack_1 , plu2iba_end_pack_2,plu2iba_end_pack_3,plu2iba_end_pack_4,plu2iba_end_pack_5,plu2iba_end_pack_6;
231
       output   iba2plu_end_pack_1 , iba2plu_end_pack_2,iba2plu_end_pack_3,iba2plu_end_pack_4,iba2plu_end_pack_5,iba2plu_end_pack_6;
232
       input [15:0] start_length1,start_length2,start_length3,start_length4,start_length5,start_length6;//from DPQ
233
       input adr_valid1,adr_valid2,adr_valid3,adr_valid4,adr_valid5,adr_valid6;
234
        output  transmit_done1,
235
                transmit_done2,
236
                transmit_done3,
237
                transmit_done4,
238
                transmit_done5,
239
                transmit_done6;
240
 
241 4 ranm11
       assign  Dw1_iba_o=mem_u_o1;
242 6 ranm11
       assign  Dw2_iba_o=mem_u_o2;
243 4 ranm11
       assign  Dw3_iba_o=mem_u_o3;
244
       assign  Dw4_iba_o=mem_u_o4;
245
       assign  Dw5_iba_o=mem_u_o5;
246
       assign  Dw6_iba_o=mem_u_o6;
247 2 ranm11
 
248 4 ranm11
       assign iba2plu_start_pack_1 = 0;
249
       assign iba2plu_start_pack_2 = 0;
250 2 ranm11
       assign iba2plu_start_pack_3 = plu2iba_start_pack_3;
251
       assign iba2plu_start_pack_4 = plu2iba_start_pack_4;
252
       assign iba2plu_start_pack_5 = plu2iba_start_pack_5;
253
       assign iba2plu_start_pack_6 = plu2iba_start_pack_6;
254
 
255 4 ranm11
       assign iba2plu_end_pack_1 = 0;
256
       assign iba2plu_end_pack_2 = 0;
257 2 ranm11
       assign iba2plu_end_pack_3 = plu2iba_end_pack_3;
258
       assign iba2plu_end_pack_4 = plu2iba_end_pack_4;
259
       assign iba2plu_end_pack_5 = plu2iba_end_pack_5;
260
       assign iba2plu_end_pack_6 = plu2iba_end_pack_6;
261
       wire [31:0] mem_u_o1,mem_u_o2,mem_u_o3,mem_u_o4,mem_u_o5,mem_u_o6;
262
 
263
 
264
        mem_units mem_units1(.reset(reset),.clk(clk),
265
                             .Dw1_iba_i(Dw1_iba_i) ,.Dw2_iba_i(Dw2_iba_i),.Dw3_iba_i(Dw3_iba_i),.Dw4_iba_i(Dw4_iba_i),.Dw5_iba_i(Dw5_iba_i),.Dw6_iba_i(Dw6_iba_i),
266
                             .mem_u_o1(mem_u_o1), .mem_u_o2(mem_u_o2),.mem_u_o3(mem_u_o3),.mem_u_o4(mem_u_o4),.mem_u_o5(mem_u_o5),.mem_u_o6(mem_u_o6),
267
                             .StartFrm1(plu2iba_start_pack_1) ,.EndFrm1(plu2iba_end_pack_1),. headers_o1(headers_o1),.start_length1(start_length1),.transmit_done1(transmit_done1),.adr_valid1(adr_valid1),
268
                             .StartFrm2(plu2iba_start_pack_2) ,.EndFrm2(plu2iba_end_pack_2),. headers_o2(headers_o2),.start_length2(start_length2),.transmit_done2(transmit_done2),.adr_valid2(adr_valid2),
269
                             .StartFrm3(plu2iba_start_pack_3) ,.EndFrm3(plu2iba_end_pack_3),. headers_o3(headers_o3),.start_length3(start_length3),.transmit_done3(transmit_done3),.adr_valid3(adr_valid3),
270
                             .StartFrm4(plu2iba_start_pack_4) ,.EndFrm4(plu2iba_end_pack_4),. headers_o4(headers_o4),.start_length4(start_length4),.transmit_done4(transmit_done4),.adr_valid4(adr_valid4),
271
                             .StartFrm5(plu2iba_start_pack_5) ,.EndFrm5(plu2iba_end_pack_5),. headers_o5(headers_o5),.start_length5(start_length5),.transmit_done5(transmit_done5),.adr_valid5(adr_valid5),
272
                             .StartFrm6(plu2iba_start_pack_6) ,.EndFrm6(plu2iba_end_pack_6),. headers_o6(headers_o6),.start_length6(start_length6),.transmit_done6(transmit_done6),.adr_valid6(adr_valid6));
273
 
274
 
275
   endmodule
276
 
277
 
278
   //there is FDB queueing - getting from 6 channels simultaneously .
279
   // At first we will have 1 fdb per each channel 
280
   // move to DPQ |00|length|start_addr|T_q|
281
   module DCP(reset,clk,headers_i1,headers_i2,headers_i3,headers_i4,headers_i5,headers_i6,
282
                        start_addr1,start_addr2,start_addr3,start_addr4,start_addr5,start_addr6
283
                       /* ,T_q1,T_q2,T_q3,T_q4,T_q5,T_q6*/);
284
 
285
         input reset, clk;
286
         input [31:0] headers_i1,headers_i2,headers_i3,headers_i4,headers_i5,headers_i6;
287
         output [31:0] start_addr1,start_addr2,start_addr3,start_addr4,start_addr5,start_addr6; //to dpq
288
         wire [4:0] T_q1,T_q2,T_q3,T_q4,T_q5,T_q6; // to dpq
289
 
290
         wire[47:0] dmac1,dmac2,dmac3,dmac4,dmac5,dmac6;
291
         wire[15:0] start_length1,start_length2,start_length3,start_length4,start_length5,start_length6;
292
         Header_parser header_parser1(.reset(reset),.clk(clk),.header_i(headers_i1),.Dmac(dmac1),.Start_addr(start_length1));
293
         Header_parser header_parser2(.reset(reset),.clk(clk),.header_i(headers_i2),.Dmac(dmac2),.Start_addr(start_length2));
294
         Header_parser header_parser3(.reset(reset),.clk(clk),.header_i(headers_i3),.Dmac(dmac3),.Start_addr(start_length3));
295
         Header_parser header_parser4(.reset(reset),.clk(clk),.header_i(headers_i4),.Dmac(dmac4),.Start_addr(start_length4));
296
         Header_parser header_parser5(.reset(reset),.clk(clk),.header_i(headers_i5),.Dmac(dmac5),.Start_addr(start_length5));
297
         Header_parser header_parser6(.reset(reset),.clk(clk),.header_i(headers_i6),.Dmac(dmac6),.Start_addr(start_length6));
298
 
299
         FDB fdb1(.reset(reset),.clk(clk),.dmac(dmac1),.T_q(T_q1));
300
         FDB fdb2(.reset(reset),.clk(clk),.dmac(dmac2),.T_q(T_q2));
301
         FDB fdb3(.reset(reset),.clk(clk),.dmac(dmac3),.T_q(T_q3));
302
         FDB fdb4(.reset(reset),.clk(clk),.dmac(dmac4),.T_q(T_q4));
303
         FDB fdb5(.reset(reset),.clk(clk),.dmac(dmac5),.T_q(T_q5));
304
         FDB fdb6(.reset(reset),.clk(clk),.dmac(dmac6),.T_q(T_q6));
305
 
306
         assign start_addr1 = {8'b0,start_length1,3'b0,T_q1};
307
         assign start_addr2 = {8'b0,start_length2,3'b0,T_q2};
308
         assign start_addr3 = {8'b0,start_length3,3'b0,T_q3};
309
         assign start_addr4 = {8'b0,start_length4,3'b0,T_q4};
310
         assign start_addr5 = {8'b0,start_length5,3'b0,T_q5};
311
         assign start_addr6 = {8'b0,start_length6,3'b0,T_q6};
312
 
313
   endmodule
314
                  //input from fdb |8'b0|length|start_addr|3'b0|T_q|, out to iba-start_addr+length, to Xb outport                      
315
  module DPQ(reset,clk, start_addr1,start_length1,T_q1,transmit_done1,adr_valid1,
316
                        start_addr2,start_length2,T_q2,transmit_done2,adr_valid2,
317
                        start_addr3,start_length3,T_q3,transmit_done3,adr_valid3,
318
                        start_addr4,start_length4,T_q4,transmit_done4,adr_valid4,
319
                        start_addr5,start_length5,T_q5,transmit_done5,adr_valid5,
320
                        start_addr6,start_length6,T_q6,transmit_done6,adr_valid6);
321
 
322
       input reset, clk;
323
       input [31:0] start_addr1,start_addr2,start_addr3,start_addr4,start_addr5,start_addr6;//from dcp
324
       output [7:0] T_q1,T_q2,T_q3,T_q4,T_q5,T_q6,T_q7,T_q8;//to Xb
325
       output [15:0] start_length1,start_length2,start_length3,start_length4,start_length5,start_length6,start_length7,start_length8;//to IBA
326
       input  transmit_done1,
327
              transmit_done2,
328
              transmit_done3,
329
              transmit_done4,
330
              transmit_done5,
331
              transmit_done6;
332
       output adr_valid1,adr_valid2,adr_valid3,adr_valid4,adr_valid5,adr_valid6;
333
 
334
 
335
       //fifo Qps need to validate addr_valid in the end
336
    Qp qp1(.reset(reset),.clk(clk),.transmit_done(transmit_done1),.Din(start_addr1),.start_adr(start_length1),.T_q(T_q1),.adr_valid(adr_valid1));
337 4 ranm11
    Qp qp2(.reset(reset),.clk(clk),.transmit_done(transmit_done2),.Din(start_addr2),.start_adr(start_length2),.T_q(T_q2),.adr_valid(adr_valid2));
338
    Qp qp3(.reset(reset),.clk(clk),.transmit_done(transmit_done3),.Din(start_addr3),.start_adr(start_length3),.T_q(T_q3),.adr_valid(adr_valid3));
339
    Qp qp4(.reset(reset),.clk(clk),.transmit_done(transmit_done4),.Din(start_addr4),.start_adr(start_length4),.T_q(T_q4),.adr_valid(adr_valid4));
340
    Qp qp5(.reset(reset),.clk(clk),.transmit_done(transmit_done5),.Din(start_addr5),.start_adr(start_length5),.T_q(T_q5),.adr_valid(adr_valid5));
341
    Qp qp6(.reset(reset),.clk(clk),.transmit_done(transmit_done6),.Din(start_addr6),.start_adr(start_length6),.T_q(T_q6),.adr_valid(adr_valid6));
342 2 ranm11
 
343
   endmodule
344
 
345
 
346
   module Xbar(reset,clk,T_q1,Data_i1,Data_o1,xbar2plu_start_pack_1,xbar2plu_end_pack_1,   //  iba2xbar_start_pack_1,iba2xbar_end_pack_1,
347
                         T_q2,Data_i2,Data_o2,xbar2plu_start_pack_2,xbar2plu_end_pack_2,   //  iba2xbar_start_pack_2,iba2xbar_end_pack_2,
348
                         T_q3,Data_i3,Data_o3,xbar2plu_start_pack_3,xbar2plu_end_pack_3,   //  iba2xbar_start_pack_3,iba2xbar_end_pack_3,
349
                         T_q4,Data_i4,Data_o4,xbar2plu_start_pack_4,xbar2plu_end_pack_4,   //  iba2xbar_start_pack_4,iba2xbar_end_pack_4,
350
                         T_q5,Data_i5,Data_o5,xbar2plu_start_pack_5,xbar2plu_end_pack_5,   //  iba2xbar_start_pack_5,iba2xbar_end_pack_5,
351
                         T_q6,Data_i6,Data_o6,xbar2plu_start_pack_6,xbar2plu_end_pack_6);  //  iba2xbar_start_pack_6,iba2xbar_end_pack_6,
352
 
353
     input reset,clk;
354
     input [7:0]    T_q1,T_q2,T_q3,T_q4,T_q5,T_q6;
355
     input [31:0]   Data_i1,Data_i2,Data_i3,Data_i4,Data_i5,Data_i6;
356
     output [31:0]  Data_o1,Data_o2,Data_o3,Data_o4,Data_o5,Data_o6;
357
     input        iba2xbar_start_pack_1,iba2xbar_end_pack_1,
358
                  iba2xbar_start_pack_2,iba2xbar_end_pack_2,
359
                  iba2xbar_start_pack_3,iba2xbar_end_pack_3,
360
                  iba2xbar_start_pack_4,iba2xbar_end_pack_4,
361
                  iba2xbar_start_pack_5,iba2xbar_end_pack_5,
362
                  iba2xbar_start_pack_6,iba2xbar_end_pack_6;
363
 
364
     output       xbar2plu_start_pack_1,xbar2plu_end_pack_1,
365
                  xbar2plu_start_pack_2,xbar2plu_end_pack_2,
366
                  xbar2plu_start_pack_3,xbar2plu_end_pack_3,
367
                  xbar2plu_start_pack_4,xbar2plu_end_pack_4,
368
                  xbar2plu_start_pack_5,xbar2plu_end_pack_5,
369
                  xbar2plu_start_pack_6,xbar2plu_end_pack_6;
370
     reg [31:0]  Data_o1,Data_o2,Data_o3,Data_o4,Data_o5,Data_o6;
371
 
372
          //create module that create start/end packet signals detect by delay and xor 
373
          // delimiter_add                                                             
374 5 ranm11
 //   Alignment_marker align1(.reset(reset),.clk(clk),.Data_o(Data_o1),.iba2xbar_start_pack(iba2xbar_start_pack),.iba2xbar_end_pack(iba2xbar_end_pack),.xbar2plu_start_pack(xbar2plu_start_pack),.xbar2plu_end_pack(xbar2plu_end_pack));
375 2 ranm11
 
376
         always @ (posedge clk)
377
        begin
378
            case (T_q1)
379
                8'h01:  Data_o1 = Data_i1;
380
                8'h02:  Data_o2=  Data_i1;
381
                8'h03:  Data_o3=  Data_i1;
382
                8'h04:  Data_o4=  Data_i1;
383
                8'h05:  Data_o5=  Data_i1;
384
                8'h06:  Data_o6=  Data_i1;
385
 
386
             endcase
387
             case (T_q2)
388
                8'h01:  Data_o1 = Data_i2;
389
                8'h02:  Data_o2=  Data_i2;
390
                8'h03:  Data_o3=  Data_i2;
391
                8'h04:  Data_o4=  Data_i2;
392
                8'h05:  Data_o5=  Data_i2;
393
                8'h06:  Data_o6=  Data_i2;
394
 
395
             endcase
396
             case (T_q3)
397
                8'h01:  Data_o1 = Data_i3;
398
                8'h02:  Data_o2=  Data_i3;
399
                8'h03:  Data_o3=  Data_i3;
400
                8'h04:  Data_o4=  Data_i3;
401
                8'h05:  Data_o5=  Data_i3;
402
                8'h06:  Data_o6=  Data_i3;
403
 
404
             endcase
405
             case (T_q4)
406
                8'h01:  Data_o1 = Data_i4;
407
                8'h02:  Data_o2=  Data_i4;
408
                8'h03:  Data_o3=  Data_i4;
409
                8'h04:  Data_o4=  Data_i4;
410
                8'h05:  Data_o5=  Data_i4;
411
                8'h06:  Data_o6=  Data_i4;
412
 
413
             endcase
414
             case (T_q5)
415
                8'h01:  Data_o1 = Data_i5;
416
                8'h02:  Data_o2=  Data_i5;
417
                8'h03:  Data_o3=  Data_i5;
418
                8'h04:  Data_o4=  Data_i5;
419
                8'h05:  Data_o5=  Data_i5;
420
                8'h06:  Data_o6=  Data_i5;
421
 
422
             endcase
423
             case (T_q6)
424
                8'h01:  Data_o1 = Data_i6;
425
                8'h02:  Data_o2=  Data_i6;
426
                8'h03:  Data_o3=  Data_i6;
427
                8'h04:  Data_o4=  Data_i6;
428
                8'h05:  Data_o5=  Data_i6;
429
                8'h06:  Data_o6=  Data_i6;
430
 
431
             endcase
432
 
433
        end
434
 
435
 
436
         endmodule
437
 
438
 
439
 
440
 
441
 

powered by: WebSVN 2.1.0

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