source: XOpenSparcT1/trunk/T1-common/common/cmp_sram_redhdr.v @ 6

Revision 6, 7.5 KB checked in by pntsvt00, 13 years ago (diff)

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: cmp_sram_redhdr.v
4// Copyright (c) 2006 Sun Microsystems, Inc.  All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21//
22//    Cluster Name:  Efuse Cluster
23//    Unit Name:  cmp_redhdr (sram redundancy header)
24//    Block Name: EFC
25//
26//    This is the header used to read and write the fuse values to the
27//    RAM blocks.  It is used to drive the ICD, DCD and L2T.  It is
28//    outside the array it is driving.
29//
30//    Top level signal renaming:
31//       s/ary/<your_ary_name>/g
32//       s/xfuse/<your_ary_initial>fuse/g
33//
34//       E.g.  fuse_ary_wren -> fuse_icd_wren
35//             efc_spc_xfuse_data -> efc_spc_ifuse_data, efc_sct_fuse_data
36//
37//-----------------------------------------------------------------------------
38`include "sys.h"
39`include "iop.h"
40
41//FPGA_SYN enables all FPGA related modifications
42`ifdef FPGA_SYN 
43`define FPGA_SYN_CLK
44`endif
45
46module cmp_sram_redhdr (/*AUTOARG*/
47   // Outputs
48   fuse_ary_wren, fuse_ary_rid, fuse_ary_repair_value, 
49   fuse_ary_repair_en, spc_efc_xfuse_data, scanout, 
50   // Inputs
51   rclk, se, scanin, arst_l, testmode_l, efc_spc_fuse_clk1, 
52   efc_spc_fuse_clk2, efc_spc_xfuse_data, efc_spc_xfuse_ashift, 
53   efc_spc_xfuse_dshift, ary_fuse_repair_value, ary_fuse_repair_en
54   );
55
56   input                rclk;
57   input                se;
58   input                scanin;                 // CMP clock, L1 phase
59   input    arst_l;
60   input    testmode_l;
61
62   // eFuse controller interface
63   input                efc_spc_fuse_clk1;
64   input                efc_spc_fuse_clk2;
65   input                efc_spc_xfuse_data;
66   input                efc_spc_xfuse_ashift;   // addr shift; low during rst
67   input                efc_spc_xfuse_dshift;   // data shift; low during rst
68
69   // interface to cache redundancy logic
70   input [7:0] ary_fuse_repair_value;  //data out for redundancy register
71   input [1:0] ary_fuse_repair_en;     //enable bits out
72   
73
74   // outputs
75   // interface to icache
76   output      fuse_ary_wren;         //redundancy reg wr enable, qualified
77   output [5:0] fuse_ary_rid;         //redundancy register id
78   output [7:0] fuse_ary_repair_value;//data in for redundancy register
79   output [1:0] fuse_ary_repair_en;   //enable bits to turn on redundancy
80
81   // serial rd data to controller
82   output       spc_efc_xfuse_data;
83
84   // normal scan out
85   output       scanout;
86
87`ifdef FPGA_SYN_CLK
88   assign fuse_ary_wren = 1'b0;
89   assign fuse_ary_rid = 6'b0;
90   assign fuse_ary_repair_value = 8'b0;
91   assign fuse_ary_repair_en = 2'b0;
92   assign spc_efc_xfuse_data = 1'b0;
93   assign scanout = 1'b0;
94`else
95
96   // local signals
97   wire         clk;
98   wire         int_clk1;
99   wire         int_clk2;
100   wire         int_scanout; // !! hook up to last flop in scan chain !!
101   wire         int_scanin;  // !! hook up to 1st flop in scan chain !!
102
103   wire [6:0]   addr_shft_nxt;
104   wire [6:0]   addr_shft_ff;
105   wire         addr_shft_en;
106   wire         wren_bit;
107
108   wire [11:0]  data_shft_nxt;
109   wire [11:0]  data_shft_ff;
110   wire         data_shft_en;
111
112   wire         dshift_dly1_ff;
113   wire         dshift_dly2_ff;
114   wire         ashift_dly1_ff;
115   wire         ashift_dly2_ff;
116   wire         wren_ff;
117   wire         wren_ph1;
118   wire         rden_ph1;
119
120   /*AUTOWIRE*/
121   // Beginning of automatic wires (for undeclared instantiated-module outputs)
122   // End of automatics
123
124   //
125   // Code Begins Here
126   //
127
128   assign       clk = rclk;
129   
130   //  Test logic
131   assign       int_clk1 = (~testmode_l) ? rclk : efc_spc_fuse_clk1;
132   assign       int_clk2 = (~testmode_l) ? rclk : efc_spc_fuse_clk2;
133   assign       int_scanout = 1'b0; 
134
135   // Need latch to avoid hold time problems
136   // connect int_scanout to last flop in scan chain
137   bw_u1_scanlg_2x so_lockup(.so (scanout), 
138                             .sd (int_scanout), 
139                             .ck (clk),  .se(se));
140   // connect int_scanin to first flop in scan chain
141   bw_u1_scanlg_2x si_lockup(.so (int_scanin),
142                             .sd (scanin), 
143                             .ck (clk), .se(se));
144
145   //  Shift registers
146   //  Address
147   assign   addr_shft_en = efc_spc_xfuse_ashift;
148   assign   addr_shft_nxt = {addr_shft_ff[5:0], efc_spc_xfuse_data};
149
150   dffe_s #(7) addr_shft_reg (.din  (addr_shft_nxt), 
151                                        .q    (addr_shft_ff), 
152                            .en   (addr_shft_en), 
153                            .clk  (int_clk1), .se(se), .si(), .so());
154   
155   assign   fuse_ary_rid[5:0] = addr_shft_ff[6:1];
156   assign   wren_bit = addr_shft_ff[0];
157
158   // Data
159   assign   data_shft_en = efc_spc_xfuse_dshift | dshift_dly1_ff | rden_ph1;
160
161   // mux2es
162   assign   data_shft_nxt = rden_ph1
163            ? {{3{ary_fuse_repair_en[1]}},
164               ary_fuse_repair_value[7:0], 
165               ary_fuse_repair_en[0]}
166            : {data_shft_ff[10:0], 
167               efc_spc_xfuse_data};
168   
169   // 10:9 is unused
170   dffe_s #(12)          data_shft_reg (.din  (data_shft_nxt),
171                                                  .q    (data_shft_ff), 
172                                .en   (data_shft_en), 
173                                .clk  (int_clk1), .se(se), .si(), .so());
174   
175   assign   fuse_ary_repair_value = data_shft_ff[8:1];
176   assign   fuse_ary_repair_en    = {(data_shft_ff[11] & wren_ff),
177                                     (data_shft_ff[0] & wren_ff)};
178
179   // Control
180   dff_s #(1) ashift_dly1_reg (.din (efc_spc_xfuse_ashift), 
181                             .q   (ashift_dly1_ff),
182                                                     .clk (int_clk1), .se(se), .si(), .so());
183   dff_s #(1) ashift_dly2_reg (.din (ashift_dly1_ff), 
184                             .q   (ashift_dly2_ff),
185                                                     .clk (int_clk1), .se(se), .si(), .so());
186
187   dffrl_async #(1) dshift_dly1_reg (.din (efc_spc_xfuse_dshift), 
188                             .q   (dshift_dly1_ff), 
189                             .rst_l (arst_l),
190                                                     .clk (int_clk1), .se(se), .si(), .so());
191   dffrl_async #(1) dshift_dly2_reg (.din (dshift_dly1_ff), 
192                             .q   (dshift_dly2_ff), 
193                             .rst_l (arst_l),
194                                                     .clk (int_clk1), .se(se), .si(), .so());
195   
196   assign   wren_ph1 = dshift_dly2_ff && ~dshift_dly1_ff && wren_bit;
197   assign   rden_ph1 = ashift_dly2_ff && ~ashift_dly1_ff && ~wren_bit;
198
199   // use phase two for wren since array writes in phase one
200   dffrl_async #(1) wren_reg (.din  (wren_ph1), 
201                      .q     (wren_ff),
202                      .rst_l (arst_l),
203                                              .clk   (int_clk2), .se(se), .si(), .so());
204
205   // address is never shifted out
206   assign   spc_efc_xfuse_data = data_shft_ff[11];
207   assign   fuse_ary_wren = wren_ff & testmode_l;
208`endif
209   
210endmodule // cmp_sram_redhdr
211
212// Local Variables:
213// verilog-library-directories:("." "../../common/rtl")
214// verilog-library-files:      ("../../common/rtl/swrvr_clib.v")
215// verilog-auto-sense-defines-constant:t
216// End:
Note: See TracBrowser for help on using the repository browser.