1 |
95 |
oharboe |
-- ZPU
|
2 |
|
|
--
|
3 |
|
|
-- Copyright 2004-2009 oharboe - Oyvind Harboe - oyvind.harboe@zylin.com
|
4 |
|
|
--
|
5 |
|
|
-- The FreeBSD license
|
6 |
|
|
--
|
7 |
|
|
-- Redistribution and use in source and binary forms, with or without
|
8 |
|
|
-- modification, are permitted provided that the following conditions
|
9 |
|
|
-- are met:
|
10 |
|
|
--
|
11 |
|
|
-- 1. Redistributions of source code must retain the above copyright
|
12 |
|
|
-- notice, this list of conditions and the following disclaimer.
|
13 |
|
|
-- 2. Redistributions in binary form must reproduce the above
|
14 |
|
|
-- copyright notice, this list of conditions and the following
|
15 |
|
|
-- disclaimer in the documentation and/or other materials
|
16 |
|
|
-- provided with the distribution.
|
17 |
|
|
--
|
18 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE ZPU PROJECT ``AS IS'' AND ANY
|
19 |
|
|
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
20 |
|
|
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
21 |
|
|
-- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
22 |
|
|
-- ZPU PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23 |
|
|
-- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
24 |
|
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
25 |
|
|
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
26 |
|
|
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
27 |
|
|
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
28 |
|
|
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
29 |
|
|
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30 |
|
|
--
|
31 |
|
|
-- The views and conclusions contained in the software and documentation
|
32 |
|
|
-- are those of the authors and should not be interpreted as representing
|
33 |
|
|
-- official policies, either expressed or implied, of the ZPU Project.
|
34 |
|
|
|
35 |
|
|
library ieee;
|
36 |
|
|
use ieee.std_logic_1164.all;
|
37 |
|
|
use ieee.numeric_std.all;
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
library work;
|
41 |
|
|
use work.zpu_config.all;
|
42 |
|
|
use work.zpupkg.all;
|
43 |
|
|
|
44 |
|
|
entity dualport_ram is
|
45 |
|
|
port (clk : in std_logic;
|
46 |
|
|
memAWriteEnable : in std_logic;
|
47 |
|
|
memAAddr : in std_logic_vector(maxAddrBitBRAM downto minAddrBit);
|
48 |
|
|
memAWrite : in std_logic_vector(wordSize-1 downto 0);
|
49 |
|
|
memARead : out std_logic_vector(wordSize-1 downto 0);
|
50 |
|
|
memBWriteEnable : in std_logic;
|
51 |
|
|
memBAddr : in std_logic_vector(maxAddrBitBRAM downto minAddrBit);
|
52 |
|
|
memBWrite : in std_logic_vector(wordSize-1 downto 0);
|
53 |
|
|
memBRead : out std_logic_vector(wordSize-1 downto 0));
|
54 |
|
|
end dualport_ram;
|
55 |
|
|
|
56 |
|
|
architecture dualport_ram_arch of dualport_ram is
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
type ram_type is array(natural range 0 to ((2**(maxAddrBitBRAM+1))/4)-1) of std_logic_vector(wordSize-1 downto 0);
|
60 |
|
|
|
61 |
|
|
shared variable ram : ram_type :=
|
62 |
|
|
(
|