Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: fflp_hash_func.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 | /*project name: N2 */ | |
37 | /*module name: fflp_hash_func */ | |
38 | /*description: Pipeline for hash algorithm CRC-32C and CRC-CCITT */ | |
39 | /* CRC-32C: */ | |
40 | /* x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+ */ | |
41 | /* x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 */ | |
42 | /* */ | |
43 | /* CRC-CCITT: */ | |
44 | /* x^16+x^12+x^5+1 */ | |
45 | /* */ | |
46 | /*parent module in: */ | |
47 | /*child modules in: fflp_CRC32_D64, fflp_CRC16_D64 */ | |
48 | /*interface modules: */ | |
49 | /*author name: Jeanne Cai */ | |
50 | /*date created: 25-05-04 */ | |
51 | /* */ | |
52 | /* Copyright (c) 2004, Sun Microsystems, Inc. */ | |
53 | /* Sun Proprietary and Confidential */ | |
54 | /* */ | |
55 | /*modifications: */ | |
56 | /* */ | |
57 | /**********************************************************************/ | |
58 | ||
59 | module fflp_hash_func | |
60 | ( | |
61 | cclk, | |
62 | reset, | |
63 | fwd_info_hash_key, | |
64 | fwd_sched, | |
65 | kick_off_ram_srch_4, | |
66 | h1_init_value_reg_dout, | |
67 | h2_init_value_reg_dout, | |
68 | ||
69 | hash_v1, | |
70 | hash_v2 | |
71 | ||
72 | ); | |
73 | ||
74 | input cclk; | |
75 | input reset; | |
76 | input[361:0] fwd_info_hash_key; | |
77 | input fwd_sched; | |
78 | input kick_off_ram_srch_4; | |
79 | input[31:0] h1_init_value_reg_dout; | |
80 | input[15:0] h2_init_value_reg_dout; | |
81 | ||
82 | output[19:0] hash_v1; | |
83 | output[15:0] hash_v2; | |
84 | ||
85 | wire crc_cyc0; | |
86 | wire crc_cyc1; | |
87 | wire crc_cyc2; | |
88 | wire crc_cyc3; | |
89 | wire crc_cyc4; | |
90 | wire crc_cyc5; | |
91 | ||
92 | wire[383:0] hash_key; | |
93 | wire[63:0] hash_data0; | |
94 | wire[63:0] hash_data1; | |
95 | wire[63:0] hash_data2; | |
96 | wire[63:0] hash_data3; | |
97 | wire[63:0] hash_data4; | |
98 | wire[63:0] hash_data5; | |
99 | wire[63:0] hash_data5_r; | |
100 | ||
101 | wire[31:0] new1_crc0; | |
102 | wire[31:0] new1_crc1; | |
103 | wire[31:0] new1_crc2; | |
104 | wire[31:0] new1_crc3; | |
105 | wire[31:0] new1_crc4; | |
106 | wire[31:0] new1_crc5; | |
107 | ||
108 | wire[31:0] new1_crc0_r; | |
109 | wire[31:0] new1_crc1_r; | |
110 | wire[31:0] new1_crc2_r; | |
111 | wire[31:0] new1_crc3_r; | |
112 | wire[31:0] new1_crc4_r; | |
113 | wire[31:0] new1_crc5_r; | |
114 | wire[19:0] hash_v1; | |
115 | ||
116 | wire[15:0] new2_crc0; | |
117 | wire[15:0] new2_crc1; | |
118 | wire[15:0] new2_crc2; | |
119 | wire[15:0] new2_crc3; | |
120 | wire[15:0] new2_crc4; | |
121 | wire[15:0] new2_crc5; | |
122 | ||
123 | wire[15:0] new2_crc0_r; | |
124 | wire[15:0] new2_crc1_r; | |
125 | wire[15:0] new2_crc2_r; | |
126 | wire[15:0] new2_crc3_r; | |
127 | wire[15:0] new2_crc4_r; | |
128 | wire[15:0] new2_crc5_r; | |
129 | wire[15:0] hash_v2; | |
130 | ||
131 | wire[31:0] init_crc1; | |
132 | wire[15:0] init_crc2; | |
133 | ||
134 | assign init_crc1 = h1_init_value_reg_dout; | |
135 | assign init_crc2 = h2_init_value_reg_dout; | |
136 | ||
137 | assign hash_key = {fwd_info_hash_key, 22'b0}; | |
138 | assign hash_data0 = hash_key[63:0]; | |
139 | assign hash_data1 = hash_key[127:64]; | |
140 | assign hash_data2 = hash_key[191:128]; | |
141 | assign hash_data3 = hash_key[255:192]; | |
142 | assign hash_data4 = hash_key[319:256]; | |
143 | assign hash_data5 = hash_key[383:320]; | |
144 | ||
145 | fflp_CRC32_D64 hash1_stage0 (.Data (hash_data0), .CRC (init_crc1), .NewCRC (new1_crc0)); | |
146 | fflp_CRC32_D64 hash1_stage1 (.Data (hash_data1), .CRC (new1_crc0_r), .NewCRC (new1_crc1)); | |
147 | fflp_CRC32_D64 hash1_stage2 (.Data (hash_data2), .CRC (new1_crc1_r), .NewCRC (new1_crc2)); | |
148 | fflp_CRC32_D64 hash1_stage3 (.Data (hash_data3), .CRC (new1_crc2_r), .NewCRC (new1_crc3)); | |
149 | fflp_CRC32_D64 hash1_stage4 (.Data (hash_data4), .CRC (new1_crc3_r), .NewCRC (new1_crc4)); | |
150 | fflp_CRC32_D64 hash1_stage5 (.Data (hash_data5_r), .CRC (new1_crc4_r), .NewCRC (new1_crc5)); | |
151 | ||
152 | fflp_CRC16_D64 hash2_stage0 (.Data (hash_data0), .CRC (init_crc2), .NewCRC (new2_crc0)); | |
153 | fflp_CRC16_D64 hash2_stage1 (.Data (hash_data1), .CRC (new2_crc0_r), .NewCRC (new2_crc1)); | |
154 | fflp_CRC16_D64 hash2_stage2 (.Data (hash_data2), .CRC (new2_crc1_r), .NewCRC (new2_crc2)); | |
155 | fflp_CRC16_D64 hash2_stage3 (.Data (hash_data3), .CRC (new2_crc2_r), .NewCRC (new2_crc3)); | |
156 | fflp_CRC16_D64 hash2_stage4 (.Data (hash_data4), .CRC (new2_crc3_r), .NewCRC (new2_crc4)); | |
157 | fflp_CRC16_D64 hash2_stage5 (.Data (hash_data5_r), .CRC (new2_crc4_r), .NewCRC (new2_crc5)); | |
158 | ||
159 | ||
160 | dffre #(64) hash_data5_reg (cclk, reset, crc_cyc4, hash_data5, hash_data5_r); | |
161 | ||
162 | dffr #(1) crc_cyc0_reg (cclk, reset, fwd_sched, crc_cyc0); | |
163 | dffr #(1) crc_cyc1_reg (cclk, reset, crc_cyc0, crc_cyc1); | |
164 | dffr #(1) crc_cyc2_reg (cclk, reset, crc_cyc1, crc_cyc2); | |
165 | dffr #(1) crc_cyc3_reg (cclk, reset, crc_cyc2, crc_cyc3); | |
166 | dffr #(1) crc_cyc4_reg (cclk, reset, crc_cyc3, crc_cyc4); | |
167 | dffr #(1) crc_cyc5_reg (cclk, reset, crc_cyc4, crc_cyc5); | |
168 | ||
169 | dffre #(32) new1_crc0_reg (cclk, reset, crc_cyc0, new1_crc0, new1_crc0_r); | |
170 | dffre #(32) new1_crc1_reg (cclk, reset, crc_cyc1, new1_crc1, new1_crc1_r); | |
171 | dffre #(32) new1_crc2_reg (cclk, reset, crc_cyc2, new1_crc2, new1_crc2_r); | |
172 | dffre #(32) new1_crc3_reg (cclk, reset, crc_cyc3, new1_crc3, new1_crc3_r); | |
173 | dffre #(32) new1_crc4_reg (cclk, reset, crc_cyc4, new1_crc4, new1_crc4_r); | |
174 | dffre #(32) new1_crc5_reg (cclk, reset, crc_cyc5, new1_crc5, new1_crc5_r); | |
175 | ||
176 | dffre #(16) new2_crc0_reg (cclk, reset, crc_cyc0, new2_crc0, new2_crc0_r); | |
177 | dffre #(16) new2_crc1_reg (cclk, reset, crc_cyc1, new2_crc1, new2_crc1_r); | |
178 | dffre #(16) new2_crc2_reg (cclk, reset, crc_cyc2, new2_crc2, new2_crc2_r); | |
179 | dffre #(16) new2_crc3_reg (cclk, reset, crc_cyc3, new2_crc3, new2_crc3_r); | |
180 | dffre #(16) new2_crc4_reg (cclk, reset, crc_cyc4, new2_crc4, new2_crc4_r); | |
181 | dffre #(16) new2_crc5_reg (cclk, reset, crc_cyc5, new2_crc5, new2_crc5_r); | |
182 | ||
183 | dffre #(20) hash_v1_reg (cclk, reset, kick_off_ram_srch_4, new1_crc5_r[19:0], hash_v1); | |
184 | dffre #(16) hash_v2_reg (cclk, reset, kick_off_ram_srch_4, new2_crc5_r, hash_v2); | |
185 | ||
186 | ||
187 | ||
188 | endmodule |