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 |
|
|
-- Package: actel_components
|
20 |
|
|
-- File: actel_components.vhd
|
21 |
|
|
-- Author: Jiri Gaisler, Gaisler Research
|
22 |
|
|
-- Description: Actel RAM and pad component declarations
|
23 |
|
|
-----------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library ieee;
|
26 |
|
|
use ieee.std_logic_1164.all;
|
27 |
|
|
|
28 |
|
|
package actel_components is
|
29 |
|
|
|
30 |
|
|
-- Proasic & Proasicplus rams
|
31 |
|
|
|
32 |
|
|
component RAM256x9SST port(
|
33 |
|
|
DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_logic;
|
34 |
|
|
WPE, RPE, DOS : out std_logic;
|
35 |
|
|
WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_logic;
|
36 |
|
|
RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_logic;
|
37 |
|
|
WCLKS, RCLKS : in std_logic;
|
38 |
|
|
DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_logic;
|
39 |
|
|
WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_logic);
|
40 |
|
|
end component;
|
41 |
|
|
|
42 |
|
|
end;
|
43 |
|
|
|
44 |
|
|
library ieee;
|
45 |
|
|
use ieee.std_logic_1164.all;
|
46 |
|
|
use ieee.numeric_std.all;
|
47 |
|
|
|
48 |
|
|
entity RAM256x9SST is
|
49 |
|
|
port(
|
50 |
|
|
DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_ulogic;
|
51 |
|
|
WPE, RPE, DOS : out std_ulogic;
|
52 |
|
|
WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_ulogic;
|
53 |
|
|
RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_ulogic;
|
54 |
|
|
WCLKS, RCLKS : in std_ulogic;
|
55 |
|
|
DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_ulogic;
|
56 |
|
|
WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_ulogic);
|
57 |
|
|
end;
|
58 |
|
|
|
59 |
|
|
architecture rtl of RAM256x9SST is
|
60 |
|
|
signal d, q : std_logic_vector(8 downto 0);
|
61 |
|
|
signal wa, ra : std_logic_vector(7 downto 0);
|
62 |
|
|
signal wen, ren : std_ulogic;
|
63 |
|
|
type dregtype is array (0 to 2**8 - 1)
|
64 |
|
|
of std_logic_vector(8 downto 0);
|
65 |
|
|
|
66 |
|
|
begin
|
67 |
|
|
wen <= not (WBLKB or WRB); ren <= not (RBLKB or RDB);
|
68 |
|
|
wa <= WADDR7 & WADDR6 & WADDR5 & WADDR4 & WADDR3 & WADDR2 & WADDR1 & WADDR0;
|
69 |
|
|
ra <= RADDR7 & RADDR6 & RADDR5 & RADDR4 & RADDR3 & RADDR2 & RADDR1 & RADDR0;
|
70 |
|
|
d <= DI8 & DI7 & DI6 & DI5 & DI4 & DI3 & DI2 & DI1 & DI0;
|
71 |
|
|
|
72 |
|
|
rp : process(WCLKS, RCLKS)
|
73 |
|
|
variable rfd : dregtype;
|
74 |
|
|
begin
|
75 |
|
|
if rising_edge(RCLKS) then
|
76 |
|
|
if (ren = '1') and not is_x(ra) then
|
77 |
|
|
q <= rfd(to_integer(unsigned(ra)));
|
78 |
|
|
end if;
|
79 |
|
|
end if;
|
80 |
|
|
if rising_edge(WCLKS) then
|
81 |
|
|
if (wen = '1') and not is_x(wa) then
|
82 |
|
|
rfd(to_integer(unsigned(wa))) := d;
|
83 |
|
|
end if;
|
84 |
|
|
end if;
|
85 |
|
|
end process;
|
86 |
|
|
|
87 |
|
|
DO8 <= q(8); DO7 <= q(7); DO6 <= q(6); DO5 <= q(5); DO4 <= q(4);
|
88 |
|
|
DO3 <= q(3); DO2 <= q(2); DO1 <= q(1); DO0 <= q(0);
|
89 |
|
|
|
90 |
|
|
end;
|