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

Subversion Repositories uart_fiber

[/] [uart_fiber/] [trunk/] [Version2/] [main.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 chipmaker7
 
2
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
 
5
use IEEE.STD_LOGIC_ARITH.ALL;
6
use IEEE.std_logic_unsigned.all;
7
--use IEEE.NUMERIC_STD.ALL;
8
 
9
 
10
entity main is
11
    Port ( iCLK : in  STD_LOGIC;
12
           RX : out  STD_LOGIC;
13
           TX : in  STD_LOGIC;
14
           optic_out : out  STD_LOGIC;
15
           optic_in : in  STD_LOGIC;
16
                          setting : in  STD_LOGIC_VECTOR(1 downto 0)
17
 
18
                          --baud_div1 : in STD_LOGIC_VECTOR(3 downto 0);
19
                          --period1 : in STD_LOGIC_VECTOR(3 downto 0)
20
 
21
           --RX2 : out  STD_LOGIC;
22
           --TX2 : in  STD_LOGIC;
23
           --optic_out2 : out  STD_LOGIC;
24
           --optic_in2 : in  STD_LOGIC;
25
 
26
                          --led1 : out  STD_LOGIC;
27
                          --led2 : out  STD_LOGIC;
28
                          --led3 : out  STD_LOGIC;
29
                          --led4 : out  STD_LOGIC
30
 
31
                          );
32
end main;
33
 
34
architecture Behavioral of main is
35
 
36
 
37
 
38
 
39
COMPONENT TX_to_spdif_full
40
        PORT(
41
                iCLK : IN std_logic;
42
                TX : IN std_logic;
43
                OPTIC_OUT : OUT std_logic;
44
                period01 : in STD_LOGIC_VECTOR(6 downto 0);
45
                periodA : in STD_LOGIC_VECTOR(6 downto 0);
46
                period10 : in STD_LOGIC_VECTOR(6 downto 0);
47
                period : in STD_LOGIC_VECTOR(6 downto 0);
48
                baud_div : in STD_LOGIC_VECTOR(6 downto 0)
49
 
50
 
51
                );
52
        END COMPONENT;
53
COMPONENT spdif_to_RX
54
        PORT(
55
                iCLK : IN std_logic;
56
                OPTIC_IN : IN std_logic;
57
                RX : OUT std_logic;
58
 
59
                periodA : in STD_LOGIC_VECTOR(6 downto 0);
60
                period10 : in STD_LOGIC_VECTOR(6 downto 0)
61
 
62
 
63
 
64
                );
65
        END COMPONENT;
66
 
67
 
68
COMPONENT q_period is
69
    PORT ( period : in  STD_LOGIC_VECTOR (6 downto 0);
70
           period01 : out  STD_LOGIC_VECTOR (6 downto 0);
71
           periodA : out  STD_LOGIC_VECTOR (6 downto 0);
72
           period10 : out  STD_LOGIC_VECTOR (6 downto 0)
73
                          );
74
END COMPONENT;
75
 
76
--signal nled1 : STD_LOGIC_VECTOR(3 downto 0);
77
 
78
--constant period : STD_LOGIC_VECTOR(6 downto 0) := ('0','1','0','1','0','0','0'); --40
79
--constant baud_div : STD_LOGIC_VECTOR(6 downto 0) := ('0','0','0','1','0','0','0'); --1
80
 
81
 
82
signal period01 :STD_LOGIC_VECTOR(6 downto 0);
83
signal periodA :STD_LOGIC_VECTOR(6 downto 0);
84
signal period10 :STD_LOGIC_VECTOR(6 downto 0);
85
 
86
signal period : STD_LOGIC_VECTOR(6 downto 0);--normally 40
87
signal baud_div : STD_LOGIC_VECTOR(6 downto 0);--normally 1
88
 
89
 
90
 
91
 
92
begin
93
--led1<=not nled1(3);
94
--led2<=not nled1(2);
95
--led3<=not nled1(1);
96
--led4<=not nled1(0);
97
 
98
--period<=((6 downto 4=>'0')&period1);
99
--baud_div<=((6 downto 4=>'0')&baud_div1);
100
process
101
 
102
 
103
begin
104
        if(setting=('0','0'))then
105
        period<=('0','1','0','1','0','0','0');
106
        --period<=to_stdlogicvector("40");
107
        baud_div<=('0','0','0','0','0','0','1');
108
 
109
        elsif (setting=('0','0'))then
110
        period<=('0','1','0','0','0','0','1');
111
        baud_div<=('0','0','0','0','0','1','0');
112
 
113
        elsif (setting=('0','0'))then
114
        period<=('0','1','0','0','1','0','0');
115
        baud_div<=('0','0','1','0','0','0','0');
116
 
117
        else
118
        period<=('0','1','0','0','0','1','0');
119
        baud_div<=('0','0','0','1','1','1','0');
120
 
121
        end if;
122
 
123
 
124
 
125
end process;
126
 
127
 
128
 
129
 
130
 
131
q_period_inst:q_period
132
 Port map (period=>period,
133
                                period01=>period01,
134
                                periodA=>periodA,
135
                                period10=>period10
136
                                );
137
 
138
TX_to_spdif_full_inst:TX_to_spdif_full
139
    Port map ( iCLK=> iCLK,
140
              TX => TX,
141
                                  optic_out => optic_out,
142
                                  period01=>period01,
143
                                  periodA=>periodA,
144
                                  period10=>period10,
145
                                  period=>period,
146
                                  baud_div=>baud_div
147
                                  );
148
spdif_to_RX_inst:spdif_to_RX
149
    Port map ( iCLK=>iCLK,
150
                                        optic_in => optic_in,
151
                                        RX => RX,
152
                                        periodA=>periodA,
153
                                        period10=>period10
154
 
155
 
156
                                  );
157
 
158
 
159
 
160
end Behavioral;
161
 

powered by: WebSVN 2.1.0

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