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

Subversion Repositories usimplez

[/] [usimplez/] [trunk/] [QuartusII/] [usimplez_ram.vhd.bak] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 pas.
--//////////////////////////////////////////////////////////////////////
2
--////                                                                                                                          ////
3
--////                                                                                                                          ////
4
--////                                                                                                                          ////
5
--//// This file is part of the MicroSimplez project                            ////
6
--//// http://opencores.org/project,usimplez                                            ////
7
--////                                                                                                                          ////
8
--//// Description                                                                                                      ////
9
--//// Implementation of MicroSimplez IP core according to                      ////
10
--//// MicroSimplez IP core specification document.                             ////
11
--////                                                                                                                          ////
12
--//// To Do:                                                                                                           ////
13
--//// -                                                                                                                        ////
14
--////                                                                                                                          ////
15
--//// Author(s):                                                                                                       ////
16
--//// - Daniel Peralta, peraltahd@opencores.org, designer                      ////
17
--//// - Martin Montero, monteromrtn@opencores.org, designer            ////
18
--//// - Julian Castro, julyan@opencores.org, reviewer                          ////
19
--//// - Pablo A. Salvadeo,     pas.@opencores, manager                                 ////
20
--////                                                                                                                          ////
21
--//////////////////////////////////////////////////////////////////////
22
--////                                                                                                                          ////
23
--//// Copyright (C) 2011 Authors and OPENCORES.ORG                             ////
24
--////                                                                                                                          ////
25
--//// This source file may be used and distributed without             ////
26
--//// restriction provided that this copyright statement is not        ////
27
--//// removed from the file and that any derivative work contains      ////
28
--//// the original copyright notice and the associated disclaimer.     ////
29
--////                                                                                                                          ////
30
--//// This source file is free software; you can redistribute it       ////
31
--//// and/or modify it under the terms of the GNU Lesser General       ////
32
--//// Public License as published by the Free Software Foundation;     ////
33
--//// either version 2.1 of the License, or (at your option) any       ////
34
--//// later version.                                                                                           ////
35
--////                                                                                                                          ////
36
--//// This source is distributed in the hope that it will be           ////
37
--//// useful, but WITHOUT ANY WARRANTY; without even the implied       ////
38
--//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR          ////
39
--//// PURPOSE. See the GNU Lesser General Public License for more      ////
40
--//// details.                                                                                                         ////
41
--////                                                                                                                          ////
42
--//// You should have received WIDTH_ADDRESS copy of the GNU Lesser General    ////
43
--//// Public License along with this source; if not, download it       ////
44
--//// from http://www.opencores.org/lgpl.shtml                                         ////
45
--////                                                                                                                          ////
46
--//////////////////////////////////////////////////////////////////////
47
 
48
library ieee;
49
use ieee.std_logic_1164.all;
50
use ieee.std_logic_unsigned.all;
51
use ieee.numeric_std.all;
52
 
53
entity usimplez_ram is
54
 
55
generic( WIDTH_WORD: natural:= 12;
56
                 WIDTH_ADDRESS: natural:= 9
57
           );
58
 
59
        port
60
        (
61
                clk_i   : in std_logic;
62
                addr_i  : in unsigned((WIDTH_ADDRESS-1) downto 0);
63
                data_i  : in std_logic_vector((WIDTH_WORD-1) downto 0);
64
                we_i    : in std_logic ;
65
                data_o  : out std_logic_vector((WIDTH_WORD-1) downto 0)
66
        );
67
 
68
end usimplez_ram;
69
 
70
architecture rtl of usimplez_ram is
71
 
72
        subtype word_t is std_logic_vector((WIDTH_WORD-1) downto 0);
73
        type memory_t is array(2**WIDTH_ADDRESS-1 downto 0) of word_t;
74
 
75
        signal ram : memory_t;
76
        attribute ram_init_file : string;
77
--      attribute ram_init_file of ram : signal is "sumador.mif"; --code sumador.txt
78
        attribute ram_init_file of ram : signal is "fibonacci.mif"; --code fibonacci.txt
79
 
80
        signal addr_reg_s : unsigned((WIDTH_ADDRESS-1) downto 0);
81
 
82
begin
83
 
84
        process(clk_i)
85
        begin
86
        if(falling_edge(clk_i)) then
87
                if(we_i = '1') then
88
                        ram(to_integer(addr_i)) <= data_i;
89
                end if;
90
 
91
        addr_reg_s <= addr_i;
92
        end if;
93
        end process;
94
 
95
        data_o <= ram(to_integer(addr_reg_s));
96
 
97
end rtl;

powered by: WebSVN 2.1.0

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