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 |
|
|
-- G.729a codec synthesis test-bench
|
30 |
|
|
---------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
library IEEE;
|
33 |
|
|
use IEEE.std_logic_1164.all;
|
34 |
|
|
use IEEE.numeric_std.all;
|
35 |
|
|
--use STD.textio.all;
|
36 |
|
|
|
37 |
|
|
library work;
|
38 |
|
|
use work.G729A_ASIP_PKG.all;
|
39 |
|
|
--use WORK.G729A_ASIP_BASIC_PKG.all;
|
40 |
|
|
--use WORK.G729A_ASIP_ARITH_PKG.all;
|
41 |
|
|
--use WORK.G729A_ASIP_OP_PKG.all;
|
42 |
|
|
|
43 |
|
|
entity G729A_CODEC_SDP_SYN is
|
44 |
|
|
port(
|
45 |
|
|
CLK_i : in std_logic; -- clock
|
46 |
|
|
RST_i : in std_logic; -- reset
|
47 |
|
|
STRT_i : in std_logic; -- start
|
48 |
|
|
OPS_i : in std_logic_vector(3-1 downto 0);
|
49 |
|
|
RE_i : in std_logic; -- state read-enable
|
50 |
|
|
WE_i : in std_logic; -- state write-enable
|
51 |
|
|
DI_i : in std_logic_vector(SDLEN-1 downto 0); -- data-in
|
52 |
|
|
|
53 |
|
|
BSY_o : out std_logic; -- busy
|
54 |
|
|
DMAE_o : out std_logic; -- DMA enable
|
55 |
|
|
STS_o : out std_logic_vector(3-1 downto 0); -- status
|
56 |
|
|
DV_o : out std_logic; -- data-out valid
|
57 |
|
|
DO_o : out std_logic_vector(SDLEN-1 downto 0) -- data-out
|
58 |
|
|
);
|
59 |
|
|
end G729A_CODEC_SDP_SYN;
|
60 |
|
|
|
61 |
|
|
architecture ARC of G729A_CODEC_SDP_SYN is
|
62 |
|
|
|
63 |
|
|
constant USE_ROM_MIF : std_logic := '0';
|
64 |
|
|
|
65 |
|
|
component G729A_CODEC_SDP is
|
66 |
|
|
generic(
|
67 |
|
|
-- synthesis translate_off
|
68 |
|
|
ST_FILE : string;
|
69 |
|
|
WB_FILE : string;
|
70 |
|
|
-- synthesis translate_on
|
71 |
|
|
REGISTER_INPUTS : std_logic := '0';
|
72 |
|
|
REGISTER_OUTPUTS : std_logic := '0';
|
73 |
|
|
USE_ROM_MIF : std_logic := '0';
|
74 |
|
|
SIMULATION_ONLY : std_logic := '1'
|
75 |
|
|
);
|
76 |
|
|
port(
|
77 |
|
|
CLK_i : in std_logic; -- clock
|
78 |
|
|
RST_i : in std_logic; -- reset
|
79 |
|
|
STRT_i : in std_logic; -- start
|
80 |
|
|
OPS_i : in std_logic_vector(3-1 downto 0);
|
81 |
|
|
RE_i : in std_logic; -- state read-enable
|
82 |
|
|
WE_i : in std_logic; -- state write-enable
|
83 |
|
|
DI_i : in std_logic_vector(SDLEN-1 downto 0); -- data-in
|
84 |
|
|
|
85 |
|
|
BSY_o : out std_logic; -- busy
|
86 |
|
|
DMAE_o : out std_logic; -- DMA enable
|
87 |
|
|
STS_o : out std_logic_vector(3-1 downto 0); -- status
|
88 |
|
|
DV_o : out std_logic; -- data-out valid
|
89 |
|
|
DO_o : out std_logic_vector(SDLEN-1 downto 0) -- data-out
|
90 |
|
|
);
|
91 |
|
|
end component;
|
92 |
|
|
|
93 |
|
|
signal RST_q : std_logic; -- reset
|
94 |
|
|
signal STRT_q : std_logic; -- start
|
95 |
|
|
signal OPS_q : std_logic_vector(3-1 downto 0);
|
96 |
|
|
signal RE_q : std_logic; -- state read-enable
|
97 |
|
|
signal WE_q : std_logic; -- state write-enable
|
98 |
|
|
signal DI_q : std_logic_vector(SDLEN-1 downto 0); -- data-in
|
99 |
|
|
|
100 |
|
|
signal BSY : std_logic; -- busy
|
101 |
|
|
signal DMAE : std_logic; -- DMA enable
|
102 |
|
|
signal STS : std_logic_vector(3-1 downto 0); -- status
|
103 |
|
|
signal DV : std_logic; -- data-out valid
|
104 |
|
|
signal DO : std_logic_vector(SDLEN-1 downto 0); -- data-out
|
105 |
|
|
|
106 |
|
|
signal BSY_q : std_logic; -- busy
|
107 |
|
|
signal DMAE_q : std_logic; -- DMA enable
|
108 |
|
|
signal STS_q : std_logic_vector(3-1 downto 0); -- status
|
109 |
|
|
signal DV_q : std_logic; -- data-out valid
|
110 |
|
|
signal DO_q : std_logic_vector(SDLEN-1 downto 0); -- data-out
|
111 |
|
|
|
112 |
|
|
begin
|
113 |
|
|
|
114 |
|
|
-- This synthesis test-bench is used to:
|
115 |
|
|
-- verify codec module is synthesizable,
|
116 |
|
|
-- get Fmax realistic estimate and
|
117 |
|
|
-- provide an instantiation template.
|
118 |
|
|
|
119 |
|
|
-- Every input/output signal (except CLK_i and RST_i) is given
|
120 |
|
|
-- a register, in order to make all timing paths of register-register
|
121 |
|
|
-- type, thus simplify timing constraints.
|
122 |
|
|
|
123 |
|
|
process(CLK_i)
|
124 |
|
|
begin
|
125 |
|
|
if(CLK_i'event and CLK_i = '1') then
|
126 |
|
|
RST_q <= RST_i;
|
127 |
|
|
STRT_q <= STRT_i;
|
128 |
|
|
OPS_q <= OPS_i;
|
129 |
|
|
RE_q <= RE_i;
|
130 |
|
|
WE_q <= WE_i;
|
131 |
|
|
DI_q <= DI_i;
|
132 |
|
|
|
133 |
|
|
BSY_q <= BSY;
|
134 |
|
|
DMAE_q <= DMAE;
|
135 |
|
|
STS_q <= STS;
|
136 |
|
|
DV_q <= DV;
|
137 |
|
|
DO_q <= DO;
|
138 |
|
|
end if;
|
139 |
|
|
end process;
|
140 |
|
|
|
141 |
|
|
-- Codec instance
|
142 |
|
|
|
143 |
|
|
U_DUT : G729A_CODEC_SDP
|
144 |
|
|
generic map(
|
145 |
|
|
-- synthesis translate_off
|
146 |
|
|
ST_FILE => "NONE",
|
147 |
|
|
WB_FILE => "NONE",
|
148 |
|
|
-- synthesis translate_on
|
149 |
|
|
REGISTER_INPUTS => '0', -- not needed in this TB
|
150 |
|
|
REGISTER_OUTPUTS => '0', -- not needed in this TB
|
151 |
|
|
USE_ROM_MIF => USE_ROM_MIF,
|
152 |
|
|
SIMULATION_ONLY => '0' -- do not modify this!
|
153 |
|
|
)
|
154 |
|
|
port map(
|
155 |
|
|
CLK_i => CLK_i,
|
156 |
|
|
RST_i => RST_q,
|
157 |
|
|
STRT_i => STRT_q,
|
158 |
|
|
OPS_i => OPS_q,
|
159 |
|
|
RE_i => RE_q,
|
160 |
|
|
WE_i => WE_q,
|
161 |
|
|
DI_i => DI_q,
|
162 |
|
|
|
163 |
|
|
BSY_o => BSY,
|
164 |
|
|
DMAE_o => DMAE,
|
165 |
|
|
STS_o => STS,
|
166 |
|
|
DV_o => DV,
|
167 |
|
|
DO_o => DO
|
168 |
|
|
);
|
169 |
|
|
|
170 |
|
|
-- Outputs
|
171 |
|
|
|
172 |
|
|
BSY_o <= BSY_q;
|
173 |
|
|
DMAE_o <= DMAE_q;
|
174 |
|
|
STS_o <= STS_q;
|
175 |
|
|
DV_o <= DV_q;
|
176 |
|
|
DO_o <= DO_q;
|
177 |
|
|
|
178 |
|
|
end ARC;
|