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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [rtl/] [8051/] [oc8051_ram_64x32_dual_bist.v] - Blame information for rev 65

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 cache ram                                              ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   64x31 dual port ram                                        ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@opencores.org                     ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
20
////                                                              ////
21
//// This source file may be used and distributed without         ////
22
//// restriction provided that this copyright statement is not    ////
23
//// removed from the file and that any derivative work contains  ////
24
//// the original copyright notice and the associated disclaimer. ////
25
////                                                              ////
26
//// This source file is free software; you can redistribute it   ////
27
//// and/or modify it under the terms of the GNU Lesser General   ////
28
//// Public License as published by the Free Software Foundation; ////
29
//// either version 2.1 of the License, or (at your option) any   ////
30
//// later version.                                               ////
31
////                                                              ////
32
//// This source is distributed in the hope that it will be       ////
33
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
34
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
35
//// PURPOSE.  See the GNU Lesser General Public License for more ////
36
//// details.                                                     ////
37
////                                                              ////
38
//// You should have received a copy of the GNU Lesser General    ////
39
//// Public License along with this source; if not, download it   ////
40
//// from http://www.opencores.org/lgpl.shtml                     ////
41
////                                                              ////
42
//////////////////////////////////////////////////////////////////////
43
//
44
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47
//
48
//
49
 
50
// synopsys translate_off
51
`include "oc8051_timescale.v"
52
// synopsys translate_on
53
 
54
`include "oc8051_defines.v"
55
 
56
//
57
// duble port ram
58
//
59
module oc8051_ram_64x32_dual_bist (
60
                     clk,
61
                     rst,
62
 
63
                     adr0,
64
                     dat0_o,
65
                     en0,
66
 
67
                     adr1,
68
                     dat1_i,
69
                     dat1_o,
70
                     en1,
71
                     wr1
72
`ifdef OC8051_BIST
73
         ,
74
         scanb_rst,
75
         scanb_clk,
76
         scanb_si,
77
         scanb_so,
78
         scanb_en
79
`endif
80
                     );
81
 
82
parameter ADR_WIDTH = 6;
83
 
84
input         clk,
85
              wr1,
86
              rst,
87
              en0,
88
              en1;
89
input  [7:0]  dat1_i;
90
input  [ADR_WIDTH-1:0]  adr0;
91
input  [ADR_WIDTH-1:0]  adr1;
92
 
93
output [31:0]  dat0_o;
94
output [31:0]  dat1_o;
95
 
96
reg    [7:0]  rd_data;
97
 
98
 
99
`ifdef OC8051_BIST
100
input   scanb_rst;
101
input   scanb_clk;
102
input   scanb_si;
103
output  scanb_so;
104
input   scanb_en;
105
`endif
106
 
107
 
108
`ifdef OC8051_RAM_XILINX
109
  xilinx_ram_dp xilinx_ram(
110
        // read port
111
        .CLKA(clk),
112
        .RSTA(rst),
113
        .ENA(en0),
114
        .ADDRA(adr0),
115
        .DIA(32'h00),
116
        .WEA(1'b0),
117
        .DOA(dat0_o),
118
 
119
        // write port
120
        .CLKB(clk),
121
        .RSTB(rst),
122
        .ENB(en1),
123
        .ADDRB(adr1),
124
        .DIB(dat1_i),
125
        .WEB(wr1),
126
        .DOB(dat1_o)
127
  );
128
 
129
  defparam
130
        xilinx_ram.dwidth = 32,
131
        xilinx_ram.awidth = ADR_WIDTH;
132
 
133
`else
134
 
135
  `ifdef OC8051_RAM_VIRTUALSILICON
136
 
137
  `else
138
 
139
    `ifdef OC8051_RAM_GENERIC
140
 
141
      generic_dpram #(ADR_WIDTH, 32) oc8051_ram1(
142
        .rclk  ( clk            ),
143
        .rrst  ( rst            ),
144
        .rce   ( en0            ),
145
        .oe    ( 1'b1           ),
146
        .raddr ( adr0           ),
147
        .do    ( dat0_o         ),
148
 
149
        .wclk  ( clk            ),
150
        .wrst  ( rst            ),
151
        .wce   ( en1            ),
152
        .we    ( wr1            ),
153
        .waddr ( adr1           ),
154
        .di    ( dat1_i         )
155
      );
156
 
157
    `else
158
 
159
      reg [31:0] dat1_o;
160
      reg [31:0] dat0_o;
161
      //
162
      // buffer
163
      reg    [31:0]  buff [0:(1<<ADR_WIDTH) -1];
164
 
165
      always @(posedge clk or posedge rst)
166
      begin
167
        if (rst)
168
          dat1_o     <= #1 32'h0;
169
        else if (wr1) begin
170
          buff[adr1] <= #1 dat1_i;
171
          dat1_o    <= #1 dat1_i;
172
        end else
173
          dat1_o <= #1 buff[adr1];
174
      end
175
 
176
      always @(posedge clk or posedge rst)
177
      begin
178
        if (rst)
179
          dat0_o <= #1 32'h0;
180
        else if ((adr0==adr1) & wr1)
181
          dat0_o <= #1 dat1_i;
182
        else
183
          dat0_o <= #1 buff[adr0];
184
      end
185
 
186
    `endif  //OC8051_RAM_GENERIC
187
  `endif    //OC8051_RAM_VIRTUALSILICON  
188
`endif      //OC8051_RAM_XILINX
189
 
190
endmodule

powered by: WebSVN 2.1.0

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