Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: csr_sw.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 csr_sw ( | |
36 | ||
37 | // synopsys translate_off | |
38 | omni_ld, | |
39 | omni_data, | |
40 | omni_rw_alias, | |
41 | omni_rw1c_alias, | |
42 | omni_rw1s_alias, | |
43 | // synopsys translate_on | |
44 | ||
45 | rst, | |
46 | rst_val, | |
47 | ||
48 | csr_ld, | |
49 | csr_data, | |
50 | rw_alias, | |
51 | rw1c_alias, | |
52 | rw1s_alias, | |
53 | ||
54 | hw_ld, | |
55 | hw_data, | |
56 | ||
57 | cp, | |
58 | q | |
59 | ); | |
60 | ||
61 | //==================================================== | |
62 | // Port declarations | |
63 | //==================================================== | |
64 | // synopsys translate_off | |
65 | input omni_ld; // Omni write | |
66 | input omni_data; // Omni write data | |
67 | input omni_rw_alias; // Omni rw operation | |
68 | input omni_rw1c_alias; // Omni rw1c operation | |
69 | input omni_rw1s_alias; // Omni rw1s operation | |
70 | // synopsys translate_on | |
71 | input rst; // Synch reset | |
72 | input rst_val; // Synch reset value | |
73 | input csr_ld; // CSR load | |
74 | input csr_data; // CSR data | |
75 | input rw_alias; // rw operation | |
76 | input rw1c_alias; // rw1c operation | |
77 | input rw1s_alias; // rw1s operation | |
78 | input hw_ld; // Internal logic load | |
79 | input hw_data; // Internal logic data | |
80 | input cp; // Clock | |
81 | output q; // Register out | |
82 | ||
83 | //==================================================== | |
84 | // Type declarations | |
85 | //==================================================== | |
86 | // synopsys translate_off | |
87 | wire omni_data; // Omni write data | |
88 | wire omni_ld; // Omni write | |
89 | wire omni_rw_alias; // Omni rw operation | |
90 | wire omni_rw1c_alias; // Omni rw1c operation | |
91 | wire omni_rw1s_alias; // Omni rw1s operation | |
92 | // synopsys translate_on | |
93 | wire rst; // Synch reset | |
94 | wire rst_val; // Synch reset value | |
95 | wire csr_ld; // CSR load | |
96 | wire csr_data; // CSR data | |
97 | wire rw_alias; // rw operation | |
98 | wire rw1c_alias; // rw1c operation | |
99 | wire rw1s_alias; // rw1s operation | |
100 | wire hw_ld; // Internal logic load | |
101 | wire hw_data; // Internal logic data | |
102 | wire cp; // Clock | |
103 | reg q; // Register out | |
104 | ||
105 | //==================================================== | |
106 | // Internal logic | |
107 | //==================================================== | |
108 | always @(posedge cp | |
109 | // synopsys translate_off | |
110 | or posedge omni_ld | |
111 | // synopsys translate_on | |
112 | ) | |
113 | begin | |
114 | // synopsys translate_off | |
115 | // verilint 549 off | |
116 | // simtech modcovoff -be | |
117 | // async load ok - not synthesized | |
118 | if (omni_ld) | |
119 | begin | |
120 | case({omni_rw_alias,omni_rw1c_alias,omni_rw1s_alias}) | |
121 | `ifdef VCS | |
122 | 3'b100: | |
123 | if(omni_data==1'b1) | |
124 | q=1'b1; | |
125 | else | |
126 | q=1'b0; | |
127 | ||
128 | 3'b010: | |
129 | if(omni_data==1'b1) | |
130 | q=1'b0; | |
131 | ||
132 | 3'b001: | |
133 | if(omni_data==1'b1) | |
134 | q=1'b1; | |
135 | ||
136 | default: | |
137 | q=1'bx; | |
138 | `else | |
139 | 3'b100: | |
140 | if(omni_data==1'b1) | |
141 | q<=1'b1; | |
142 | else | |
143 | q<=1'b0; | |
144 | ||
145 | 3'b010: | |
146 | if(omni_data==1'b1) | |
147 | q<=1'b0; | |
148 | ||
149 | 3'b001: | |
150 | if(omni_data==1'b1) | |
151 | q<=1'b1; | |
152 | ||
153 | default: | |
154 | //BP N2 1-18-05 q<=1'bx; | |
155 | begin // axis tbcall_region | |
156 | // vlint flag_system_call off | |
157 | `ifdef PR_ERROR if ($time > 1) `PR_ERROR("csr_sw",`MON_ERROR,"acc_vio: default case of csr_sw"); `endif | |
158 | // vlint flag_system_call on | |
159 | end // end of tbcall_region | |
160 | `endif | |
161 | endcase | |
162 | end | |
163 | ||
164 | else | |
165 | begin | |
166 | // synopsys translate_on | |
167 | // simtech modcovon -be | |
168 | ||
169 | if (rst) | |
170 | q <= rst_val; | |
171 | ||
172 | else if (csr_ld) | |
173 | begin | |
174 | ||
175 | case({rw_alias,rw1c_alias,rw1s_alias}) | |
176 | 3'b100: if (csr_data == 1'b1) | |
177 | q <= 1'b1; | |
178 | else | |
179 | q <= 1'b0; | |
180 | ||
181 | 3'b010: if (csr_data == 1'b1) | |
182 | q <= 1'b0; | |
183 | else if (hw_ld) | |
184 | q <= hw_data; | |
185 | ||
186 | 3'b001: if (csr_data == 1'b1) | |
187 | q <= 1'b1; | |
188 | else if (hw_ld) | |
189 | q <= hw_data; | |
190 | default: | |
191 | //BP N2 1-18-05 q <= 1'bx; | |
192 | begin // axis tbcall_region | |
193 | // vlint flag_system_call off | |
194 | // synopsys translate_off | |
195 | `ifdef PR_ERROR if ($time > 1) `PR_ERROR("csr_sw",`MON_ERROR,"acc_vio: default case of csr_sw"); `endif | |
196 | // synopsys translate_on | |
197 | // vlint flag_system_call on | |
198 | end // end of tbcall_region | |
199 | ||
200 | ||
201 | endcase | |
202 | end | |
203 | ||
204 | else if (hw_ld) | |
205 | q <= hw_data; | |
206 | ||
207 | // verilint 549 on | |
208 | // synopsys translate_off | |
209 | end | |
210 | // synopsys translate_on | |
211 | end | |
212 | ||
213 | endmodule // csr_sw |