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

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

versione iniziale opensparc

Line 
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T1 Processor File: bw_r_efa.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//
23//      Module:         bw_r_efa
24//
25//      Description:   RTL model for EFA (EFuse Array)
26//
27//****************************************************************
28`include "sys.h"
29
30module bw_r_efa (
31        vpp,
32        pi_efa_prog_en, 
33        sbc_efa_read_en,
34        sbc_efa_word_addr,     
35        sbc_efa_bit_addr,
36        sbc_efa_margin0_rd,
37        sbc_efa_margin1_rd,
38        efa_sbc_data,
39        pwr_ok,
40        por_n,
41        sbc_efa_sup_det_rd,
42        sbc_efa_power_down,
43        so,
44        si,
45        se,
46        vddo,
47        clk
48);
49
50
51input            vpp;                   // VPP input from I/O
52
53output  [31:0]   efa_sbc_data;          // Data from e-fuse array to SBC
54input            pi_efa_prog_en;        // e-fuse array program enable
55input            sbc_efa_read_en;       // e-fuse array read enable
56input   [5:0]    sbc_efa_word_addr;     // e-fuse array word addr
57input   [4:0]    sbc_efa_bit_addr;      // e-fuse array bit addr
58input            sbc_efa_margin0_rd;    // e-fuse array margin0 read
59input            sbc_efa_margin1_rd;    // e-fuse array margin1 read
60
61input            pwr_ok;                // power_ok reset
62input            por_n;                 // por_n reset
63input            sbc_efa_sup_det_rd;    // e-fuse array supply detect read
64input            sbc_efa_power_down;    // e-fuse power down signal from SBC
65
66output           so;            // Scan ports
67input            si;
68input            se;
69input            vddo;
70input            clk;                   // cpu clk
71
72/*--------------------------------------------------------------------------*/
73
74//** Parameters and define **//
75parameter MAXFILENAME=200;
76//parameter     EFA_READ_LAT = 5670 ; // 7 system cycles (150Mhz) - 1/4(sys clk); about 45ns
77                                     // 840 ticks = 1 system cycle
78parameter       EFA_READ_LAT = 45000 ; //  about 45ns (timescale is 1 ps)
79/* The access time has been specified to be 45ns for a worst case read */
80
81//** Wire and Reg declarations **//
82
83reg [MAXFILENAME*8-1:0]  efuse_data_filename;
84reg [31:0] efuse_array[0:63],efuse_row,efa_read_data;   //EFUSE ARRAY
85integer file_get_status,i;
86reg [31:0] fpInVec;
87wire [31:0] efa_sbc_data;
88wire    l1clk;         
89wire    lvl_det_l;           // level detect ok
90wire    vddc_ok_l;           // vddc ok
91wire    vddo_ok_l;           // vddo ok
92wire    vpp_ok_l;            // vpp ok
93reg     efuse_rd_progress;
94reg     efuse_enable_write_check;
95
96/*--------------------------------------------------------------------------*/
97
98// Process data file
99 
100// synopsys translate_off
101initial 
102begin
103  efuse_enable_write_check = 1;
104  // Get Efuse data file from plusarg.
105  if ($value$plusargs("efuse_data_file=%s", efuse_data_filename))
106    begin
107      // Read Efuse data file if present
108      $display("INFO: efuse data file is being read--filename=%0s", 
109                        efuse_data_filename);
110      $readmemh(efuse_data_filename, efuse_array);
111      $display("INFO: completed reading efuse data file");
112    end
113  else 
114    begin 
115      //if file not present, initialize efuse_array with default value
116      $display("INFO: Using default efuse data for the efuse array");
117      for (i=0;i<=63;i=i+1) begin
118        efuse_array[i] = 32'b0;
119      end
120    end
121end   
122
123// Process power down signal
124assign l1clk   = clk & ~sbc_efa_power_down;
125
126// Scan logic not in RTL
127assign so = se ? si : 1'bx;
128
129//assign supply detect signals to valid values (circuit cannot be impl in model)
130assign vddc_ok_l = 1'b0;
131assign vddo_ok_l = 1'b0;
132assign vpp_ok_l  = 1'b0;
133assign lvl_det_l = 1'b0;
134
135
136always @(posedge l1clk) begin
137  // Write operation , one bit at a time
138  if ((pi_efa_prog_en === 1'b1) && (pwr_ok === 1'b1) && (por_n === 1'b1))  begin
139    efuse_row = efuse_array[sbc_efa_word_addr];
140    efuse_row[sbc_efa_bit_addr] = 1'b1;
141    efuse_array[sbc_efa_word_addr] <= efuse_row;
142  end
143end
144
145
146// efa_read_data is from the VPP_CORE which is reset to 0 in ckt when read is de-asserted
147// However in RTL it is reset to X because I want to simulate the wait time where
148// efa_read_data is indeed X till the latency period
149// margin reads are not modelled in the RTL
150always @(posedge l1clk) begin
151  // Read operation  , 32 bits at a time
152  if ((sbc_efa_read_en) & ~efuse_rd_progress)  begin
153   // About 45ns
154   efa_read_data[31:0] <= #EFA_READ_LAT efuse_array[sbc_efa_word_addr];
155   efuse_rd_progress = 1'b1;
156  end
157  if (~(sbc_efa_read_en))  begin
158    efuse_rd_progress = 1'b0;
159  end
160  if (~efuse_rd_progress) begin
161    efa_read_data[31:0] <= 32'bx;
162  end
163end
164// synopsys translate_on
165
166// In ckt, when sbc_efa_read_en is low, output remains the same.
167
168assign efa_sbc_data[31:0] = por_n ? ((pwr_ok & sbc_efa_read_en) ? (sbc_efa_sup_det_rd ?
169                                {28'bx,~lvl_det_l,~vddc_ok_l,~vddo_ok_l,~vpp_ok_l}
170                                : efa_read_data[31:0] ) : efa_sbc_data[31:0]) : 32'b0;
171
172
173endmodule
Note: See TracBrowser for help on using the repository browser.