1 |
2 |
dimamali |
------------------------------------------------------------------------------
|
2 |
|
|
-- This file is a part of the GRLIB VHDL IP LIBRARY
|
3 |
|
|
-- Copyright (C) 2003, Gaisler Research
|
4 |
|
|
--
|
5 |
|
|
-- This program is free software; you can redistribute it and/or modify
|
6 |
|
|
-- it under the terms of the GNU General Public License as published by
|
7 |
|
|
-- the Free Software Foundation; either version 2 of the License, or
|
8 |
|
|
-- (at your option) any later version.
|
9 |
|
|
--
|
10 |
|
|
-- This program is distributed in the hope that it will be useful,
|
11 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
|
|
-- GNU General Public License for more details.
|
14 |
|
|
--
|
15 |
|
|
-- You should have received a copy of the GNU General Public License
|
16 |
|
|
-- along with this program; if not, write to the Free Software
|
17 |
|
|
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
18 |
|
|
-----------------------------------------------------------------------------
|
19 |
|
|
-- Entity: various
|
20 |
|
|
-- File: mem_altera_gen.vhd
|
21 |
|
|
-- Author: Jiri Gaisler - Gaisler Research
|
22 |
|
|
-- Description: Memory generators for Altera altsynram
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
library ieee;
|
27 |
|
|
use ieee.std_logic_1164.all;
|
28 |
|
|
-- pragma translate_off
|
29 |
|
|
library altera_mf;
|
30 |
|
|
use altera_mf.altsyncram;
|
31 |
|
|
-- pragma translate_on
|
32 |
|
|
|
33 |
|
|
entity altera_syncram_dp is
|
34 |
|
|
generic (
|
35 |
|
|
abits : integer := 4; dbits : integer := 32
|
36 |
|
|
);
|
37 |
|
|
port (
|
38 |
|
|
clk1 : in std_ulogic;
|
39 |
|
|
address1 : in std_logic_vector((abits -1) downto 0);
|
40 |
|
|
datain1 : in std_logic_vector((dbits -1) downto 0);
|
41 |
|
|
dataout1 : out std_logic_vector((dbits -1) downto 0);
|
42 |
|
|
enable1 : in std_ulogic;
|
43 |
|
|
write1 : in std_ulogic;
|
44 |
|
|
clk2 : in std_ulogic;
|
45 |
|
|
address2 : in std_logic_vector((abits -1) downto 0);
|
46 |
|
|
datain2 : in std_logic_vector((dbits -1) downto 0);
|
47 |
|
|
dataout2 : out std_logic_vector((dbits -1) downto 0);
|
48 |
|
|
enable2 : in std_ulogic;
|
49 |
|
|
write2 : in std_ulogic);
|
50 |
|
|
end;
|
51 |
|
|
|
52 |
|
|
architecture behav of altera_syncram_dp is
|
53 |
|
|
|
54 |
|
|
component altsyncram
|
55 |
|
|
generic (
|
56 |
|
|
width_a : natural;
|
57 |
|
|
width_b : natural := 1;
|
58 |
|
|
widthad_a : natural;
|
59 |
|
|
widthad_b : natural := 1);
|
60 |
|
|
port(
|
61 |
|
|
address_a : in std_logic_vector(widthad_a-1 downto 0);
|
62 |
|
|
address_b : in std_logic_vector(widthad_b-1 downto 0);
|
63 |
|
|
clock0 : in std_logic;
|
64 |
|
|
clock1 : in std_logic;
|
65 |
|
|
data_a : in std_logic_vector(width_a-1 downto 0);
|
66 |
|
|
data_b : in std_logic_vector(width_b-1 downto 0);
|
67 |
|
|
q_a : out std_logic_vector(width_a-1 downto 0);
|
68 |
|
|
q_b : out std_logic_vector(width_b-1 downto 0);
|
69 |
|
|
rden_b : in std_logic;
|
70 |
|
|
wren_a : in std_logic;
|
71 |
|
|
wren_b : in std_logic
|
72 |
|
|
);
|
73 |
|
|
end component;
|
74 |
|
|
|
75 |
|
|
begin
|
76 |
|
|
|
77 |
|
|
u0 : altsyncram
|
78 |
|
|
generic map (
|
79 |
|
|
WIDTH_A => dbits, WIDTHAD_A => abits,
|
80 |
|
|
WIDTH_B => dbits, WIDTHAD_B => abits)
|
81 |
|
|
port map (
|
82 |
|
|
address_a => address1, address_b => address2, clock0 => clk1,
|
83 |
|
|
clock1 => clk2, data_a => datain1, data_b => datain2,
|
84 |
|
|
q_a => dataout1, q_b => dataout2, rden_b => enable2,
|
85 |
|
|
wren_a => write1, wren_b => write2);
|
86 |
|
|
end;
|
87 |
|
|
|
88 |
|
|
library ieee;
|
89 |
|
|
use ieee.std_logic_1164.all;
|
90 |
|
|
library techmap;
|
91 |
|
|
|
92 |
|
|
entity altera_syncram is
|
93 |
|
|
generic ( abits : integer := 9; dbits : integer := 32);
|
94 |
|
|
port (
|
95 |
|
|
clk : in std_ulogic;
|
96 |
|
|
address : in std_logic_vector (abits -1 downto 0);
|
97 |
|
|
datain : in std_logic_vector (dbits -1 downto 0);
|
98 |
|
|
dataout : out std_logic_vector (dbits -1 downto 0);
|
99 |
|
|
enable : in std_ulogic;
|
100 |
|
|
write : in std_ulogic
|
101 |
|
|
);
|
102 |
|
|
end;
|
103 |
|
|
|
104 |
|
|
architecture behav of altera_syncram is
|
105 |
|
|
component altera_syncram_dp
|
106 |
|
|
generic ( abits : integer := 10; dbits : integer := 8 );
|
107 |
|
|
port (
|
108 |
|
|
clk1 : in std_ulogic;
|
109 |
|
|
address1 : in std_logic_vector((abits -1) downto 0);
|
110 |
|
|
datain1 : in std_logic_vector((dbits -1) downto 0);
|
111 |
|
|
dataout1 : out std_logic_vector((dbits -1) downto 0);
|
112 |
|
|
enable1 : in std_ulogic;
|
113 |
|
|
write1 : in std_ulogic;
|
114 |
|
|
clk2 : in std_ulogic;
|
115 |
|
|
address2 : in std_logic_vector((abits -1) downto 0);
|
116 |
|
|
datain2 : in std_logic_vector((dbits -1) downto 0);
|
117 |
|
|
dataout2 : out std_logic_vector((dbits -1) downto 0);
|
118 |
|
|
enable2 : in std_ulogic;
|
119 |
|
|
write2 : in std_ulogic
|
120 |
|
|
);
|
121 |
|
|
end component;
|
122 |
|
|
|
123 |
|
|
signal agnd : std_logic_vector(abits-1 downto 0);
|
124 |
|
|
signal dgnd : std_logic_vector(dbits-1 downto 0);
|
125 |
|
|
begin
|
126 |
|
|
|
127 |
|
|
agnd <= (others => '0'); dgnd <= (others => '0');
|
128 |
|
|
|
129 |
|
|
u0: altera_syncram_dp
|
130 |
|
|
generic map (abits, dbits)
|
131 |
|
|
port map (
|
132 |
|
|
clk1 => clk, address1 => address, datain1 => datain,
|
133 |
|
|
dataout1 => dataout, enable1 => enable, write1 => write,
|
134 |
|
|
clk2 => clk, address2 => agnd, datain2 => dgnd,
|
135 |
|
|
dataout2 => open, enable2 => agnd(0), write2 => agnd(0));
|
136 |
|
|
end;
|