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

Subversion Repositories g729a_codec

[/] [g729a_codec/] [trunk/] [VHDL/] [G729A_asip_rams.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 madsilicon
-----------------------------------------------------------------
2
--                                                             --
3
-----------------------------------------------------------------
4
--                                                             --
5
-- Copyright (C) 2013 Stefano Tonello                          --
6
--                                                             --
7
-- This source file may be used and distributed without        --
8
-- restriction provided that this copyright statement is not   --
9
-- removed from the file and that any derivative work contains --
10
-- the original copyright notice and the associated disclaimer.--
11
--                                                             --
12
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY         --
13
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   --
14
-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   --
15
-- FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      --
16
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         --
17
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    --
18
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   --
19
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        --
20
-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  --
21
-- LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  --
22
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  --
23
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         --
24
-- POSSIBILITY OF SUCH DAMAGE.                                 --
25
--                                                             --
26
-----------------------------------------------------------------
27
 
28
------------------------------------------------------------
29
-- synchronous write, synchronous-read 1 read/write port RAM
30
-- with separated input and output data buses 
31
------------------------------------------------------------
32
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
use ieee.numeric_std.all;
36
 
37
library work;
38
use work.G729A_ASIP_PKG.all;
39
 
40
entity G729_ASIP_RAM_1RW is
41
  generic(
42
    -- I/O data bus width
43
    DWIDTH : integer := 16;
44
    -- word count
45
    WCOUNT : integer := 256
46
  );
47
  port(
48
    CLK_i : in std_logic;
49
    A_i : in unsigned(log2(WCOUNT)-1 downto 0);
50
    D_i : in std_logic_vector(DWIDTH-1 downto 0);
51
    WE_i : in std_logic;
52
 
53
    Q_o : out std_logic_vector(DWIDTH-1 downto 0)
54
  );
55
end G729_ASIP_RAM_1RW;
56
 
57
architecture ARC of G729_ASIP_RAM_1RW is
58
 
59
  type MEM_TYPE is array (WCOUNT-1 downto 0) of std_logic_vector(DWIDTH-1 downto 0);
60
  signal RAM_DATA : MEM_TYPE;
61
 
62
begin
63
 
64
  process(CLK_i)
65
  begin
66
    if(CLK_i = '1' and CLK_i'event)then
67
      if WE_i = '1' then
68
        RAM_DATA(to_integer(A_i)) <= D_i;
69
      end if;
70
      Q_o <= RAM_DATA(to_integer(A_i));
71
    end if;
72
  end process;
73
 
74
end ARC;
75
 
76
------------------------------------------------------------
77
-- synchronous write, synchronous-read 1 read/write port,
78
-- plus 1 read-only port, RAM, with separated input and
79
-- output data buses 
80
------------------------------------------------------------
81
 
82
library ieee;
83
use ieee.std_logic_1164.all;
84
use ieee.numeric_std.all;
85
 
86
library work;
87
use work.G729A_ASIP_PKG.all;
88
 
89
entity G729_ASIP_RAM_1RW1R is
90
  generic(
91
    -- I/O data bus width
92
    DWIDTH : integer := 16;
93
    -- word count
94
    WCOUNT : integer := 256
95
  );
96
  port(
97
    CLK_i : in std_logic;
98
    A_i : in unsigned(log2(WCOUNT)-1 downto 0);
99
    DPRA_i : in unsigned(log2(WCOUNT)-1 downto 0);
100
    D_i : in std_logic_vector(DWIDTH-1 downto 0);
101
    WE_i : in std_logic;
102
 
103
    Q_o : out std_logic_vector(DWIDTH-1 downto 0);
104
    DPQ_o : out std_logic_vector(DWIDTH-1 downto 0)
105
  );
106
end G729_ASIP_RAM_1RW1R;
107
 
108
architecture ARC of G729_ASIP_RAM_1RW1R is
109
 
110
  type MEM_TYPE is array (WCOUNT-1 downto 0) of std_logic_vector(DWIDTH-1 downto 0);
111
  signal RAM_DATA : MEM_TYPE;
112
 
113
begin
114
 
115
  process(CLK_i)
116
  begin
117
    if(CLK_i = '1' and CLK_i'event)then
118
      if WE_i = '1' then
119
        RAM_DATA(to_integer(A_i)) <= D_i;
120
      end if;
121
      Q_o <= RAM_DATA(to_integer(A_i));
122
      DPQ_o <= RAM_DATA(to_integer(DPRA_i));
123
    end if;
124
  end process;
125
 
126
end ARC;

powered by: WebSVN 2.1.0

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