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

Subversion Repositories ethmac

[/] [ethmac/] [trunk/] [rtl/] [verilog/] [eth_spram_256x32.v] - Blame information for rev 302

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

Line No. Rev Author Line
1 122 mohor
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  eth_spram_256x32.v                                          ////
4
////                                                              ////
5
////  This file is part of the Ethernet IP core project           ////
6
////  http://www.opencores.org/projects/ethmac/                   ////
7
////                                                              ////
8
////  Author(s):                                                  ////
9
////      - Igor Mohor (igorM@opencores.org)                      ////
10
////                                                              ////
11 204 mohor
////  All additional information is available in the Readme.txt   ////
12 122 mohor
////  file.                                                       ////
13
////                                                              ////
14
//////////////////////////////////////////////////////////////////////
15
////                                                              ////
16
//// Copyright (C) 2001, 2002 Authors                             ////
17
////                                                              ////
18
//// This source file may be used and distributed without         ////
19
//// restriction provided that this copyright statement is not    ////
20
//// removed from the file and that any derivative work contains  ////
21
//// the original copyright notice and the associated disclaimer. ////
22
////                                                              ////
23
//// This source file is free software; you can redistribute it   ////
24
//// and/or modify it under the terms of the GNU Lesser General   ////
25
//// Public License as published by the Free Software Foundation; ////
26
//// either version 2.1 of the License, or (at your option) any   ////
27
//// later version.                                               ////
28
////                                                              ////
29
//// This source is distributed in the hope that it will be       ////
30
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
31
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
32
//// PURPOSE.  See the GNU Lesser General Public License for more ////
33
//// details.                                                     ////
34
////                                                              ////
35
//// You should have received a copy of the GNU Lesser General    ////
36
//// Public License along with this source; if not, download it   ////
37
//// from http://www.opencores.org/lgpl.shtml                     ////
38
////                                                              ////
39
//////////////////////////////////////////////////////////////////////
40
//
41
// CVS Revision History
42
//
43
// $Log: not supported by cvs2svn $
44 302 markom
// Revision 1.5  2003/08/14 16:42:58  simons
45
// Artisan ram instance added.
46
//
47 297 simons
// Revision 1.4  2002/10/18 17:04:20  tadejm
48
// Changed BIST scan signals.
49
//
50 227 tadejm
// Revision 1.3  2002/10/10 16:29:30  mohor
51
// BIST added.
52
//
53 210 mohor
// Revision 1.2  2002/09/23 18:24:31  mohor
54
// ETH_VIRTUAL_SILICON_RAM supported (for ASIC implementation).
55
//
56 204 mohor
// Revision 1.1  2002/07/23 16:36:09  mohor
57
// ethernet spram added. So far a generic ram and xilinx RAMB4 are used.
58 122 mohor
//
59
//
60 204 mohor
//
61 122 mohor
 
62 204 mohor
`include "eth_defines.v"
63 122 mohor
`include "timescale.v"
64
 
65
module eth_spram_256x32(
66
        // Generic synchronous single-port RAM interface
67
        clk, rst, ce, we, oe, addr, di, do
68 210 mohor
 
69
`ifdef ETH_BIST
70 227 tadejm
  ,
71
  // debug chain signals
72 302 markom
  mbist_si_i,       // bist scan serial in
73
  mbist_so_o,       // bist scan serial out
74
  mbist_ctrl_i        // bist chain shift control
75 210 mohor
`endif
76
 
77
 
78
 
79 122 mohor
);
80
 
81
        //
82
        // Generic synchronous single-port RAM interface
83
        //
84
        input           clk;  // Clock, rising edge
85
        input           rst;  // Reset, active high
86
        input           ce;   // Chip enable input, active high
87
        input           we;   // Write enable input, active high
88
        input           oe;   // Output enable input, active high
89
        input  [7:0]    addr; // address bus inputs
90
        input  [31:0]   di;   // input data bus
91
        output [31:0]   do;   // output data bus
92
 
93
 
94 210 mohor
`ifdef ETH_BIST
95 302 markom
  input   mbist_si_i;       // bist scan serial in
96
  output  mbist_so_o;       // bist scan serial out
97
  input [`ETH_MBIST_CTRL_WIDTH - 1:0] mbist_ctrl_i;       // bist chain shift control
98 210 mohor
`endif
99
 
100 122 mohor
`ifdef ETH_XILINX_RAMB4
101
 
102
    RAMB4_S16 ram0
103
    (
104
        .DO      (do[15:0]),
105
        .ADDR    (addr),
106
        .DI      (di[15:0]),
107
        .EN      (ce),
108
        .CLK     (clk),
109
        .WE      (we),
110
        .RST     (rst)
111
    );
112
 
113
    RAMB4_S16 ram1
114
    (
115
        .DO      (do[31:16]),
116
        .ADDR    (addr),
117
        .DI      (di[31:16]),
118
        .EN      (ce),
119
        .CLK     (clk),
120
        .WE      (we),
121
        .RST     (rst)
122
    );
123
 
124 204 mohor
`else   // !ETH_XILINX_RAMB4
125
`ifdef  ETH_VIRTUAL_SILICON_RAM
126 210 mohor
  `ifdef ETH_BIST
127
      vs_hdsp_256x32_bist ram0_bist
128
  `else
129
      vs_hdsp_256x32 ram0
130
  `endif
131
      (
132
        .CK         (clk),
133
        .CEN        (!ce),
134
        .WEN        (!we),
135
        .OEN        (!oe),
136
        .ADR        (addr),
137
        .DI         (di),
138
        .DOUT       (do)
139 122 mohor
 
140 210 mohor
      `ifdef ETH_BIST
141
        ,
142
        // debug chain signals
143 302 markom
        .mbist_si_i       (mbist_si_i),
144
        .mbist_so_o       (mbist_so_o),
145
        .mbist_ctrl_i       (mbist_ctrl_i)
146 210 mohor
      `endif
147
      );
148
 
149 204 mohor
`else   // !ETH_VIRTUAL_SILICON_RAM
150
 
151 297 simons
`ifdef  ETH_ARTISAN_RAM
152
  `ifdef ETH_BIST
153
      art_hssp_256x32_bist ram0_bist
154
  `else
155
      art_hssp_256x32 ram0
156
  `endif
157
      (
158
        .CLK        (clk),
159
        .CEN        (!ce),
160
        .WEN        (!we),
161
        .OEN        (!oe),
162
        .A          (addr),
163
        .D          (di),
164
        .Q          (do)
165
 
166
      `ifdef ETH_BIST
167
        ,
168
        // debug chain signals
169 302 markom
        .mbist_si_i       (mbist_si_i),
170
        .mbist_so_o       (mbist_so_o),
171
        .mbist_ctrl_i       (mbist_ctrl_i)
172 297 simons
      `endif
173
      );
174
 
175
`else   // !ETH_ARTISAN_RAM
176 122 mohor
        //
177
        // Generic single-port synchronous RAM model
178
        //
179
 
180
        //
181
        // Generic RAM's registers and wires
182
        //
183
        reg  [31:0] mem [255:0];  // RAM content
184
        wire [31:0] q;          // RAM output
185
        reg  [7:0]  raddr;      // RAM read address
186
        //
187
        // Data output drivers
188
        //
189
        assign do = (oe & ce) ? q : {32{1'bz}};
190
 
191
        //
192
        // RAM read and write
193
        //
194
 
195
        // read operation
196
        always@(posedge clk)
197
        if (ce) // && !we)
198
                raddr <= #1 addr;    // read address needs to be registered to read clock
199
 
200
        assign #1 q = rst ? {32{1'b0}} : mem[raddr];
201
 
202
        // write operation
203
        always@(posedge clk)
204
                if (ce && we)
205
                        mem[addr] <= #1 di;
206
 
207
        // Task prints range of memory
208
        // *** Remember that tasks are non reentrant, don't call this task in parallel for multiple instantiations. 
209
        task print_ram;
210
        input [7:0] start;
211
        input [7:0] finish;
212
        integer rnum;
213
        begin
214
                for (rnum=start;rnum<=finish;rnum=rnum+1)
215
                        $display("Addr %h = %h",rnum,mem[rnum]);
216
        end
217
        endtask
218
 
219 297 simons
`endif  // !ETH_ARTISAN_RAM
220 204 mohor
`endif  // !ETH_VIRTUAL_SILICON_RAM
221
`endif  // !ETH_XILINX_RAMB4
222 122 mohor
 
223
endmodule

powered by: WebSVN 2.1.0

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