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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [tags/] [beta/] [dpm.vhd] - Blame information for rev 62

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rherveille
--
2
-- File dpm.vhd (dual ported memory)
3
-- Author : Richard Herveille
4
-- rev. 0.1 May 17th, 2001 : Initial release
5
-- 
6
--       fifo_dc uses this entity to implement the dual ported RAM of the fifo.
7
--       Change this file to implement target specific RAM blocks.
8
--
9
-- rev.
10
 
11
 
12
--
13
-- dual ported memory, wrapper for target specific RAM blocks
14
--
15
 
16
library ieee;
17
use ieee.std_logic_1164.all;
18
use ieee.std_logic_arith.all;
19
 
20
entity dual_ported_memory is
21
        generic(
22
                AWIDTH : natural := 8;
23
                DWIDTH : natural := 24
24
        );
25
        port(
26
                rclk : in std_logic;                          -- read clock input
27
                wclk : in std_logic;                          -- write clock input
28
 
29
                D : in std_logic_vector(DWIDTH -1 downto 0);  -- Data input
30
                waddr : in unsigned(AWIDTH -1 downto 0);      -- write clock address input
31
                wreq : in std_logic;                          -- write request
32
 
33
                Q : out std_logic_vector(DWIDTH -1 downto 0); -- Data output
34
                raddr : in unsigned(AWIDTH -1 downto 0);      -- read clock address input
35
                rreq : in std_logic                           -- read request
36
        );
37
end entity dual_ported_memory;
38
 
39
architecture structural of dual_ported_memory is
40
        -- example target specific RAM block, 256entries x 24bit
41
        component VSR256X24M2 is
42
        port(
43
                RCK    : in  std_logic;                       -- read clock
44
                REN    : in  std_logic;                       -- read enable, active low
45
                RADR   : in  std_logic_vector(7 downto 0);    -- read address
46
 
47
                WCK    : in  std_logic;                       -- write clock
48
                WEN    : in  std_logic;                       -- write enable, active low
49
                WADR   : in  std_logic_vector(7 downto 0);    -- write address
50
 
51
                DI     : in  std_logic_vector(23 downto 0);   -- data input, (synchronous to write clock)
52
                DOUT   : out std_logic_vector(23 downto 0)    -- data output (asynchronous)
53
        );
54
        end component VSR256X24M2;
55
        signal nrreq, nwreq : std_logic;
56
 
57
        -- generate memory for generic description
58
        type mem_type is array (2**AWIDTH -1 downto 0) of std_logic_vector(DWIDTH -1 downto 0);
59
        signal mem : mem_type;
60
        signal dout : std_logic_vector(23 downto 0);
61
 
62
begin
63
        --
64
        -- Change the next section(s) for target specific RAM blocks.
65
        -- The functionality as described below must be maintained! Some target specific RAM blocks have an asychronous output. 
66
        -- Insert flip-flops at the output in this case (see below)
67
 
68
        --
69
        -- generic dual ported memory description
70
        --
71
        write_mem: process(wclk)
72
        begin
73
                if (wclk'event and wclk = '1') then
74
                        if (wreq = '1') then
75
                                mem(conv_integer(waddr)) <= D; -- store D in memory array
76
                        end if;
77
                end if;
78
        end process write_mem;
79
 
80
        read_mem: process(rclk)
81
        begin
82
                if (rclk'event and rclk = '1') then
83
                        if (rreq = '1') then
84
                                dout <= mem(conv_integer(raddr));
85
                        end if;
86
                end if;
87
        end process read_mem;
88
 
89
        --
90
        -- target specific example
91
        --
92
--      nrreq <= not rreq;
93
--      nwreq <= not wreq;
94
--      u1: VSR256X24M2 port map(RCK => rclk, REN => nrreq, RADR => std_logic_vector(raddr),
95
--                                                                                      WCK => wclk, WEN => nwreq, WADR => std_logic_vector(waddr),
96
--                                                                                      DI => D, DOUT => dout);
97
 
98
 
99
        -- common process for generic and 
100
        -- synchronize dout to read clock
101
        synch_dout: process(rclk)
102
        begin
103
                if (rclk'event and rclk = '1') then
104
                        Q <=dout;
105
                end if;
106
        end process synch_dout;
107
 
108
end architecture structural;
109
 
110
 
111
 
112
 
113
 
114
 

powered by: WebSVN 2.1.0

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