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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [rtl/] [8051/] [oc8051_ram_256x8_two_bist.v] - Blame information for rev 68

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

Line No. Rev Author Line
1 68 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 internal ram                                           ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   256 bytes two 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
// two port ram
58
//
59
module oc8051_ram_256x8_two_bist (
60
                     clk,
61
                     rst,
62
                     rd_addr,
63
                     rd_data,
64
                     rd_en,
65
                     wr_addr,
66
                     wr_data,
67
                     wr_en,
68
                     wr
69
`ifdef OC8051_BIST
70
         ,
71
         scanb_rst,
72
         scanb_clk,
73
         scanb_si,
74
         scanb_so,
75
         scanb_en
76
`endif
77
                     );
78
 
79
 
80
input         clk,
81
              wr,
82
              rst,
83
              rd_en,
84
              wr_en;
85
input  [7:0]  wr_data;
86
input  [7:0]  rd_addr,
87
              wr_addr;
88
output [7:0]  rd_data;
89
 
90
`ifdef OC8051_BIST
91
input   scanb_rst;
92
input   scanb_clk;
93
input   scanb_si;
94
output  scanb_so;
95
input   scanb_en;
96
`endif
97
 
98
 
99
`ifdef OC8051_RAM_XILINX
100
  xilinx_ram_dp xilinx_ram(
101
        // read port
102
        .CLKA(clk),
103
        .RSTA(rst),
104
        .ENA(rd_en),
105
        .ADDRA(rd_addr),
106
        .DIA(8'h00),
107
        .WEA(1'b0),
108
        .DOA(rd_data),
109
 
110
        // write port
111
        .CLKB(clk),
112
        .RSTB(rst),
113
        .ENB(wr_en),
114
        .ADDRB(wr_addr),
115
        .DIB(wr_data),
116
        .WEB(wr),
117
        .DOB()
118
  );
119
 
120
  defparam
121
        xilinx_ram.dwidth = 8,
122
        xilinx_ram.awidth = 8;
123
 
124
`elsif OC8051_RAM_VIRTUALSILICON
125
 
126
`elsif  OC8051_RAM_ACTEL
127
 
128
      oc8051_actel_ram_256x8  oc8051_ram1(
129
        .RWCLK  ( clk            ),
130
        .RESET  ( rst            ),
131
        .REN   ( rd_en          ),
132
        .RADDR ( rd_addr        ),
133
        .RD    ( rd_data        ),
134
 
135
        .WEN    ( wr             ),
136
        .WADDR ( wr_addr        ),
137
        .WD    ( wr_data        )
138
      );
139
 
140
 
141
`elsif  OC8051_RAM_GENERIC
142
 
143
      generic_dpram #(8, 8) oc8051_ram1(
144
        .rclk  ( clk            ),
145
        .rrst  ( rst            ),
146
        .rce   ( rd_en          ),
147
        .oe    ( 1'b1           ),
148
        .raddr ( rd_addr        ),
149
        .do    ( rd_data        ),
150
 
151
        .wclk  ( clk            ),
152
        .wrst  ( rst            ),
153
        .wce   ( wr_en          ),
154
        .we    ( wr             ),
155
        .waddr ( wr_addr        ),
156
        .di    ( wr_data        )
157
      );
158
 
159
`else
160
 
161
      reg    [7:0]  rd_data;
162
      //
163
      // buffer
164
      reg    [7:0]  buff [0:256];
165
 
166
 
167
      //
168
      // writing to ram
169
      always @(posedge clk)
170
      begin
171
       if (wr)
172
          buff[wr_addr] <= #1 wr_data;
173
      end
174
 
175
      //
176
      // reading from ram
177
      always @(posedge clk or posedge rst)
178
      begin
179
        if (rst)
180
          rd_data <= #1 8'h0;
181
        else if ((wr_addr==rd_addr) & wr & rd_en)
182
          rd_data <= #1 wr_data;
183
        else if (rd_en)
184
          rd_data <= #1 buff[rd_addr];
185
      end
186
`endif      //OC8051_RAM_XILINX
187
 
188
endmodule

powered by: WebSVN 2.1.0

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