Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / niu / rtl / niu_scam.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: niu_scam.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
39 Project : Niu
40
41 File name : niu_scam.v
42
43 Module(s) name : niu_scam
44
45 Parent modules : niu_scam.v
46
47 Child modules : niu_scam_lib.v
48
49 Author's name : George Chu
50
51 Date : April, 2004
52
53 Description :
54
55 Synthesis Notes:
56
57 Modification History:
58 Date Description
59 ---- -----------
60
61************************************************************
62***********************************************************/
63
64`timescale 1ns/10ps
65
66module niu_scam (
67 data_inp, cam_compare,
68 pio_wt, pio_rd, pio_sel, cam_index,
69 reset, clk,
70 cam_valid, cam_hit, cam_haddr,
71 pio_rd_vld,
72 msk_dat_out);
73
74input [199:0] data_inp; // compare_data/pio_data_input
75input cam_compare; // initiate compare operation
76input pio_wt; // if 1, pio writes to cam's data or mask or valid planes.
77input pio_rd; // if 1, pio reads from cam's data or mask or valid planes.
78input pio_sel; // pio access cam's mask<=1, data<=0 plane
79input [6:0] cam_index; // pio access address, N2: {1'b0,cam_index[6:0]}
80input reset;
81input clk;
82output cam_valid; // if 1, cam is ready to accept a new comparison
83output cam_hit; // if 1, there is a cam match/hit
84output [6:0] cam_haddr; // index of a cam match/hit entry, N2: {1'b0,haddr[6:0]}
85output pio_rd_vld; // pio_read_out_data valid for the core_clk domain
86output [199:0] msk_dat_out; // pio data read out of cam's mask or data plane
87
88wire cam_valid;
89wire cam_hit;
90wire [6:0] cam_haddr;
91wire pio_rd_vld;
92wire [199:0] msk_dat_out;
93
94// ----------- cam's pre-registers --------------------
95wire [199:0] data_inp_d;
96wire cam_compare_d;
97wire pio_wt_d;
98wire pio_rd_d;
99wire pio_sel_d;
100wire [6:0] cam_index_d;
101
102// ----------- cam's match_array ----------------------
103wire [127:0] match_array;
104
105// ----------- cam's control --------------------------
106wire cmp_enc;
107wire cmp_busy;
108wire clr_cam;
109wire c_scam_st;
110wire wt_data;
111wire wt_mask;
112wire rd_data;
113wire rd_mask;
114wire c_pio_rw_st;
115
116// =================================== CAM's data pre_registered ==========================
117 niu_scam_pre niu_scam_pre0 (
118 .data_inp (data_inp[199:0]),
119 .cam_compare (cam_compare),
120 .pio_wt (pio_wt),
121 .pio_rd (pio_rd),
122 .pio_sel (pio_sel),
123 .cam_index (cam_index[6:0]),
124 .reset (reset),
125 .cam_clk (clk),
126 .data_inp_d (data_inp_d[199:0]),
127 .cam_compare_d (cam_compare_d),
128 .pio_wt_d (pio_wt_d),
129 .pio_rd_d (pio_rd_d),
130 .pio_sel_d (pio_sel_d),
131 .cam_index_d (cam_index_d[6:0])
132 );
133
134// =================================== CAM's arrays =======================================
135 niu_scam_ary niu_scam_ary0 (
136 .data_inp_d (data_inp_d[199:0]),
137 .wt_data (wt_data),
138 .wt_mask (wt_mask),
139 .rd_data (rd_data),
140 .rd_mask (rd_mask),
141 .cam_index_d (cam_index_d[6:0]),
142 .reset (reset),
143 .cam_clk (clk),
144 .match_array (match_array[127:0]),
145 .msk_dat_out (msk_dat_out[199:0])
146 );
147
148// =================================== CAM's priority encoder =============================
149 niu_scam_enc niu_scam_enc0 (
150 .match_array (match_array[127:0]),
151 .cmp_enc (cmp_enc),
152 .reset (reset),
153 .cam_clk (clk),
154 .cam_hit (cam_hit),
155 .cam_haddr (cam_haddr[6:0])
156 );
157
158// =================================== CAM's control ======================================
159 niu_scam_ctl niu_scam_ctl0 (
160 .cam_compare_d (cam_compare_d),
161 .pio_wt_d (pio_wt_d),
162 .pio_rd_d (pio_rd_d),
163 .pio_sel_d (pio_sel_d),
164 .reset (reset),
165 .cam_clk (clk),
166 .cmp_enc (cmp_enc),
167 .cmp_busy (cmp_busy),
168 .cam_valid (cam_valid),
169 .clr_cam (clr_cam),
170 .c_scam_st (c_scam_st),
171 .wt_data (wt_data),
172 .wt_mask (wt_mask),
173 .rd_data (rd_data),
174 .rd_mask (rd_mask),
175 .pio_rd_vld (pio_rd_vld),
176 .c_pio_rw_st (c_pio_rw_st)
177 );
178
179endmodule