OpenCores
URL https://opencores.org/ocsvn/sparc64soc/sparc64soc/trunk

Subversion Repositories sparc64soc

[/] [sparc64soc/] [trunk/] [T1-common/] [srams/] [bw_r_rf32x152b.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dmitryr
// ========== Copyright Header Begin ==========================================
2
// 
3
// OpenSPARC T1 Processor File: bw_r_rf32x152b.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
//      Description:    DCache Fill Queue of Load Store Unit.
24
//                      - Contains invalidates and loads.
25
//                      - loads will bypass and/or fill dcache.
26
//                      - Entry at head of queue may have to
27
//                      be held for multiple passes.
28
//
29
*/
30
 
31
////////////////////////////////////////////////////////////////////////
32
// Local header file includes / local defines
33
////////////////////////////////////////////////////////////////////////
34
 
35
//FPGA_SYN enables all FPGA related modifications
36
`ifdef FPGA_SYN
37
`define FPGA_SYN_32x152
38
`endif
39
 
40
`ifdef FPGA_SYN_32x152
41
 
42
 
43
module bw_r_rf32x152b(dout, so, rd_en, rd_adr, wr_en, wr_adr, din, si, se,
44
        sehold, rclk, rst_tri_en, reset_l);
45
 
46
        parameter               NUMENTRIES      = 32;
47
 
48
        input   [4:0]            rd_adr;
49
        input                   rd_en;
50
        input                   wr_en;
51
        input   [4:0]            wr_adr;
52
        input   [151:0]          din;
53
        input                   rclk;
54
        input                   reset_l;
55
        input                   rst_tri_en;
56
        input                   sehold;
57
        input                   si;
58
        input                   se;
59
        output  [151:0]          dout;
60
        reg     [151:0]          dout;
61
        output                  so;
62
 
63
        wire                    clk;
64
        wire                    wr_vld;
65
 
66
        reg     [151:0]          dfq_mem[(NUMENTRIES - 1):0] /* synthesis syn_ramstyle = block_ram  syn_ramstyle = no_rw_check */ ;
67
 
68
        assign clk = rclk;
69
        assign wr_vld = ((wr_en & (~rst_tri_en)) & reset_l);
70
 
71
        always @(posedge clk) begin
72
          if (wr_vld) begin
73
            dfq_mem[wr_adr] = din;
74
          end
75
        end
76
        always @(posedge clk) begin
77
          if (rd_en) begin
78
            dout[151:0] <= dfq_mem[rd_adr[4:0]];
79
          end
80
        end
81
endmodule
82
 
83
 
84
`else
85
 
86
module bw_r_rf32x152b (/*AUTOARG*/
87
   // Outputs
88
   dout, so,
89
   // Inputs
90
   rd_en, rd_adr, wr_en, wr_adr, din,
91
   si, se, sehold, rclk, rst_tri_en, reset_l);
92
 
93
parameter NUMENTRIES = 32 ;     // number of entries in dfq 
94
 
95
input [4:0]   rd_adr;     // read adr. 
96
input         rd_en;      // read pointer
97
input         wr_en;      // write pointer vld
98
input [4:0]   wr_adr;     // write adr.
99
input [151:0] din;            // wr data 
100
input             rclk;       // clock
101
input         reset_l;    // active low reset
102
input         rst_tri_en; // reset and scan  
103
input         sehold;     // scan hold 
104
input             si;             // scan in 
105
input             se;             // scan enable 
106
 
107
output  [151:0] dout ; // data read out
108
output                  so ;   // scan out  
109
 
110
wire [151:0]    dout;
111
wire clk;
112
wire wr_vld;
113
 
114
reg     [151:0]         dfq_mem [NUMENTRIES-1:0];
115
 
116
reg [151:0]     local_dout;
117
// reg                  so; 
118
 
119
integer i,j;
120
 
121
//
122
// added for atpg support
123
wire [4:0]   sehold_rd_adr;        // output of sehold mux - read adr. 
124
wire         sehold_rd_en;         // output of sehold mux - read pointer
125
wire         sehold_wr_en;         // output of sehold mux - write pointer vld
126
wire [4:0]   sehold_wr_adr;        // output of sehold mux - write adr.
127
wire [151:0]  sehold_din;          // wr data 
128
 
129
wire [4:0]   rd_adr_d1;    // flopped read adr. 
130
wire         rd_en_d1;     // flopped read pointer
131
wire         wr_en_d1;     // flopped write pointer vld
132
wire [4:0]   wr_adr_d1;    // flopped write adr.
133
wire [151:0]  din_d1;      // flopped wr data 
134
 
135
//
136
// creating local clock
137
assign clk=rclk;
138
// 
139
//=========================================================================================
140
//      support for atpg pattern generation
141
//=========================================================================================
142
//
143
// read controls
144
dp_mux2es #(6) mux_sehold_rd_ctrl (
145
    .in0  ({rd_adr[4:0], rd_en}),
146
    .in1  ({rd_adr_d1[4:0], rd_en_d1}),
147
    .sel  (sehold),
148
    .dout ({sehold_rd_adr[4:0],sehold_rd_en})
149
);
150
 
151
dff_s #(6) dff_rd_ctrl_d1(
152
    .din ({sehold_rd_adr[4:0], sehold_rd_en}),
153
    .q   ({rd_adr_d1[4:0], rd_en_d1}),
154
    .clk (clk),
155
    .se  (se),
156
    .si  (),
157
    .so  ()
158
);
159
//
160
// write controls
161
dp_mux2es #(6) mux_sehold_wr_ctrl (
162
        .in0    ({wr_adr[4:0], wr_en}),
163
        .in1    ({wr_adr_d1[4:0], wr_en_d1}),
164
        .sel    (sehold),
165
        .dout   ({sehold_wr_adr[4:0],sehold_wr_en})
166
);
167
 
168
dff_s #(6) dff_wr_ctrl_d1(
169
    .din ({sehold_wr_adr[4:0], sehold_wr_en}),
170
    .q   ({wr_adr_d1[4:0], wr_en_d1}),
171
    .clk (clk),
172
    .se  (se),
173
    .si  (),
174
    .so  ()
175
);
176
//
177
// write data
178
dp_mux2es #(152) mux_sehold_din (
179
        .in0    (din[151:0]),
180
        .in1    (din_d1[151:0]),
181
        .sel    (sehold),
182
        .dout   (sehold_din[151:0])
183
);
184
 
185
dff_s #(152) dff_din_d1(
186
    .din (sehold_din[151:0]),
187
    .q   (din_d1[151:0]),
188
    .clk (clk),
189
    .se  (se),
190
    .si  (),
191
    .so  ()
192
);
193
 
194
//
195
// diable write to register file during reset or scan
196
assign wr_vld = sehold_wr_en & ~rst_tri_en & reset_l;
197
 
198
//    always @ (posedge clk)
199
//      begin
200
//         so <= 1'bx;
201
//      end
202
 
203
//=========================================================================================
204
//      generate wordlines
205
//=========================================================================================
206
 
207
// Word-Line Generation skipped. Implicit in read and write.
208
 
209
//=========================================================================================
210
//      write or read to/from memory
211
//=========================================================================================
212
 
213
 
214
always @ ( posedge clk )
215
        begin
216
                if (wr_vld)
217
                 dfq_mem[sehold_wr_adr] = sehold_din[151:0] ;
218
                end
219
 
220
always @ ( posedge clk )
221
        begin
222
                   if (sehold_rd_en)
223
                      begin
224
                      if (wr_vld & (sehold_wr_adr[4:0] == sehold_rd_adr[4:0]) )
225
                         local_dout[151:0] <= 152'hx;
226
                      else
227
                      for (j=0;j<NUMENTRIES;j=j+1)
228
                      begin
229
                      if (sehold_rd_adr[4:0] == j)
230
                         local_dout[151:0] <= dfq_mem[j] ;
231
                      end
232
                    end
233
        end
234
 
235
always @ ( ~reset_l )
236
        begin
237
                local_dout[151:0] <=
238
                152'hxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx_xxxx ;
239
        end
240
 
241
 
242
assign dout[151:0] = local_dout[151:0];
243
 
244
// Error Checking : Termination Conditions
245
 
246
always @ (posedge clk)
247
        begin
248
                if ((rd_en == 1'bx) | // wr is undefined, thus terminate
249
                        (sehold_rd_en & (sehold_rd_adr[4:0] == 5'hxx)) & reset_l) // check outside reset.
250
                        if (sehold_rd_adr[4:0] == 5'hxx)
251
                        begin
252
`ifdef INNO_MUXEX
253
`else
254
`ifdef DEFINE_0IN
255
                                // 0in <fire -message "rf32x152b_error, read pointer error (X)"
256
                                $display("rf32x152b_error"," read pointer error (X) %h ", rd_adr[4:0]);
257
`else
258
                                                `ifdef MODELSIM
259
                                $display("rf32x152b_error"," read pointer error (X) %h ", rd_adr[4:0]);
260
                                                `else
261
                                $error("rf32x152b_error"," read pointer error (X) %h ", rd_adr[4:0]);
262
                                                `endif
263
`endif
264
`endif
265
                        end
266
                if ((wr_vld == 1'bx) | // wr is undefined, thus terminate
267
                        (wr_vld & (sehold_wr_adr[4:0] == 5'hxx)) & reset_l) // check outside reset.
268
                        begin
269
`ifdef INNO_MUXEX
270
`else
271
`ifdef DEFINE_0IN
272
                                // 0in <fire -message "rf32x152b_error, write error (X)"
273
                                $display("rf32x152b_error"," write error (X) %h ", wr_adr[4:0]);
274
`else
275
                                                `ifdef MODELSIM
276
                                    $display("rf32x152b_error"," write error (X) %h ", wr_adr[4:0]);
277
                                                `else
278
                                $error("rf32x152b_error"," write error (X) %h ", wr_adr[4:0]);
279
                                                `endif
280
`endif
281
`endif
282
                        end
283
        end
284
 
285
endmodule
286
 
287
`endif
288
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.