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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [components/] [BRAM/] [generic_ram.vhdl] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 lcdsgmtr
LIBRARY ieee;
2
USE ieee.std_logic_1164.ALL;
3
USE ieee.numeric_std.ALL;
4
USE work.hexio.ALL;
5
 
6
ENTITY RAM_GENERIC IS
7
 
8
  -- Memory component based upon Xilinx Spartan-6 block RAM
9
  -- Maximum capacity is 16k words
10
  -- This component can be initialised by passing a file name as a generic
11
  -- parameter.
12
 
13
  GENERIC (
14
    filename : STRING                := "";
15
    w_data   : NATURAL RANGE 1 TO 32 := 16;
16
    w_addr   : NATURAL RANGE 8 TO 14 := 10);
17
  PORT (
18
    clk : IN  STD_LOGIC;
19
    we  : IN  STD_LOGIC;
20
    a1  : IN  STD_LOGIC_VECTOR(w_addr - 1 DOWNTO 0);  -- Data port address
21
    a2  : IN  STD_LOGIC_VECTOR(w_addr - 1 DOWNTO 0);  -- Instruction port address
22
    d1  : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);  -- Data port input
23
    q1  : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);  -- Data port output
24
    q2  : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));  -- Instruction port output
25
 
26
END RAM_GENERIC;
27
 
28
ARCHITECTURE Behavioral OF RAM_GENERIC IS
29
 
30
  COMPONENT generic_memory_block IS
31
 
32
    -- Memory component based upon Xilinx Spartan-6 block RAM
33
    -- Maximum capacity is 16k words
34
    -- This component can be initialised by passing a file name as a generic
35
    -- parameter.
36
 
37
    GENERIC (
38
      init_data : cstr_array_type;
39
      w_data    : NATURAL RANGE 1 TO 32 := 16;
40
      w_addr    : NATURAL RANGE 8 TO 14 := 10);
41
    PORT (
42
      clk : IN  STD_LOGIC;
43
      we  : IN  STD_LOGIC;
44
      a1  : IN  STD_LOGIC_VECTOR(w_addr - 1 DOWNTO 0);  -- Data port address
45
      a2  : IN  STD_LOGIC_VECTOR(w_addr - 1 DOWNTO 0);  -- Instruction port address
46
      d1  : IN  STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);  -- Data port input
47
      q1  : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0);  -- Data port output
48
      q2  : OUT STD_LOGIC_VECTOR(w_data - 1 DOWNTO 0));  -- Instruction port output
49
 
50
  END COMPONENT generic_memory_block;
51
 
52
BEGIN  -- Behavioral
53
 
54
  MEM1 : generic_memory_block
55
    GENERIC MAP (
56
      init_data => init_cstr(2**w_addr, filename),
57
      w_data    => w_data,
58
      w_addr    => w_addr)
59
    PORT MAP (
60
      clk => clk,
61
      we  => we,
62
      a1  => a1,
63
      a2  => a2,
64
      d1  => d1,
65
      q1  => q1,
66
      q2  => q2);
67
 
68
END Behavioral;

powered by: WebSVN 2.1.0

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