-
Notifications
You must be signed in to change notification settings - Fork 0
/
codec_tb.vhd
61 lines (49 loc) · 1.3 KB
/
codec_tb.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity codec_tb is
end codec_tb;
architecture sim of codec_tb is
signal clk : std_logic := '1';
signal daclrck : std_logic;
signal dacdat : std_logic;
signal bclk : std_logic;
constant data : std_logic_vector(15 downto 0) := x"a35c";
signal next_samp : std_logic;
begin
CODEC : entity work.ab_codec port map (
clk => clk,
en => '1',
data => data,
next_samp => next_samp,
aud_daclrck => daclrck,
aud_dacdat => dacdat,
aud_bclk => bclk
);
clk <= not clk after 10 ns;
process
variable i : integer range -1 to 15 := 15;
begin
wait for 40 ns;
assert daclrck = '1';
while i >= 0 loop
wait for 10 ns;
assert dacdat = data(i);
wait for 30 ns;
i := i - 1;
end loop; -- 680 ns
wait for 1920 ns; -- 2600 ns
assert daclrck = '0';
i := 15;
while i >= 0 loop
wait for 10 ns;
assert dacdat = data(i);
wait for 30 ns;
i := i - 1;
end loop; -- 3240 ns
wait for 10 ns; -- 3250 ns
assert next_samp = '1';
wait for 1910 ns; -- 5160 ns
wait;
end process;
end sim;