Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: n2_efa_sp_256b_cust.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 n2_efa_sp_256b_cust ( | |
36 | vpp, | |
37 | efa_sbc_data, | |
38 | pi_efa_prog_en, | |
39 | sbc_efa_read_en, | |
40 | sbc_efa_word_addr, | |
41 | sbc_efa_bit_addr, | |
42 | sbc_efa_margin0_rd, | |
43 | sbc_efa_margin1_rd, | |
44 | pwr_ok, | |
45 | por_n, | |
46 | sbc_efa_sup_det_rd, | |
47 | sbc_efa_power_down, | |
48 | clk) ; | |
49 | wire [31:0] efa_read_data; | |
50 | ||
51 | `define MAXFILENAME_1 200 | |
52 | //`define EFA_READ_LAT__2 45000 | |
53 | `define EFA_READ_LAT_2 6 | |
54 | ||
55 | ||
56 | ||
57 | input vpp; // VPP input from I/O | |
58 | ||
59 | output [31:0] efa_sbc_data; // Data from e-fuse array to SBC | |
60 | input pi_efa_prog_en; // e-fuse array program enable | |
61 | input sbc_efa_read_en; // e-fuse array read enable | |
62 | input [5:0] sbc_efa_word_addr; // e-fuse array word addr | |
63 | input [4:0] sbc_efa_bit_addr; // e-fuse array bit addr | |
64 | input sbc_efa_margin0_rd; // e-fuse array margin0 read | |
65 | input sbc_efa_margin1_rd; // e-fuse array margin1 read | |
66 | input pwr_ok; // power_ok reset | |
67 | input por_n; // por_n reset | |
68 | input sbc_efa_sup_det_rd; // e-fuse array supply detect read | |
69 | input sbc_efa_power_down; // e-fuse power down signal from SBC | |
70 | ||
71 | //input vddo; | |
72 | input clk; // cpu clk | |
73 | ||
74 | ||
75 | /*--------------------------------------------------------------------------*/ | |
76 | ||
77 | //** Parameters and define **// | |
78 | ||
79 | //parameter EFA_READ_LAT = 5670 ; // 7 system cycles (150Mhz) - 1/4(sys clk); about 45ns | |
80 | // 840 ticks = 1 system cycle | |
81 | // about 45ns (timescale is 1 ps) | |
82 | /* The access time has been specified to be 45ns for a worst case read */ | |
83 | ||
84 | //** Wire and Reg declarations **// | |
85 | ||
86 | reg [`MAXFILENAME_1*8-1:0] efuse_data_filename; | |
87 | reg [31:0] efuse_array[0:63],efuse_row,efa_read_data1,efa_read_data2,efa_read_data3,efa_read_data4; //EFUSE ARRAY | |
88 | integer file_get_status,i; | |
89 | reg [31:0] fpInVec; | |
90 | reg [31:0] efa_sbc_data; | |
91 | wire l1clk; | |
92 | wire lvl_det_l; // level detect ok | |
93 | wire vddc_ok_l; // vddc ok | |
94 | wire vddo_ok_l; // vddo ok | |
95 | wire vpp_ok_l; // vpp ok | |
96 | reg efuse_enable_write_check; | |
97 | ||
98 | // JDL - outside translate_off | |
99 | reg [5:0] sbc_efa_word_addr_1; | |
100 | reg [4:0] sbc_efa_bit_addr_1; | |
101 | reg sbc_efa_read_en_1; | |
102 | reg sbc_efa_read_en_2; | |
103 | reg sbc_efa_read_en_3; | |
104 | reg sbc_efa_sup_det_rd_1; | |
105 | ||
106 | /*--------------------------------------------------------------------------*/ | |
107 | ||
108 | // Process data file | |
109 | ||
110 | // synopsys translate_off | |
111 | ||
112 | initial | |
113 | begin | |
114 | efuse_enable_write_check = 1'b1; | |
115 | // Get Efuse data file from plusarg. | |
116 | if ($value$plusargs("efuse_data_file=%s", efuse_data_filename)) | |
117 | begin | |
118 | // Read Efuse data file if present | |
119 | $display("INFO: efuse data file is being read--filename=%0s", | |
120 | efuse_data_filename); | |
121 | $readmemh(efuse_data_filename, efuse_array); | |
122 | $display("INFO: completed reading efuse data file"); | |
123 | end | |
124 | else | |
125 | begin | |
126 | //if file not present, initialize efuse_array with default value | |
127 | $display("INFO: Using default efuse data for the efuse array"); | |
128 | for (i=0;i<=63;i=i+1) begin | |
129 | efuse_array[i] = 32'b0; | |
130 | end | |
131 | end | |
132 | end | |
133 | ||
134 | // Process power down signal | |
135 | assign l1clk = clk & ~sbc_efa_power_down; | |
136 | ||
137 | // Scan logic not in RTL | |
138 | // this is not necessary | |
139 | //assign so = se ? si : 1'bx; | |
140 | ||
141 | //assign supply detect signals to valid values (circuit cannot be impl in model) | |
142 | assign lvl_det_l = 1'b0; | |
143 | assign vddc_ok_l = 1'b0; | |
144 | assign vddo_ok_l = 1'b0; | |
145 | assign vpp_ok_l = ~vpp; | |
146 | ||
147 | always @(posedge l1clk) begin | |
148 | sbc_efa_word_addr_1[5:0] <= sbc_efa_word_addr; | |
149 | sbc_efa_bit_addr_1[4:0] <= sbc_efa_bit_addr; | |
150 | end | |
151 | ||
152 | ||
153 | ||
154 | always @(posedge pi_efa_prog_en) begin | |
155 | // Write operation , one bit at a time | |
156 | // if ((pi_efa_prog_en === 1'b1) && (pwr_ok === 1'b1) && (por_n === 1'b1)) begin | |
157 | if (pi_efa_prog_en & pwr_ok & por_n) | |
158 | begin | |
159 | efuse_row = efuse_array[sbc_efa_word_addr_1]; | |
160 | efuse_row[sbc_efa_bit_addr_1] = 1'b1; | |
161 | efuse_array[sbc_efa_word_addr_1] <= efuse_row; | |
162 | end | |
163 | end | |
164 | ||
165 | ||
166 | // efa_read_data is from the VPP_CORE which is reset to 0 in ckt when read is de-asserted | |
167 | // However in RTL it is reset to X because I want to simulate the wait time where | |
168 | // efa_read_data is indeed X till the latency period | |
169 | // margin reads are not modelled in the RTL | |
170 | always @(posedge l1clk) begin | |
171 | sbc_efa_read_en_1 <= sbc_efa_read_en; | |
172 | sbc_efa_read_en_2 <= sbc_efa_read_en_1; | |
173 | sbc_efa_read_en_3 <= sbc_efa_read_en_2; | |
174 | end | |
175 | ||
176 | wire [31:0] sbc_efa_read_en_3_bus; | |
177 | ||
178 | assign sbc_efa_read_en_3_bus[31:0] = {sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
179 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
180 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
181 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
182 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
183 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
184 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
185 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
186 | sbc_efa_read_en_3, sbc_efa_read_en_3, | |
187 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3, | |
188 | sbc_efa_read_en_3, sbc_efa_read_en_3, sbc_efa_read_en_3}; | |
189 | ||
190 | assign efa_read_data[31:0] = sbc_efa_read_en_3_bus[31:0] & efuse_array[sbc_efa_word_addr_1]; | |
191 | always @(posedge l1clk) | |
192 | sbc_efa_sup_det_rd_1 <= sbc_efa_sup_det_rd; | |
193 | ||
194 | // synopsys translate_on | |
195 | ||
196 | // In ckt, when sbc_efa_read_en is low, output remains the same. | |
197 | ||
198 | wire [31:0] efa_data; | |
199 | // ? {28'b0,~lvl_det_l,~vddc_ok_l,1'b0,~vpp_ok_l} | |
200 | assign efa_data[31:0] = (sbc_efa_read_en & sbc_efa_read_en_3) | |
201 | ? ((sbc_efa_read_en_3 & sbc_efa_sup_det_rd_1) | |
202 | ? {29'b0,~vddc_ok_l,~vddo_ok_l,~vpp_ok_l} | |
203 | : efa_read_data[31:0]) | |
204 | : efa_sbc_data[31:0]; | |
205 | ||
206 | always @(posedge l1clk) | |
207 | efa_sbc_data[31:0] <= por_n ? efa_data[31:0] : 32'b0; | |
208 | ||
209 | endmodule | |
210 | ||
211 |