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

Subversion Repositories iqcorrection

[/] [iqcorrection/] [trunk/] [IQGainPhaseCorrection_arch_integer.vhd] - Blame information for rev 37

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 37 Abraxas3d
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.numeric_std.all;
4
use ieee.std_logic_unsigned.all;
5
use ieee.math_real.all;
6
 
7
 
8
architecture IQGainPhaseCorrection_integer of IQGainPhaseCorrection is
9
 
10
        --signal declarations
11
 
12
 
13
 
14
begin
15
 
16
    correction : process (clk) is
17
 
18
        variable x1_real : real := 0.0;
19
        variable y1_real : real := 0.0;
20
        variable reg_1x1 : real := 0.0;
21
        variable y2      : real := 0.0;
22
        variable mu_1    : real := 0.000244;
23
        variable mu_2    : real := 0.000122;
24
        variable x1y2    : real := 0.0;
25
        variable reg_1   : real := 0.0;
26
        variable reg_2   : real := 1.0;
27
        variable y3      : real := 0.0;
28
 
29
 
30
                begin
31
 
32
                if clk'event and clk = '1' then
33
                           --get I and Q, and convert them back to real values. 
34
                           x1_real := real(to_integer(x1));
35
                           x1_real := x1_real / ((2.0**31.0)-1.0);
36
                           y1_real := real(to_integer(y1));
37
                           y1_real := y1_real / ((2.0**31.0)-1.0);
38
 
39
 
40
                           --phase error estimate, step size set to 0.000244
41
                           --which is achieved with an arithmetic shift right by 12.
42
                           y2 := y1_real - reg_1 * x1_real;
43
 
44
                           reg_1 := reg_1 + mu_1*x1_real*y2;
45
 
46
                           --phase_error <= reg_1;
47
 
48
 
49
                           --gain error estimate, step size set to 0.000122
50
                           --which is achieved with a shift right by 13.
51
                           y3 := y2 * reg_2;
52
 
53
                           reg_2 := reg_2 + mu_2 * ((x1_real * x1_real) - (y3*y3));
54
 
55
 
56
                end if;
57
 
58
        end process;
59
 
60
end IQGainPhaseCorrection_integer;
61
 
62
 
63
 
64
 

powered by: WebSVN 2.1.0

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