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

Subversion Repositories uart_fiber

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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