OpenCores
URL https://opencores.org/ocsvn/802154phycore/802154phycore/trunk

Subversion Repositories 802154phycore

[/] [802154phycore/] [trunk/] [rtl/] [rx_fir.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
-- Copyright (c) 2010 Antonio de la Piedra
2
 
3
-- This program is free software: you can redistribute it and/or modify
4
-- it under the terms of the GNU General Public License as published by
5
-- the Free Software Foundation, either version 3 of the License, or
6
-- (at your option) any later version.
7
 
8
-- This program is distributed in the hope that it will be useful,
9
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
-- GNU General Public License for more details.
12
 
13
-- You should have received a copy of the GNU General Public License
14
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
-- A VHDL model of the IEEE 802.15.4 physical layer.
17
 
18
        --
19
        -- Coeficientes del filtro representados sobre 10 bits en C-2,
20
        -- 5 para la parte entera y 5 para la parte fraccionaria.
21
        --
22
        --
23
        --      h0 = 0                  -> 0000000000
24
        -- h1 = 0.3826  -> 0000001100
25
        -- h2 = 0.7071          -> 0000010111
26
        -- h3 = 0.9238          -> 0000011110
27
        -- h4 = 1                       -> 0000100000
28
        -- h5 = 0.9238          -> 0000011110
29
        -- h6 = 0.7071          -> 0000010111
30
        -- h7 = 0.3826          -> 0000001100
31
        --
32
 
33
 
34
library IEEE;
35
use IEEE.STD_LOGIC_1164.ALL;
36
use IEEE.numeric_std.ALL;
37
use IEEE.STD_LOGIC_UNSIGNED.ALL;
38
 
39
 
40
entity rx_fir is
41
 
42
        port (mfilter_input: in std_logic_vector(9 downto 0);
43
                        mfilter_clk:   in std_logic;
44
                        mfilter_rst:   in std_logic;
45
                        mfilter_output: out std_logic_vector(9 downto 0));
46
 
47
end rx_fir;
48
 
49
architecture Behavioral of rx_fir is
50
        type registers is array (6 downto 0) of signed(9 downto 0);
51
        type coefficients is array (7 downto 0) of signed(9 downto 0);
52
 
53
        signal reg: registers;
54
        signal output_temp: std_logic_vector(9 downto 0);
55
 
56
        constant coef: coefficients := ("0000001100",
57
                                                                                          "0000010111",
58
                                                                                          "0000011110",
59
                                                                                          "0000100000",
60
                                                                                          "0000011110",
61
                                                                                          "0000010111",
62
                                                                                          "0000001100",
63
                                                                                          "0000000000");
64
 
65
        begin
66
                process (mfilter_clk, mfilter_rst)
67
                        variable acc, prod: signed(19 downto 0) := (others => '0');
68
                begin
69
                                if (mfilter_rst = '1') then
70
                                        for i in 6 downto 0 loop
71
                                                reg(i) <= (others => '0');
72
                                        end loop;
73
 
74
                                elsif rising_edge(mfilter_clk) then
75
                                        acc := coef(0)*signed(mfilter_input);
76
 
77
                                        for i in 1 to 7 loop
78
                                                prod := coef(i)*reg(7-i);
79
                                                acc := acc + prod;
80
                                        end loop;
81
 
82
                                        reg <= signed(mfilter_input) & reg(6 DOWNTO 1);
83
 
84
                                end if;
85
                        output_temp <= std_logic_vector(resize(acc, mfilter_output'length));
86
 
87
        end process;
88
 
89
        mfilter_output <= output_temp;
90
 
91
end Behavioral;
92
 
93
 

powered by: WebSVN 2.1.0

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