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

Subversion Repositories hilbert_transformer

[/] [hilbert_transformer/] [trunk/] [vhdl/] [const_delay.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 plutonium
-- This is the implementation of a constant delay
2
-- 
3
-- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
4
-- as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
5
-- 
6
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
7
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
-- 
9
-- You should have received a copy of the GNU General Public License along with this program; 
10
-- if not, see <http://www.gnu.org/licenses/>.
11
 
12
-- Package Definition
13
 
14
library ieee;
15
use ieee.std_logic_1164.all;
16
use IEEE.STD_LOGIC_arith.all;
17
use IEEE.STD_LOGIC_unsigned.all;
18
 
19
package const_delay_pkg is
20
component const_delay
21
        generic(
22
                data_width : integer;
23
                delay_in_clks : integer
24
        );
25
        port(
26
            clk_i : in std_logic;
27
            rst_i : in std_logic;
28
            data_i : in std_logic_vector(data_width-1 downto 0);
29
            data_str_i : in std_logic;
30
            data_o : out std_logic_vector(data_width-1 downto 0);
31
            data_str_o : out std_logic
32
        );
33
end component;
34
end const_delay_pkg;
35
 
36
package body const_delay_pkg is
37
end const_delay_pkg;
38
 
39
-- Entity Definition
40
 
41
library ieee;
42
use ieee.std_logic_1164.all;
43
use IEEE.STD_LOGIC_arith.all;
44
use IEEE.STD_LOGIC_unsigned.all;
45
 
46
entity const_delay is
47
        generic(
48
                data_width : integer := 16;
49
                delay_in_clks : integer := 10
50
        );
51
        port(
52
            clk_i : in std_logic;
53
            rst_i : in std_logic;
54
            data_i : in std_logic_vector(data_width-1 downto 0);
55
            data_str_i : in std_logic;
56
            data_o : out std_logic_vector(data_width-1 downto 0);
57
            data_str_o : out std_logic
58
        );
59
end const_delay;
60
 
61
architecture const_delay_arch of const_delay is
62
 
63
 
64
type register_line is array(0 to delay_in_clks-1) of std_logic_vector(data_width-1 downto 0);
65
type data_str_line is array(0 to delay_in_clks-1) of std_logic;
66
 
67
signal data_int : register_line;
68
signal data_str_int : data_str_line;
69
 
70
begin
71
 
72
process (clk_i, rst_i)
73
begin
74
        if rst_i = '1' then
75
    for i in 0 to delay_in_clks-1 loop
76
      data_int(i) <= (others => '0');
77
      data_str_int(i) <= '0';
78
    end loop;
79
        elsif clk_i'EVENT and clk_i = '1' then
80
    data_int(0) <= data_i;
81
    data_str_int(0) <= data_str_i;
82
 
83
    for i in 0 to delay_in_clks-2 loop
84
      data_int(i+1) <= data_int(i);
85
      data_str_int(i+1) <= data_str_int(i);
86
    end loop;
87
 
88
  end if;
89
end process;
90
data_o <= data_int(delay_in_clks-1);
91
data_str_o <= data_str_int(delay_in_clks-1);
92
 
93
 
94
end const_delay_arch;

powered by: WebSVN 2.1.0

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