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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [lib/] [techmap/] [apa/] [memory_apa.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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_apa_gen.vhd
21
-- Author:      Jiri Gaisler Gaisler Research
22
-- Description: Memory generators for Actel Proasic rams
23
------------------------------------------------------------------------------
24
 
25
library ieee;
26
use ieee.std_logic_1164.all;
27
library grlib;
28
use grlib.stdlib.all;
29
-- pragma translate_off
30
library apa;
31
use apa.RAM256x9SST;
32
-- pragma translate_on
33
 
34
entity proasic_syncram_2p is
35
  generic ( abits : integer := 8; dbits : integer := 32);
36
  port (
37
    rclk  : in std_ulogic;
38
    rena  : in std_ulogic;
39
    raddr : in std_logic_vector (abits -1 downto 0);
40
    dout  : out std_logic_vector (dbits -1 downto 0);
41
    wclk  : in std_ulogic;
42
    waddr : in std_logic_vector (abits -1 downto 0);
43
    din   : in std_logic_vector (dbits -1 downto 0);
44
    write : in std_ulogic);
45
end;
46
 
47
architecture rtl of proasic_syncram_2p is
48
  component RAM256x9SST port(
49
    DO8, DO7, DO6, DO5, DO4, DO3, DO2, DO1, DO0 : out std_logic;
50
    WPE, RPE, DOS : out std_logic;
51
    WADDR7, WADDR6, WADDR5, WADDR4, WADDR3, WADDR2, WADDR1, WADDR0 : in std_logic;
52
    RADDR7, RADDR6, RADDR5, RADDR4, RADDR3, RADDR2, RADDR1, RADDR0 : in std_logic;
53
    WCLKS, RCLKS : in std_logic;
54
    DI8, DI7, DI6, DI5, DI4, DI3, DI2, DI1, DI0 : in std_logic;
55
    WRB, RDB, WBLKB, RBLKB, PARODD, DIS : in std_logic);
56
  end component;
57
 
58
  type powarr is array (1 to 19) of integer;
59
  constant ntbl : powarr := (1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 8, 16, 32, others => 64);
60
  constant dw : integer := dbits + 8;
61
  subtype dword is std_logic_vector(dw downto 0);
62
  type qarr is array (0 to 63) of dword;
63
  signal gnd, wen, ren : std_ulogic;
64
  signal q : qarr;
65
  signal d : dword;
66
  signal rra : std_logic_vector (20 downto 0);
67
  signal ra, wa : std_logic_vector (63 downto 0);
68
  signal wenv : std_logic_vector (63 downto 0);
69
  signal renv : std_logic_vector (63 downto 0);
70
begin
71
  gnd <= '0';
72
  wa(63 downto abits) <= (others => '0'); wa(abits-1 downto 0) <= waddr;
73
  ra(63 downto abits) <= (others => '0'); ra(abits-1 downto 0) <= raddr;
74
  d(dw downto dbits)  <= (others => '0'); d(dbits-1 downto 0)  <= din;
75
  wen <= not write; ren <= not rena;
76
 
77
  x0 : if abits < 15 generate
78
    b0 : for j in 0 to ntbl(abits)-1 generate
79
      g0 : for i in 0 to (dbits-1)/9 generate
80
        u0 : RAM256x9SST port map (
81
          DO0 => q(j)(i*9+0), DO1 => q(j)(i*9+1), DO2 => q(j)(i*9+2),
82
          DO3 => q(j)(i*9+3), DO4 => q(j)(i*9+4), DO5 => q(j)(i*9+5),
83
          DO6 => q(j)(i*9+6), DO7 => q(j)(i*9+7), DO8 => q(j)(i*9+8),
84
          DOS => open, RPE => open, WPE => open,
85
          WADDR0 => wa(0), WADDR1 => wa(1), WADDR2 => wa(2),
86
          WADDR3 => wa(3), WADDR4 => wa(4), WADDR5 => wa(5),
87
          WADDR6 => wa(6), WADDR7 => wa(7),
88
          RADDR0 => ra(0), RADDR1 => ra(1), RADDR2 => ra(2),
89
          RADDR3 => ra(3), RADDR4 => ra(4), RADDR5 => ra(5),
90
          RADDR6 => ra(6), RADDR7 => ra(7),
91
          WCLKS => wclk, RCLKS => rclk,
92
          DI0 => d(i*9+0), DI1 => d(i*9+1), DI2 => d(i*9+2),
93
          DI3 => d(i*9+3), DI4 => d(i*9+4), DI5 => d(i*9+5),
94
          DI6 => d(i*9+6), DI7 => d(i*9+7), DI8 => d(i*9+8),
95
          RDB => ren, WRB => wen, RBLKB => renv(j), WBLKB => wenv(j),
96
          PARODD => gnd, DIS => gnd
97
        );
98
      end generate;
99
    end generate;
100
 
101
    rra(20 downto abits) <= (others => '0');
102
    reg : process(rclk)
103
    begin
104
      if rising_edge(rclk) then
105
        rra(abits-1 downto 0) <= raddr(abits-1 downto 0);
106
        rra(7 downto 0) <= (others => '0');
107
      end if;
108
    end process;
109
 
110
    ctrl : process(write, waddr, q, rra, rena, raddr)
111
    variable we,z,re : std_logic_vector(63 downto 0);
112
    variable wea,rea : std_logic_vector(63 downto 0);
113
    begin
114
      we := (others => '0'); z := (others => '0'); re := (others => '0');
115
      wea := (others => '0'); rea := (others => '0');
116
      wea(abits-1 downto 0) := waddr(abits-1 downto 0); wea(7 downto 0) := (others => '0');
117
      rea(abits-1 downto 0) := raddr(abits-1 downto 0); wea(7 downto 0) := (others => '0');
118
      z(dbits-1 downto 0) :=
119
                q(conv_integer(rra(19 downto 8)))(dbits-1 downto 0);
120
      we (conv_integer(wea(19 downto 8))) := write;
121
      re (conv_integer(rea(19 downto 8))) := rena;
122
      wenv <= not we; renv <= not re; dout <= z(dbits-1 downto 0);
123
    end process;
124
 
125
  end generate;
126
 
127
-- pragma translate_off  
128
  unsup : if abits > 14 generate
129
    x : process
130
    begin
131
      assert false
132
      report  "Address depth larger than 14 not supported for ProAsic rams"
133
      severity failure;
134
      wait;
135
    end process;
136
  end generate;
137
-- pragma translate_on
138
 
139
end;
140
 
141
library ieee;
142
use ieee.std_logic_1164.all;
143
 
144
entity proasic_syncram is
145
  generic ( abits : integer := 10; dbits : integer := 8 );
146
  port (
147
    clk      : in std_ulogic;
148
    address  : in std_logic_vector((abits -1) downto 0);
149
    datain   : in std_logic_vector((dbits -1) downto 0);
150
    dataout  : out std_logic_vector((dbits -1) downto 0);
151
    enable   : in std_ulogic;
152
    write    : in std_ulogic
153
   );
154
end;
155
 
156
architecture rtl of proasic_syncram is
157
component proasic_syncram_2p
158
  generic ( abits : integer := 8; dbits : integer := 32);
159
  port (
160
    rclk  : in std_ulogic;
161
    rena  : in std_ulogic;
162
    raddr : in std_logic_vector (abits -1 downto 0);
163
    dout  : out std_logic_vector (dbits -1 downto 0);
164
    wclk  : in std_ulogic;
165
    waddr : in std_logic_vector (abits -1 downto 0);
166
    din   : in std_logic_vector (dbits -1 downto 0);
167
    write : in std_ulogic);
168
end component;
169
 
170
 
171
begin
172
  u0 : proasic_syncram_2p generic map (abits, dbits)
173
       port map (clk, enable, address, dataout, clk, address, datain, write);
174
end;

powered by: WebSVN 2.1.0

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