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 76

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

powered by: WebSVN 2.1.0

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