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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_ram_64x32_dual_bist.v] - Blame information for rev 36

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

powered by: WebSVN 2.1.0

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