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

Subversion Repositories dqpskmap

[/] [dqpskmap/] [trunk/] [rtl/] [diffPhaseDecoder.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
 
2
-- Copyright (c) 2013 Antonio de la Piedra
3
 
4
-- This program is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
 
9
-- This program is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
library IEEE;
18
use IEEE.STD_LOGIC_1164.ALL;
19
use IEEE.STD_LOGIC_ARITH.ALL;
20
use IEEE.STD_LOGIC_UNSIGNED.ALL;
21
 
22
entity diffPhaseDecoder is
23
        port(clk_18_KHz: in std_logic;
24
                  rst: in std_logic;
25
                  en: in std_logic;
26
                  a_k : out std_logic_vector(7 downto 0);
27
                  b_k : out std_logic_vector(7 downto 0);
28
                  i_k : in std_logic_vector(7 downto 0);
29
                  q_k : in std_logic_vector(7 downto 0));
30
end diffPhaseDecoder;
31
 
32
architecture Behavioral of diffPhaseDecoder is
33
 
34
begin
35
 
36
        phase_decoder: process(clk_18_KHz, en, i_k, q_k)
37
                variable i_k_old : signed(7 downto 0) := (others=>'0');
38
                variable q_k_old : signed(7 downto 0) := (others=>'0');
39
                variable a_k_tmp : signed(15 downto 0) := (others=>'0');
40
                variable b_k_tmp : signed(15 downto 0) := (others=>'0');
41
        begin
42
                if falling_edge(clk_18_KHz) and en = '1' then
43
                        if rst = '1' then
44
                                i_k_old := "00000001";
45
                                q_k_old := "00000000";
46
                        else
47
                                a_k_tmp := signed(i_k)*i_k_old + signed(q_k)*q_k_old;
48
                                b_k_tmp := i_k_old*signed(q_k) - signed(i_k)*q_k_old;
49
 
50
                                i_k_old := signed(i_k);
51
                                q_k_old := signed(q_k);
52
                        end if;
53
                end if;
54
 
55
                a_k <= std_logic_vector(sxt(std_logic_vector(a_k_tmp), a_k'length));
56
                b_k <= std_logic_vector(sxt(std_logic_vector(b_k_tmp), b_k'length));
57
        end process;
58
 
59
end Behavioral;
60
 

powered by: WebSVN 2.1.0

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