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 24

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

Line No. Rev Author Line
1 2 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
`else
125
 
126
  `ifdef OC8051_RAM_VIRTUALSILICON
127
 
128
  `else
129
 
130
    `ifdef OC8051_RAM_GENERIC
131
 
132
      generic_dpram #(8, 8) oc8051_ram1(
133
        .rclk  ( clk            ),
134
        .rrst  ( rst            ),
135
        .rce   ( rd_en          ),
136
        .oe    ( 1'b1           ),
137
        .raddr ( rd_addr        ),
138
        .do    ( rd_data        ),
139
 
140
        .wclk  ( clk            ),
141
        .wrst  ( rst            ),
142
        .wce   ( wr_en          ),
143
        .we    ( wr             ),
144
        .waddr ( wr_addr        ),
145
        .di    ( wr_data        )
146
      );
147
 
148
    `else
149
 
150
      reg    [7:0]  rd_data;
151
      //
152
      // buffer
153
      reg    [7:0]  buff [0:256];
154
 
155
 
156
      //
157
      // writing to ram
158
      always @(posedge clk)
159
      begin
160
       if (wr)
161
          buff[wr_addr] <= #1 wr_data;
162
      end
163
 
164
      //
165
      // reading from ram
166
      always @(posedge clk or posedge rst)
167
      begin
168
        if (rst)
169
          rd_data <= #1 8'h0;
170
        else if ((wr_addr==rd_addr) & wr & rd_en)
171
          rd_data <= #1 wr_data;
172
        else if (rd_en)
173
          rd_data <= #1 buff[rd_addr];
174
      end
175
    `endif  //OC8051_RAM_GENERIC
176
  `endif    //OC8051_RAM_VIRTUALSILICON  
177
`endif      //OC8051_RAM_XILINX
178
 
179
endmodule

powered by: WebSVN 2.1.0

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