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

Subversion Repositories copyblaze

[/] [copyblaze/] [trunk/] [copyblaze/] [rtl/] [vhdl/] [ip/] [wb_scope/] [bram_dp.vhd] - Blame information for rev 59

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 ameziti
-----------------------------------------------------------------------------
2
-- Dual Port Block Ram (technology independent description)
3
-- (c) 2006 Joerg Bornschein (jb@capsec.org)
4
-- All files under GPLv2
5
-----------------------------------------------------------------------------
6
 
7
library ieee;
8
use ieee.std_logic_1164.ALL;
9
use ieee.numeric_std.all;
10
 
11
entity bram_dp is
12
        generic (
13
                depth    : natural := 4096 );
14
        port (
15
                clk      : in  std_logic;
16
                reset    : in  std_logic;
17
                -- Port 1
18
                we1      : in  std_logic;
19
                addr1    : in  std_logic_vector(11 downto 0);
20
                wdata1   : in  std_logic_vector(31 downto 0);
21
                -- Port 2
22
                oe2      : in  std_logic;
23
                addr2    : in  std_logic_vector(11 downto 0);
24
                rdata2   : out std_logic_vector(31 downto 0) );
25
end bram_dp;
26
 
27
-----------------------------------------------------------------------------
28
-- Implementation -----------------------------------------------------------
29
architecture rtl of bram_dp is
30
 
31
type mem_type is array(0 to depth-1) of std_logic_vector(31 downto 0);
32
signal mem : mem_type := (others => x"00000000" );
33
 
34
begin
35
 
36
memproc: process (clk) is
37
variable a1 : integer;
38
variable a2 : integer;
39
begin
40
        if reset='1' then
41
                null;
42
        elsif clk'event and clk='1' then
43
                if we1='1' then                     -- Port 1
44
                        a1 := to_integer(unsigned(addr1));
45
                        mem(a1) <= wdata1;
46
                end if;
47
 
48
                if oe2='1' then                     -- Port 2
49
                        a2 := to_integer(unsigned(addr2));
50
                        rdata2 <= mem(a2);
51
                end if;
52
        end if;
53
end process;
54
 
55
end rtl;
56
 

powered by: WebSVN 2.1.0

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