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

Subversion Repositories ethmac

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

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 297 simons
// Revision 1.4  2002/10/18 17:04:20  tadejm
45
// Changed BIST scan signals.
46
//
47 227 tadejm
// Revision 1.3  2002/10/10 16:29:30  mohor
48
// BIST added.
49
//
50 210 mohor
// Revision 1.2  2002/09/23 18:24:31  mohor
51
// ETH_VIRTUAL_SILICON_RAM supported (for ASIC implementation).
52
//
53 204 mohor
// Revision 1.1  2002/07/23 16:36:09  mohor
54
// ethernet spram added. So far a generic ram and xilinx RAMB4 are used.
55 122 mohor
//
56
//
57 204 mohor
//
58 122 mohor
 
59 204 mohor
`include "eth_defines.v"
60 122 mohor
`include "timescale.v"
61
 
62
module eth_spram_256x32(
63
        // Generic synchronous single-port RAM interface
64
        clk, rst, ce, we, oe, addr, di, do
65 210 mohor
 
66
`ifdef ETH_BIST
67 227 tadejm
  ,
68
  // debug chain signals
69
  scanb_rst,      // bist scan reset
70
  scanb_clk,      // bist scan clock
71
  scanb_si,       // bist scan serial in
72
  scanb_so,       // bist scan serial out
73
  scanb_en        // bist scan shift enable
74 210 mohor
`endif
75
 
76
 
77
 
78 122 mohor
);
79
 
80
        //
81
        // Generic synchronous single-port RAM interface
82
        //
83
        input           clk;  // Clock, rising edge
84
        input           rst;  // Reset, active high
85
        input           ce;   // Chip enable input, active high
86
        input           we;   // Write enable input, active high
87
        input           oe;   // Output enable input, active high
88
        input  [7:0]    addr; // address bus inputs
89
        input  [31:0]   di;   // input data bus
90
        output [31:0]   do;   // output data bus
91
 
92
 
93 210 mohor
`ifdef ETH_BIST
94 227 tadejm
  input   scanb_rst;      // bist scan reset
95
  input   scanb_clk;      // bist scan clock
96
  input   scanb_si;       // bist scan serial in
97
  output  scanb_so;       // bist scan serial out
98
  input   scanb_en;       // bist scan shift enable
99 210 mohor
`endif
100
 
101 122 mohor
`ifdef ETH_XILINX_RAMB4
102
 
103
    RAMB4_S16 ram0
104
    (
105
        .DO      (do[15:0]),
106
        .ADDR    (addr),
107
        .DI      (di[15:0]),
108
        .EN      (ce),
109
        .CLK     (clk),
110
        .WE      (we),
111
        .RST     (rst)
112
    );
113
 
114
    RAMB4_S16 ram1
115
    (
116
        .DO      (do[31:16]),
117
        .ADDR    (addr),
118
        .DI      (di[31:16]),
119
        .EN      (ce),
120
        .CLK     (clk),
121
        .WE      (we),
122
        .RST     (rst)
123
    );
124
 
125 204 mohor
`else   // !ETH_XILINX_RAMB4
126
`ifdef  ETH_VIRTUAL_SILICON_RAM
127 210 mohor
  `ifdef ETH_BIST
128
      vs_hdsp_256x32_bist ram0_bist
129
  `else
130
      vs_hdsp_256x32 ram0
131
  `endif
132
      (
133
        .CK         (clk),
134
        .CEN        (!ce),
135
        .WEN        (!we),
136
        .OEN        (!oe),
137
        .ADR        (addr),
138
        .DI         (di),
139
        .DOUT       (do)
140 122 mohor
 
141 210 mohor
      `ifdef ETH_BIST
142
        ,
143
        // debug chain signals
144 227 tadejm
        .scanb_rst      (scanb_rst),
145
        .scanb_clk      (scanb_clk),
146
        .scanb_si       (scanb_si),
147
        .scanb_so       (scanb_so),
148
        .scanb_en       (scanb_en)
149 210 mohor
      `endif
150
      );
151
 
152 204 mohor
`else   // !ETH_VIRTUAL_SILICON_RAM
153
 
154 297 simons
`ifdef  ETH_ARTISAN_RAM
155
  `ifdef ETH_BIST
156
      art_hssp_256x32_bist ram0_bist
157
  `else
158
      art_hssp_256x32 ram0
159
  `endif
160
      (
161
        .CLK        (clk),
162
        .CEN        (!ce),
163
        .WEN        (!we),
164
        .OEN        (!oe),
165
        .A          (addr),
166
        .D          (di),
167
        .Q          (do)
168
 
169
      `ifdef ETH_BIST
170
        ,
171
        // debug chain signals
172
        .scanb_rst      (scanb_rst),
173
        .scanb_clk      (scanb_clk),
174
        .scanb_si       (scanb_si),
175
        .scanb_so       (scanb_so),
176
        .scanb_en       (scanb_en)
177
      `endif
178
      );
179
 
180
`else   // !ETH_ARTISAN_RAM
181 122 mohor
        //
182
        // Generic single-port synchronous RAM model
183
        //
184
 
185
        //
186
        // Generic RAM's registers and wires
187
        //
188
        reg  [31:0] mem [255:0];  // RAM content
189
        wire [31:0] q;          // RAM output
190
        reg  [7:0]  raddr;      // RAM read address
191
        //
192
        // Data output drivers
193
        //
194
        assign do = (oe & ce) ? q : {32{1'bz}};
195
 
196
        //
197
        // RAM read and write
198
        //
199
 
200
        // read operation
201
        always@(posedge clk)
202
        if (ce) // && !we)
203
                raddr <= #1 addr;    // read address needs to be registered to read clock
204
 
205
        assign #1 q = rst ? {32{1'b0}} : mem[raddr];
206
 
207
        // write operation
208
        always@(posedge clk)
209
                if (ce && we)
210
                        mem[addr] <= #1 di;
211
 
212
        // Task prints range of memory
213
        // *** Remember that tasks are non reentrant, don't call this task in parallel for multiple instantiations. 
214
        task print_ram;
215
        input [7:0] start;
216
        input [7:0] finish;
217
        integer rnum;
218
        begin
219
                for (rnum=start;rnum<=finish;rnum=rnum+1)
220
                        $display("Addr %h = %h",rnum,mem[rnum]);
221
        end
222
        endtask
223
 
224 297 simons
`endif  // !ETH_ARTISAN_RAM
225 204 mohor
`endif  // !ETH_VIRTUAL_SILICON_RAM
226
`endif  // !ETH_XILINX_RAMB4
227 122 mohor
 
228
endmodule

powered by: WebSVN 2.1.0

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