-
Notifications
You must be signed in to change notification settings - Fork 0
/
tequalizer_system.vhd
191 lines (156 loc) · 3.58 KB
/
tequalizer_system.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
--Fichero de testbench del sistema de ecualizacion completo
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity test_equalizer_system is
end;
architecture only of test_equalizer_system is
signal CLK : bit := '0';
signal RST : std_logic := '0';
signal rev : bit := '0';
signal f_sel : unsigned (2 downto 0);
signal g_sel : unsigned (3 downto 0);
signal g_en : bit;
signal sink : signed(15 downto 0);
signal sink2 : signed(15 downto 0);
signal tsink : signed (15 downto 0);
signal source : signed(15 downto 0) := "0000000000000000";
signal equal : boolean;
component filehandler is
generic(
stim_file: string :="stimulus.dat";
log_file: string := "output.dat"
);
port(
sink : in signed (15 downto 0);
source : out signed (15 downto 0);
clk : in bit;
RST : in std_logic;
EOG : out std_logic
);
end component;
component equalizer_system is
generic (
reverb_size : integer := 256;
reverb_gain : integer := 100
);
port (
sin : in signed (15 downto 0);
sout : out signed (15 downto 0);
clk : in bit;
f_sel : in unsigned (2 downto 0);
g_sel : in unsigned (3 downto 0);
g_en : in bit;
rev_en : in bit;
level0 : out unsigned (7 downto 0);
level1 : out unsigned (7 downto 0);
level2 : out unsigned (7 downto 0);
level3 : out unsigned (7 downto 0);
level4 : out unsigned (7 downto 0);
level5 : out unsigned (7 downto 0);
level6 : out unsigned (7 downto 0)
);
end component;
component equalizer_system_m is
generic (
reverb_size : integer := 256;
reverb_gain : integer := 100
);
port (
sin : in signed (15 downto 0);
sout : out signed (15 downto 0);
clk : in bit;
f_sel : in unsigned (2 downto 0);
g_sel : in unsigned (3 downto 0);
g_en : in bit;
rev_en : in bit;
level0 : out unsigned (7 downto 0);
level1 : out unsigned (7 downto 0);
level2 : out unsigned (7 downto 0);
level3 : out unsigned (7 downto 0);
level4 : out unsigned (7 downto 0);
level5 : out unsigned (7 downto 0);
level6 : out unsigned (7 downto 0)
);
end component;
begin
equal <= sink = sink2;
-- compensamos retardo de 1 ciclo de reloj en sistema modificado (para comparar)
sink <= tsink after 100 ns;
fh : filehandler
GENERIC MAP (
stim_file =>"signals/short_stim.dat",
log_file => "signals/output.dat")
PORT MAP (
sink => sink,
source => source,
clk => clk,
RST => RST,
EOG => open);
fh2 : filehandler
GENERIC MAP (
log_file => "signals/output2.dat")
PORT MAP (
sink => sink2,
source => open,
clk => clk,
RST => '0',
EOG => open);
es : equalizer_system
GENERIC MAP(
reverb_size => 25,
reverb_gain => 200
)
PORT MAP (
sin => source,
sout => tsink,
clk => clk,
f_sel => "000",
g_sel => "0000",
g_en => '0',
rev_en => rev,
level0 => open,
level1 => open,
level2 => open,
level3 => open,
level4 => open,
level5 => open,
level6 => open
);
esm : equalizer_system_m
GENERIC MAP(
reverb_size => 25,
reverb_gain => 200
)
PORT MAP (
sin => source,
sout => sink2,
clk => clk,
f_sel => "000",
g_sel => "0000",
g_en => '0',
rev_en => rev,
level0 => open,
level1 => open,
level2 => open,
level3 => open,
level4 => open,
level5 => open,
level6 => open
);
clock : PROCESS
begin
wait for 50 ns; clk <= not clk;
end PROCESS clock;
reset : PROCESS
begin
wait for 50 ns; RST <= '1';
wait for 10 ns; RST <= '0';
wait;
end PROCESS reset;
reverb : PROCESS
begin
wait for 200 ns; rev <= '1';
wait;
end PROCESS reverb;
end only;