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

Subversion Repositories g729a_codec

[/] [g729a_codec/] [trunk/] [VHDL/] [G729A_asip_roms_mif.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
-- G729A ASIP ROM memories with MIF init. file
30
---------------------------------------------------------------
31
 
32
---------------------------------------------------------------
33
-- Single-port ROM
34
---------------------------------------------------------------
35
 
36
library ieee;
37
use ieee.std_logic_1164.all;
38
use ieee.numeric_std.all;
39
use std.textio.all;
40
 
41
entity G729A_ASIP_ROM_MIF is
42
  generic(
43
    WCOUNT : natural := 256;
44
    DATA_WIDTH : natural := 8;
45
    ADDR_WIDTH : natural := 8;
46
    ROM_INIT_FILE : string := "NONE"
47
  );
48
  port(
49
    CLK_i : in std_logic;
50
    A_i : in unsigned(ADDR_WIDTH-1 downto 0);
51
    Q_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
52
  );
53
end G729A_ASIP_ROM_MIF;
54
 
55
architecture ARC of G729A_ASIP_ROM_MIF is
56
 
57
  subtype WORD is std_logic_vector(DATA_WIDTH-1 downto 0);
58
  type MEM_TYPE is array (0 to WCOUNT-1) of WORD;
59
 
60
  signal ROM_MEM : MEM_TYPE;
61
  attribute ram_init_file : string;
62
  attribute ram_init_file of ROM_MEM : signal is ROM_INIT_FILE;
63
 
64
begin
65
 
66
  process(CLK_i)
67
  begin
68
    if(CLK_i = '1' and CLK_i'event) then
69
      Q_o <= ROM_MEM(to_integer(A_i));
70
    end if;
71
  end process;
72
 
73
end ARC;
74
 
75
---------------------------------------------------------------
76
-- Dual-port ROM
77
---------------------------------------------------------------
78
 
79
library ieee;
80
use ieee.std_logic_1164.all;
81
use ieee.numeric_std.all;
82
use std.textio.all;
83
 
84
entity G729A_ASIP_ROM_MIF_2R is
85
  generic(
86
    WCOUNT : natural := 256;
87
    DATA_WIDTH : natural := 8;
88
    ADDR_WIDTH : natural := 8;
89
    ROM_INIT_FILE : string := "NONE"
90
  );
91
  port(
92
    CLK_i : in std_logic;
93
    A0_i : in unsigned(ADDR_WIDTH-1 downto 0);
94
    A1_i : in unsigned(ADDR_WIDTH-1 downto 0);
95
 
96
    Q0_o : out std_logic_vector(DATA_WIDTH-1 downto 0);
97
    Q1_o : out std_logic_vector(DATA_WIDTH-1 downto 0)
98
  );
99
end G729A_ASIP_ROM_MIF_2R;
100
 
101
architecture ARC of G729A_ASIP_ROM_MIF_2R is
102
 
103
  subtype WORD is std_logic_vector(DATA_WIDTH-1 downto 0);
104
  type MEM_TYPE is array (0 to WCOUNT-1) of WORD;
105
 
106
  signal ROM_MEM : MEM_TYPE;
107
  attribute ram_init_file : string;
108
  attribute ram_init_file of ROM_MEM : signal is ROM_INIT_FILE;
109
 
110
begin
111
 
112
  process(CLK_i)
113
  begin
114
    if(CLK_i = '1' and CLK_i'event) then
115
      Q0_o <= ROM_MEM(to_integer(A0_i));
116
      Q1_o <= ROM_MEM(to_integer(A1_i));
117
    end if;
118
  end process;
119
 
120
end ARC;
121
 

powered by: WebSVN 2.1.0

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