Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: pcie_common_dcs_osm.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 pcie_common_dcs_osm | |
36 | ( | |
37 | clk, // source clock | |
38 | rst_l, // reset | |
39 | csr_pkt_ack, // csr packet acknowledge | |
40 | ism2osm_vld, // ism valid | |
41 | csr_pkt_req, // csr request | |
42 | osm2ism_deq, // ism dequeue | |
43 | osm2sdp_ld // sdp load | |
44 | ); | |
45 | ||
46 | // ---------------------------------------------------------------------------- | |
47 | // Parameters | |
48 | // ---------------------------------------------------------------------------- | |
49 | parameter IDLE = 2'b00, // state machine states | |
50 | LDMS = 2'b01, | |
51 | LDLS = 2'b10, | |
52 | RQST = 2'b11; | |
53 | ||
54 | // ---------------------------------------------------------------------------- | |
55 | // Ports | |
56 | // ---------------------------------------------------------------------------- | |
57 | input clk; | |
58 | input rst_l; | |
59 | input csr_pkt_ack; | |
60 | input ism2osm_vld; | |
61 | ||
62 | output csr_pkt_req; | |
63 | output osm2ism_deq; | |
64 | output [2:0] osm2sdp_ld; | |
65 | ||
66 | // ---------------------------------------------------------------------------- | |
67 | // Variables | |
68 | // ---------------------------------------------------------------------------- | |
69 | wire ack; | |
70 | ||
71 | reg osm2ism_deq; | |
72 | reg [2:0] osm2sdp_ld; | |
73 | reg req, nxt_req; | |
74 | reg [1:0] state, nxt_state; | |
75 | ||
76 | // ---------------------------------------------------------------------------- | |
77 | // Zero In Checkers | |
78 | // ---------------------------------------------------------------------------- | |
79 | ||
80 | // 0in known_driven -var req -active rst_l | |
81 | // 0in known_driven -var state -active rst_l | |
82 | // 0in state_transition -var state -val IDLE -next LDMS RQST | |
83 | // 0in state_transition -var state -val LDMS -next LDLS | |
84 | // 0in state_transition -var state -val LDLS -next RQST | |
85 | // 0in state_transition -var state -val RQST -next IDLE | |
86 | ||
87 | // ---------------------------------------------------------------------------- | |
88 | // Instantiations | |
89 | // ---------------------------------------------------------------------------- | |
90 | /* N2- AT 03/04/05: | |
91 | pcie_common_sync_flop #(1'b1) sff | |
92 | ( | |
93 | .clk (clk), | |
94 | .din (csr_pkt_ack), | |
95 | .dout (ack) | |
96 | ); | |
97 | END N2- AT 03/04/05 */ | |
98 | ||
99 | // N2+ AT 03/04/05: repalce pcie_common_sync_flop w/ sync cells from N2 lib. | |
100 | cl_a1_clksyncff_4x sff( | |
101 | .siclk (1'b0), | |
102 | .soclk (1'b0), | |
103 | .si (1'b0), | |
104 | .so (), | |
105 | .l1clk (clk), | |
106 | .d (csr_pkt_ack), | |
107 | .q (ack) | |
108 | ); | |
109 | // END N2+ AT 03/04/05 | |
110 | ||
111 | // ---------------------------------------------------------------------------- | |
112 | // Combinational | |
113 | // ---------------------------------------------------------------------------- | |
114 | ||
115 | // csr packet request | |
116 | assign csr_pkt_req = req; | |
117 | ||
118 | // next state | |
119 | always @ (state or ism2osm_vld or req or ack) begin | |
120 | case (state) // synopsys parallel_case | |
121 | IDLE : begin | |
122 | if (ism2osm_vld) nxt_state = LDMS; | |
123 | else nxt_state = IDLE; | |
124 | end | |
125 | LDMS : nxt_state = LDLS; | |
126 | LDLS : nxt_state = RQST; | |
127 | RQST : begin | |
128 | if (req ^ ack) nxt_state = RQST; | |
129 | else nxt_state = IDLE; | |
130 | end | |
131 | endcase | |
132 | end | |
133 | ||
134 | // state outputs | |
135 | always @ (state or nxt_state or req) begin | |
136 | osm2ism_deq = 1'b0; | |
137 | osm2sdp_ld = 3'b000; | |
138 | nxt_req = req; | |
139 | case (state) // synopsys parallel_case | |
140 | IDLE : begin | |
141 | case (nxt_state) // synopsys parallel_case | |
142 | LDMS : begin | |
143 | osm2ism_deq = 1'b1; | |
144 | osm2sdp_ld = 3'b100; | |
145 | nxt_req = req; | |
146 | end | |
147 | default : begin | |
148 | osm2ism_deq = 1'b0; | |
149 | osm2sdp_ld = 3'b000; | |
150 | nxt_req = req; | |
151 | end | |
152 | endcase | |
153 | end | |
154 | LDMS : begin | |
155 | osm2ism_deq = 1'b1; | |
156 | osm2sdp_ld = 3'b010; | |
157 | nxt_req = req; | |
158 | end | |
159 | LDLS : begin | |
160 | osm2ism_deq = 1'b1; | |
161 | osm2sdp_ld = 3'b001; | |
162 | nxt_req = ~req; | |
163 | end | |
164 | RQST : begin | |
165 | osm2ism_deq = 1'b0; | |
166 | osm2sdp_ld = 3'b000; | |
167 | nxt_req = req; | |
168 | end | |
169 | endcase | |
170 | end | |
171 | ||
172 | // ---------------------------------------------------------------------------- | |
173 | // Sequential | |
174 | // ---------------------------------------------------------------------------- | |
175 | always @ (posedge clk) begin | |
176 | if (!rst_l) begin | |
177 | req <= 0; | |
178 | state <= IDLE; | |
179 | end | |
180 | else begin | |
181 | req <= nxt_req; | |
182 | state <= nxt_state; | |
183 | end | |
184 | end | |
185 | ||
186 | endmodule // pcie_common_dcs_osm |