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

Subversion Repositories openverifla

[/] [openverifla/] [trunk/] [openverifla_2.4/] [vhdl/] [verifla/] [memory_of_verifla.vhd] - Blame information for rev 46

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 46 laurentiud
-- Author: Laurentiu Duca
2
-- License: GNU GPL
3
-----------------------------------------------------
4
 
5
library IEEE;
6
use IEEE.STD_LOGIC_1164.ALL;
7
use IEEE.NUMERIC_STD.ALL;
8
--use ieee.std_logic_arith.all;  
9
use ieee.std_logic_unsigned.all;
10
use work.common_internal_verifla.all;
11
 
12
-----------------------------------------------------
13
 
14
entity memory_of_verifla is port(
15
  clk, rst_l: in std_logic;
16
  addra: in std_logic_vector(LA_MEM_ADDRESS_BITS-1 downto 0);
17
  wea: in std_logic;
18
  dina: in std_logic_vector(LA_MEM_WORDLEN_BITS-1 downto 0);
19
  addrb: in std_logic_vector(LA_MEM_ADDRESS_BITS-1 downto 0);
20
  doutb: out std_logic_vector(LA_MEM_WORDLEN_BITS-1 downto 0)
21
);
22
end memory_of_verifla;
23
-----------------------------------------------------
24
 
25
architecture memory_of_verifla_arch of memory_of_verifla is
26
 
27
type reg_array is array (0 to LA_MEM_LAST_ADDR) of std_logic_vector(LA_MEM_WORDLEN_BITS-1 downto 0);
28
 
29
impure function init_mem(n: in integer) return reg_array is
30
    variable temp_mem : reg_array;
31
begin
32
    for i in reg_array'range loop
33
        temp_mem(i) := LA_MEM_EMPTY_SLOT; --std_logic_vector(to_unsigned(0, LA_MEM_WORDLEN_BITS));
34
    end loop;
35
    return temp_mem;
36
end function;
37
 
38
signal mem: reg_array := init_mem(0);
39
 
40
begin
41
        -- doutb <= mem(to_integer(unsigned(addrb)));
42
   -- This works too as a consequence of send_capture_of_verifla architecture.
43
        p0: process(clk, rst_l)
44
        begin
45
                if(rst_l = '0') then
46
                        doutb <= LA_MEM_EMPTY_SLOT;
47
                elsif(rising_edge(clk)) then
48
                        doutb <= mem(to_integer(unsigned(addrb)));
49
                end if;
50
        end process;
51
 
52
        p1: process(clk)
53
        begin
54
                if(rising_edge(clk)) then
55
                        if(wea = '1') then
56
                                mem(to_integer(unsigned(addra))) <= dina;
57
                        end if;
58
                end if;
59
        end process;
60
 
61
end memory_of_verifla_arch;

powered by: WebSVN 2.1.0

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