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

Subversion Repositories ethmac

[/] [ethmac/] [tags/] [rel_14/] [rtl/] [verilog/] [eth_spram_256x32.v] - Blame information for rev 210

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

powered by: WebSVN 2.1.0

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