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

Subversion Repositories aemb

[/] [aemb/] [trunk/] [rtl/] [verilog/] [aeMB2_spsram.v] - Blame information for rev 207

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

Line No. Rev Author Line
1 119 sybreon
/* $Id: aeMB2_spsram.v,v 1.1 2008-04-20 16:33:39 sybreon Exp $
2
**
3
** AEMB2 EDK 6.2 COMPATIBLE CORE
4
** Copyright (C) 2004-2008 Shawn Tan <shawn.tan@aeste.net>
5
**
6
** This file is part of AEMB.
7
**
8
** AEMB is free software: you can redistribute it and/or modify it
9
** under the terms of the GNU Lesser General Public License as
10
** published by the Free Software Foundation, either version 3 of the
11
** License, or (at your option) any later version.
12
**
13
** AEMB is distributed in the hope that it will be useful, but WITHOUT
14
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15
** or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
16
** Public License for more details.
17
**
18
** You should have received a copy of the GNU Lesser General Public
19
** License along with AEMB. If not, see <http:**www.gnu.org/licenses/>.
20
*/
21
 
22
/**
23
 * @file aeMB2_spsram.v
24
 * @brief On-chip singla-port synchronous SRAM.
25
 
26
 * Infer a write-before-read block RAM.
27
 
28
 * NOTES: Quartus (<=7.2) does not infer a block RAM with read enable.
29
 
30
 */
31
 
32
module aeMB2_spsram (/*AUTOARG*/
33
   // Outputs
34
   dat_o,
35
   // Inputs
36
   adr_i, dat_i, wre_i, ena_i, rst_i, clk_i
37
   ) ;
38
   parameter AW = 8;
39
   parameter DW = 32;
40
 
41
   // PORT A - READ/WRITE
42
   output [DW-1:0] dat_o;
43
   input [AW-1:0]  adr_i;
44
   input [DW-1:0]  dat_i;
45
   input           wre_i,
46
                   ena_i,
47
                   rst_i,
48
                   clk_i;
49
 
50
   /*AUTOREG*/
51
   // Beginning of automatic regs (for this module's undeclared outputs)
52
   reg [DW-1:0]          dat_o;
53
   // End of automatics
54
   reg [DW:1]      rRAM [(1<<AW)-1:0];
55
   reg [AW:1]      rADR;
56
 
57
   always @(posedge clk_i)
58
     if (wre_i) rRAM[adr_i] <= #1 dat_i;
59
 
60
   always @(posedge clk_i)
61
     if (rst_i)
62
       /*AUTORESET*/
63
       // Beginning of autoreset for uninitialized flops
64
       dat_o <= {(1+(DW-1)){1'b0}};
65
       // End of automatics
66
     else if (ena_i)
67
       dat_o <= #1 rRAM[adr_i];
68
 
69
   // --- SIMULATION ONLY ------------------------------------
70
   // synopsys translate_off
71
   integer i;
72
   initial begin
73
      for (i=0; i<(1<<AW); i=i+1) begin
74
         rRAM[i] <= $random;
75
      end
76
   end
77
   // synopsys translate_on
78
 
79
endmodule // aeMB2_spsram

powered by: WebSVN 2.1.0

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