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

Subversion Repositories uart_fiber

[/] [uart_fiber/] [trunk/] [Version2/] [spdif_to_RX.vhd] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 chipmaker7
 
2
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
use IEEE.STD_LOGIC_ARITH.ALL;
5
use IEEE.std_logic_unsigned.all;
6
 
7
 
8
entity spdif_to_RX is
9
    Port ( iCLK : in  STD_LOGIC;
10
           optic_in : in  STD_LOGIC;
11
           RX : out  STD_LOGIC;
12
 
13
                          periodA : in STD_LOGIC_VECTOR(6 downto 0);
14
                          period10 : in STD_LOGIC_VECTOR(6 downto 0)
15
 
16
 
17
 
18
                          );
19
end spdif_to_RX;
20
 
21
architecture Behavioral of spdif_to_RX is
22
 
23
 
24
 
25
--low pass
26
signal q1 : STD_LOGIC;
27
signal q2 : STD_LOGIC;
28
signal samp : STD_LOGIC;
29
 
30
--RX generator
31
signal samp2 : STD_LOGIC;
32
signal cnt : STD_LOGIC_VECTOR(7 downto 0);
33
 
34
signal learn : STD_LOGIC;
35
 
36
 
37
 
38
 
39
signal RX2 : STD_LOGIC;
40
 
41
begin
42
 
43
 
44
 
45
input_low_pass:process (iCLK)
46
begin
47
 
48
if (iCLK'event and iCLK= '1') then
49
 
50
        q1<=q2;
51
        q2<=optic_in;
52
        if(q1=q2)then
53
                samp<=q1;
54
        end if;
55
end if;
56
 
57
end process;
58
 
59
fiber_decoder:process (iCLK)
60
begin
61
 
62
if (iCLK'event and iCLK= '1') then
63
 
64
        samp2<=samp;
65
        if(samp2/=samp and samp=learn) then
66
                if(cnt>period10+3) then--period10+3
67
                        RX<='0'; --shift 0
68
                        RX2<='0';
69
                elsif (cnt<=periodA) then
70
                        RX<=RX2;        --shift1
71
                        RX2<='1';
72
                elsif(cnt<period10-3)then--period10-3
73
                        RX2<='1';       --shift already done, reload diffr. value
74
                else
75
                        learn<=not learn;
76
                end if;
77
                cnt<=(others=>'0');
78
        else
79
                if(cnt=periodA) then
80
                        RX<=RX2;
81
                end if;
82
                cnt<=cnt+1;
83
        end if;
84
 
85
end if;
86
 
87
end process;
88
 
89
end Behavioral;
90
 

powered by: WebSVN 2.1.0

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