-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelay.vhd
37 lines (32 loc) · 944 Bytes
/
delay.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
--Modulo de retardo
--Retarda la señal de entrada un numero configurable de posiciones
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity delay is
generic (
size: integer := 256
);
port (
clk : in bit;
dataout : out signed(15 downto 0);
datain : in signed(15 downto 0)
);
end delay;
architecture arch_delay of delay is
type memory_type is array (0 to size) of signed(15 downto 0);
signal memory : memory_type :=(others => (others => '0')); --cola inicializada a cero
signal pointer: integer := 0; --posicion de lectura/escritura
begin
process(clk)
begin
if(clk'event and clk='1') then
dataout <= memory(pointer); -- primero sacamos la posicion
memory(pointer) <= datain; -- y la sobreescribimos para la siguiente vuelta
pointer <= pointer + 1;
end if;
if(pointer = size) then
pointer <= 0;
end if;
end process;
end arch_delay;