Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: niu_smx_sm_req_datareq.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 | module niu_smx_sm_req_datareq( | |
37 | /*AUTOARG*/ | |
38 | // Outputs | |
39 | rst_cmdflag, datareq_busy, datareq_idle, datareq, dreq_cs, | |
40 | // Inputs | |
41 | clk, reset_l, cmdflag, cmdflag_data, early_cmdflag_n, | |
42 | early_cmdflag_data_n, dv_pad_done, cfg_pad_wait | |
43 | ); | |
44 | ||
45 | input clk; | |
46 | input reset_l; | |
47 | ||
48 | // cmdreq if | |
49 | input cmdflag; | |
50 | input [4:0] cmdflag_data; | |
51 | input early_cmdflag_n; | |
52 | input [4:0] early_cmdflag_data_n; | |
53 | output rst_cmdflag; | |
54 | output datareq_busy; | |
55 | output datareq_idle; | |
56 | ||
57 | // dmc if | |
58 | output datareq; | |
59 | ||
60 | // dv if | |
61 | input dv_pad_done; | |
62 | input cfg_pad_wait; | |
63 | ||
64 | output [2:0] dreq_cs; | |
65 | ||
66 | reg rst_cmdflag_n; | |
67 | wire rst_cmdflag= rst_cmdflag_n; | |
68 | ||
69 | parameter s0= 3'h0, | |
70 | s1= 3'h1, | |
71 | s2= 3'h2, | |
72 | s3= 3'h3, | |
73 | s4= 3'h4, | |
74 | s5= 3'h5; | |
75 | ||
76 | reg datareq_n, datareq; | |
77 | reg [2:0] dreq_ns, dreq_cs; | |
78 | wire datareq_busy= (!(dreq_cs==s0)|| cmdflag); | |
79 | wire datareq_idle= (dreq_cs==s0); | |
80 | ||
81 | always @(posedge clk)begin | |
82 | if(!reset_l) begin | |
83 | datareq<= `SMX_PD 1'b0; | |
84 | dreq_cs<= `SMX_PD s0; | |
85 | end | |
86 | else begin | |
87 | datareq<= `SMX_PD datareq_n; | |
88 | dreq_cs<= `SMX_PD dreq_ns; | |
89 | end | |
90 | end | |
91 | ||
92 | reg ld_cmdflag_data_n; | |
93 | reg [4:0] cmdflag_data_r; | |
94 | always @(posedge clk)begin | |
95 | if(ld_cmdflag_data_n) cmdflag_data_r<= `SMX_PD (cmdflag)? cmdflag_data : | |
96 | early_cmdflag_data_n; | |
97 | end | |
98 | ||
99 | always @(/*AUTOSENSE*/cfg_pad_wait or cmdflag or cmdflag_data | |
100 | or cmdflag_data_r or dreq_cs or dv_pad_done | |
101 | or early_cmdflag_data_n or early_cmdflag_n) begin | |
102 | datareq_n= 1'b0; | |
103 | ld_cmdflag_data_n= 1'b0; | |
104 | rst_cmdflag_n= 1'b0; | |
105 | dreq_ns= dreq_cs; | |
106 | case(dreq_cs) | |
107 | s0: begin | |
108 | if(cmdflag || early_cmdflag_n) begin // wait for flag | |
109 | datareq_n= (cmdflag)? cmdflag_data[0] : early_cmdflag_data_n[0]; | |
110 | ld_cmdflag_data_n= 1'b1; | |
111 | rst_cmdflag_n= cmdflag; // clear flag for next | |
112 | dreq_ns= s1; | |
113 | end | |
114 | end | |
115 | s1: begin | |
116 | datareq_n= cmdflag_data_r[1]; | |
117 | dreq_ns= s2; | |
118 | end | |
119 | s2: begin | |
120 | datareq_n= cmdflag_data_r[2]; | |
121 | dreq_ns= s3; | |
122 | end | |
123 | s3: begin | |
124 | datareq_n= cmdflag_data_r[3]; | |
125 | dreq_ns= ((&cmdflag_data_r[3:0]) | ~cfg_pad_wait)? | |
126 | ((cmdflag_data_r[4])? s5 : s0): s4; | |
127 | end | |
128 | s4: begin // wait dv done pad; | |
129 | // only for pad case in case client | |
130 | // pack lastline (which needs pad) | |
131 | // with next line (no gap) | |
132 | // (despite datareq issues gap at pad, | |
133 | // no guarantee client return with same gap) | |
134 | if(dv_pad_done) begin | |
135 | dreq_ns= s0; | |
136 | end | |
137 | end | |
138 | s5: begin // eop dummy state | |
139 | dreq_ns= s0; | |
140 | end | |
141 | endcase | |
142 | end | |
143 | ||
144 | endmodule |