Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / niu_ipp_unload_dat.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_ipp_unload_dat.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35/**********************************************************
36***********************************************************
37
38 Project : Niu
39
40 File name : niu_ipp_unload_dat.v
41
42 Module(s) name : niu_ipp_unload_dat
43
44 Parent modules : niu_ipp.v
45
46 Child modules : niu_ipp.h
47
48 Author's name : George Chu
49
50 Date : Jan. 2004
51
52 Description : This module maintains the data path of the ipp_unload.
53
54 Synthesis Notes:
55
56 Modification History:
57 Date Description
58 ---- -----------
59
60************************************************************
61***********************************************************/
62
63module niu_ipp_unload_dat (
64 ipp_hfifo_dat_dout,
65 inc_hfifo_dat_rptr_d,
66 ipp_hfifo_dat_tag_rd,
67 wt_dfifo_1st_wd,
68 cur_pkt_ffl_sum_info,
69 ipp_dsc_pkt,
70 mac_drop_bad_crc,
71 status_rd_abort,
72 ipp_hfifo_over_run_r,
73 ipp_hfifo_under_run_r,
74 ipp_hfifo_par_err,
75 fet_pio_tcp_ena,
76 ipp_full_cksum,
77 sum_prt_cksum,
78 sum_prt_length,
79 sum_prt_fail,
80 addr_status,
81 datfifo_pio_wr_ena,
82 dfifo_wt_data_reg,
83 clr_ipp_unload,
84
85 reset,
86 clk,
87
88 ipp_dfifo_dinp
89 );
90
91input [129:0] ipp_hfifo_dat_dout;
92input inc_hfifo_dat_rptr_d;
93input [1:0] ipp_hfifo_dat_tag_rd;
94input [13:0] cur_pkt_ffl_sum_info;
95input wt_dfifo_1st_wd;
96input ipp_dsc_pkt;
97input mac_drop_bad_crc;
98input status_rd_abort;
99input ipp_hfifo_over_run_r;
100input ipp_hfifo_under_run_r;
101input ipp_hfifo_par_err;
102input fet_pio_tcp_ena;
103input ipp_full_cksum;
104input [15:0] sum_prt_cksum;
105input [15:0] sum_prt_length;
106input sum_prt_fail;
107input [11:0] addr_status;
108input datfifo_pio_wr_ena;
109input [129:0] dfifo_wt_data_reg;
110input clr_ipp_unload;
111
112input reset;
113input clk;
114
115output [129:0] ipp_dfifo_dinp;
116
117wire [129:0] ipp_dfifo_dinp;
118
119wire [35:0] cur_cksum_info;
120
121wire sop = 1'b1; // start of a packet
122wire eop = 1'b0; // end of a packet
123
124wire [5:0] cur_pkt_disc;
125
126wire [129:0] dfifo_status_wd;
127wire [39:0] n_mac_status_wd;
128reg [39:0] mac_status_wd;
129
130// =============================================================================
131
132 assign n_mac_status_wd = inc_hfifo_dat_rptr_d ?
133 ((ipp_hfifo_dat_tag_rd==2'h3) ? ipp_hfifo_dat_dout[103:64] :
134 (ipp_hfifo_dat_tag_rd==2'h1) ? ipp_hfifo_dat_dout[039:00] : 40'h0) :
135 mac_status_wd[39:0];
136
137 assign cur_pkt_disc = {ipp_hfifo_par_err, ipp_hfifo_under_run_r, ipp_hfifo_over_run_r,
138 status_rd_abort, mac_drop_bad_crc,
139 ipp_dsc_pkt};
140
141 assign cur_cksum_info = {sum_prt_length[15:0],
142 1'h0, fet_pio_tcp_ena, sum_prt_fail, ipp_full_cksum,
143 sum_prt_cksum[15:0]};
144
145// =============================================================================
146
147 assign dfifo_status_wd = {eop, sop,
148 mac_status_wd[39:0],
149 4'h0,addr_status[11:0],
150 14'h0,
151 cur_pkt_disc[5:0],
152 2'h0, cur_pkt_ffl_sum_info[13:0],
153 cur_cksum_info[35:0]
154 };
155
156// =============================================================================
157 assign ipp_dfifo_dinp = datfifo_pio_wr_ena ? dfifo_wt_data_reg[129:0] :
158 wt_dfifo_1st_wd ? dfifo_status_wd[129:0] :
159 {ipp_hfifo_dat_dout[129],1'h0,ipp_hfifo_dat_dout[127:0]};
160
161// =============================================================================
162 always @ (posedge clk)
163 if (reset || clr_ipp_unload)
164 begin
165 mac_status_wd <= #1 40'h0;
166 end
167 else
168 begin
169 mac_status_wd <= #1 n_mac_status_wd[39:0];
170 end
171
172endmodule //
173
174