Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / pcie_common / rtl / dmu_common_ccc_dep.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_common_ccc_dep.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 ============================================
35module dmu_common_ccc_dep
36 (
37 clk,
38 rst_l,
39
40 csr_ring_in,
41
42 dep2cdp_data,
43
44 dep2fsm_acc_vio,
45 dep2fsm_done,
46 dep2fsm_mapped,
47 dep2fsm_valid
48 );
49
50// ----------------------------------------------------------------------------
51// Parameters
52// ----------------------------------------------------------------------------
53 parameter IDLE = 2'b00,
54 RDMS = 2'b01,
55 RDLS = 2'b10,
56 DONE = 2'b11;
57
58// ----------------------------------------------------------------------------
59// Ports
60// ----------------------------------------------------------------------------
61 input clk;
62 input rst_l;
63
64 input [`FIRE_CSR_RING_BITS] csr_ring_in;
65
66 output [`FIRE_CSR_DATA_BITS] dep2cdp_data;
67
68 output dep2fsm_acc_vio;
69 output dep2fsm_done;
70 output dep2fsm_mapped;
71 output dep2fsm_valid;
72
73// ----------------------------------------------------------------------------
74// Variables
75// ----------------------------------------------------------------------------
76 wire [`FIRE_CSR_DATA_BITS] dep2cdp_data;
77 reg dep2fsm_acc_vio, nxt_vio;
78 reg dep2fsm_done, nxt_dne;
79 reg dep2fsm_mapped, nxt_map;
80 reg dep2fsm_valid, nxt_vld;
81
82 reg [`FIRE_CSR_CMND_BITS] cmnd;
83 reg [`FIRE_CSR_DATA_BITS] data;
84 reg [1:0] state, nxt_state;
85 reg [1:0] data_ld;
86 reg cmnd_ld;
87
88// ----------------------------------------------------------------------------
89// Zero In Checkers
90// ----------------------------------------------------------------------------
91
92// ----------------------------------------------------------------------------
93// Combinational
94// ----------------------------------------------------------------------------
95// output data
96 assign dep2cdp_data = data;
97
98// valid command
99 wire vld_cmnd = |csr_ring_in[`FIRE_CSR_RING_CMND_BITS];
100
101// next state
102 always @ (state or vld_cmnd) begin
103 case (state) // synopsys parallel_case
104 IDLE : begin
105 if (vld_cmnd) nxt_state = RDMS;
106 else nxt_state = IDLE;
107 end
108 RDMS : nxt_state = RDLS;
109 RDLS : nxt_state = IDLE;
110 DONE : nxt_state = IDLE;
111 endcase
112 end
113
114// state outputs
115 always @ (state or cmnd) begin
116 cmnd_ld = 0;
117 data_ld = 0;
118 nxt_dne = 0;
119 nxt_map = 0;
120 nxt_vio = 0;
121 nxt_vld = 0;
122 case (state) // synopsys parallel_case
123 IDLE : begin
124 cmnd_ld = 1'b1;
125 end
126 RDMS : begin
127 data_ld = 2'b10;
128 end
129 RDLS : begin
130 data_ld = 2'b01;
131 nxt_vld = 1'b1;
132 case (cmnd) // synopsys parallel_case
133 `FIRE_CSR_CMND_RRSP : begin
134 nxt_dne = 1'b1;
135 nxt_map = 1'b1;
136 nxt_vio = 0;
137 end
138 `FIRE_CSR_CMND_WRSP : begin
139 nxt_dne = 1'b1;
140 nxt_map = 1'b1;
141 nxt_vio = 0;
142 end
143 `FIRE_CSR_CMND_RERR : begin
144 nxt_dne = 1'b1;
145 nxt_map = 1'b1;
146 nxt_vio = 1'b1;
147 end
148 `FIRE_CSR_CMND_WERR : begin
149 nxt_dne = 1'b1;
150 nxt_map = 1'b1;
151 nxt_vio = 1'b1;
152 end
153 default : begin
154 nxt_dne = 0;
155 nxt_map = 0;
156 nxt_vio = 0;
157 end
158 endcase
159 end
160 DONE : begin
161 nxt_vld = 0;
162 end
163 endcase
164 end
165
166// ----------------------------------------------------------------------------
167// Sequential
168// ----------------------------------------------------------------------------
169 always @(posedge clk ) begin
170 if (!rst_l) begin
171 state <= IDLE;
172 end
173 else begin
174 state <= nxt_state;
175 end
176 end
177
178 always @(posedge clk ) begin
179 dep2fsm_acc_vio <= nxt_vio;
180 dep2fsm_done <= nxt_dne;
181 dep2fsm_mapped <= nxt_map;
182 dep2fsm_valid <= nxt_vld;
183 end
184
185 always @(posedge clk ) begin
186 if (cmnd_ld) cmnd <= csr_ring_in[`FIRE_CSR_RING_CMND_BITS];
187 if (data_ld[1]) data[`FIRE_CSR_RDMS_BITS] <= csr_ring_in;
188 if (data_ld[0]) data[`FIRE_CSR_RDLS_BITS] <= csr_ring_in;
189 end
190
191endmodule // dmu_common_ccc_dep