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

Subversion Repositories parallel_io_through_fiber

[/] [parallel_io_through_fiber/] [trunk/] [parport_tx/] [main.vhd] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 chipmaker7
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    04:52:11 12/11/2013 
6
-- Design Name: 
7
-- Module Name:    main - Behavioral 
8
-- Project Name: 
9
-- Target Devices: 
10
-- Tool versions: 
11
-- Description: 
12
--
13
-- Dependencies: 
14
--
15
-- Revision: 
16
-- Revision 0.01 - File Created
17
-- Additional Comments: 
18
--
19
----------------------------------------------------------------------------------
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
use IEEE.std_logic_unsigned.all;
24
 
25
-- Uncomment the following library declaration if using
26
-- arithmetic functions with Signed or Unsigned values
27
--use IEEE.NUMERIC_STD.ALL;
28
 
29
-- Uncomment the following library declaration if instantiating
30
-- any Xilinx primitives in this code.
31
--library UNISIM;
32
--use UNISIM.VComponents.all;
33
 
34
entity main is
35
    Port ( iCLK : in  STD_LOGIC;
36
           parallel_in : in  STD_LOGIC_VECTOR (11 downto 0);
37
           fiber_out : out  STD_LOGIC;
38
                          led : out  STD_LOGIC);
39
end main;
40
 
41
architecture Behavioral of main is
42
 
43
 
44
COMPONENT optic_transmitter
45
        PORT(
46
                iCLK : IN std_logic;
47
      s    : IN  STD_LOGIC_VECTOR(11 downto 0);
48
                OPTIC_OUT : OUT std_logic
49
                );
50
        END COMPONENT;
51
COMPONENT step_sampler
52
        PORT(
53
                iCLK : IN std_logic;
54
      step    : IN  STD_LOGIC;
55
                dir    : IN  STD_LOGIC;
56
                step_cnt   : OUT  STD_LOGIC;
57
                dir_value : OUT std_logic
58
                );
59
        END COMPONENT;
60
 
61
signal step_cnt_x:std_logic;
62
signal dir_value_x:std_logic;
63
signal step_cnt_y:std_logic;
64
signal dir_value_y:std_logic;
65
signal step_cnt_z:std_logic;
66
signal dir_value_z:std_logic;
67
signal step_cnt_a:std_logic;
68
signal dir_value_a:std_logic;
69
signal s:std_logic_vector(11 downto 0);
70
 
71
signal led_reg:std_logic;
72
signal led_cnt:std_logic_vector(19 downto 0);
73
 
74
 
75
begin
76
led<=led_reg;
77
--s<=parallel_in(11 downto 6)&dir_value_z&dir_value_y&dir_value_x&step_cnt_z&step_cnt_y&step_cnt_x;
78
--s<=parallel_in(11 downto 0);
79
s<=(
80
                0=>step_cnt_x,
81
                1=>dir_value_x,
82
                2=>step_cnt_a,
83
                3=>parallel_in(3),
84
                4=>step_cnt_y,
85
                5=>dir_value_y,
86
                6=>parallel_in(6),
87
                7=>step_cnt_z,
88
                8=>dir_value_z,
89
                9=>dir_value_a,
90
                10=>parallel_in(10),
91
                11=>parallel_in(11)
92
                );
93
 
94
 
95
 
96
X_inst:step_sampler
97
    Port map ( iCLK=> iCLK,
98
              step => parallel_in(0),
99
                                  dir => parallel_in(1),
100
                                  step_cnt=>step_cnt_x,
101
                                  dir_value => dir_value_x
102
                                  );
103
Y_inst:step_sampler
104
    Port map ( iCLK=> iCLK,
105
              step => parallel_in(4),
106
                                  dir => parallel_in(5),
107
                                  step_cnt=>step_cnt_y,
108
                                  dir_value => dir_value_y
109
                                  );
110
Z_inst:step_sampler
111
    Port map ( iCLK=> iCLK,
112
              step => parallel_in(7),
113
                                  dir => parallel_in(8),
114
                                  step_cnt=>step_cnt_z,
115
                                  dir_value => dir_value_z
116
                                  );
117
A_inst:step_sampler
118
    Port map ( iCLK=> iCLK,
119
              step => parallel_in(2),
120
                                  dir => parallel_in(9),
121
                                  step_cnt=>step_cnt_a,
122
                                  dir_value => dir_value_a
123
                                  );
124
 
125
 
126
optic_transmitter_inst:optic_transmitter
127
    Port map ( iCLK=> iCLK,
128
                   s => s,
129
              optic_out => fiber_out
130
 
131
                                  );
132
led_proc:process (iCLK)
133
begin
134
        if (iCLK'event and iCLK= '1') then
135
                if(led_cnt=0)then
136
                        led_reg<=not led_reg;
137
                end if;
138
                led_cnt<=led_cnt+1;
139
        end if;
140
end process;
141
 
142
 
143
end Behavioral;
144
 

powered by: WebSVN 2.1.0

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