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