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

Subversion Repositories heap_sorter

[/] [heap_sorter/] [trunk/] [standard_version/] [src/] [dpram_inf.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wzab
-- A parameterized, inferable, true dual-port, common-clock block RAM in VHDL.
2
-- Original file was taken from: http://danstrother.com/2010/09/11/inferring-rams-in-fpgas/
3
-- No license information were provided by the original author.
4
-- Minimal modifications were introduced by me to make it suitable for my sorter.
5
 
6
library ieee;
7
use ieee.std_logic_1164.all;
8
use ieee.std_logic_unsigned.all;
9
 
10
entity dp_ram_scl is
11
  generic (
12
    DATA_WIDTH : integer := 72;
13
    ADDR_WIDTH : integer := 10
14
    );
15
  port (
16
-- common clock
17
    clk    : in  std_logic;
18
    -- Port A
19
    we_a   : in  std_logic;
20
    addr_a : in  std_logic_vector(ADDR_WIDTH-1 downto 0);
21
    data_a : in  std_logic_vector(DATA_WIDTH-1 downto 0);
22
    q_a    : out std_logic_vector(DATA_WIDTH-1 downto 0);
23
 
24
    -- Port B
25
    we_b   : in  std_logic;
26
    addr_b : in  std_logic_vector(ADDR_WIDTH-1 downto 0);
27
    data_b : in  std_logic_vector(DATA_WIDTH-1 downto 0);
28
    q_b    : out std_logic_vector(DATA_WIDTH-1 downto 0)
29
    );
30
end dp_ram_scl;
31
 
32
architecture rtl of dp_ram_scl is
33
  -- Shared memory
34
  type mem_type is array ((2**ADDR_WIDTH)-1 downto 0) of std_logic_vector(DATA_WIDTH-1 downto 0);
35
  shared variable mem : mem_type;
36
begin
37
 
38
-- Port A
39
  process(clk)
40
  begin
41
    if(clk'event and clk = '1') then
42
      if(we_a = '1') then
43
        mem(conv_integer(addr_a)) := data_a;
44
      end if;
45
      q_a <= mem(conv_integer(addr_a));
46
    end if;
47
  end process;
48
 
49
-- Port B
50
  process(clk)
51
  begin
52
    if(clk'event and clk = '1') then
53
      if(we_b = '1') then
54
        mem(conv_integer(addr_b)) := data_b;
55
      end if;
56
      q_b <= mem(conv_integer(addr_b));
57
    end if;
58
  end process;
59
 
60
end rtl;

powered by: WebSVN 2.1.0

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