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

Subversion Repositories ahb_slave

[/] [ahb_slave/] [trunk/] [src/] [base/] [ahb_slave_mem.v] - Blame information for rev 8

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

Line No. Rev Author Line
1 7 eyalhoc
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////  Author: Eyal Hochberg                                      ////
4
////          eyal@provartec.com                                 ////
5
////                                                             ////
6
////  Downloaded from: http://www.opencores.org                  ////
7
/////////////////////////////////////////////////////////////////////
8
////                                                             ////
9
//// Copyright (C) 2010 Provartec LTD                            ////
10
//// www.provartec.com                                           ////
11
//// info@provartec.com                                          ////
12
////                                                             ////
13
//// This source file may be used and distributed without        ////
14
//// restriction provided that this copyright statement is not   ////
15
//// removed from the file and that any derivative work contains ////
16
//// the original copyright notice and the associated disclaimer.////
17
////                                                             ////
18
//// This source file is free software; you can redistribute it  ////
19
//// and/or modify it under the terms of the GNU Lesser General  ////
20
//// Public License as published by the Free Software Foundation.////
21
////                                                             ////
22
//// This source is distributed in the hope that it will be      ////
23
//// useful, but WITHOUT ANY WARRANTY; without even the implied  ////
24
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR     ////
25
//// PURPOSE.  See the GNU Lesser General Public License for more////
26
//// details. http://www.gnu.org/licenses/lgpl.html              ////
27
////                                                             ////
28
/////////////////////////////////////////////////////////////////////
29 2 eyalhoc
 
30
OUTFILE PREFIX_mem.v
31
 
32
INCLUDE def_ahb_slave.txt
33
 
34
ITER BX EXPR(DATA_BITS/8)
35
module PREFIX_mem (PORTS);
36
 
37
   parameter                    MEM_WORDS = EXPR((2^ADDR_BITS)/(DATA_BITS/8));
38
   parameter                    ADDR_LSB  = LOG2(EXPR(DATA_BITS/8));
39
 
40
   input                        clk;
41
   input                        reset;
42
   revport                      GROUP_STUB_MEM;
43
 
44
   reg [DATA_BITS-1:0]          Mem [MEM_WORDS-1:0];
45
   reg [DATA_BITS-1:0]          DOUT;
46
   wire [DATA_BITS-1:0]         BitSEL;
47
   wire [ADDR_BITS-1:ADDR_LSB]  ADDR_WR_word = ADDR_WR[ADDR_BITS-1:ADDR_LSB];
48
   wire [ADDR_BITS-1:ADDR_LSB]  ADDR_RD_word = ADDR_RD[ADDR_BITS-1:ADDR_LSB];
49
 
50
 
51
   assign                       BitSEL = {CONCAT({8{BSEL[BX]}} ,)};
52
 
53
   always @(posedge clk)
54
     if (WR)
55
       Mem[ADDR_WR_word] <= #FFD (Mem[ADDR_WR_word] & ~BitSEL) | (DIN & BitSEL);
56
 
57
   always @(posedge clk or posedge reset)
58
     if (reset)
59
       DOUT <= #FFD {DATA_BITS{1'b0}};
60
     else if (RD)
61
       DOUT <= #FFD Mem[ADDR_RD_word];
62
 
63
 
64
endmodule

powered by: WebSVN 2.1.0

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