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_rx/] [main.vhd] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 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_out : out  STD_LOGIC_VECTOR (11 downto 0);
37
           fiber_in : in  STD_LOGIC;
38
                          led : out  STD_LOGIC
39
                          );
40
 
41
end main;
42
 
43
architecture Behavioral of main is
44
 
45
 
46
COMPONENT optic_receiver
47
        PORT(
48
                iCLK : IN std_logic;
49
                OPTIC_IN : IN std_logic;
50
                s : OUT STD_LOGIC_VECTOR(11 downto 0);
51
                s_prev : OUT STD_LOGIC_VECTOR(11 downto 0);
52
                step_sync : OUT STD_LOGIC
53
                );
54
        END COMPONENT;
55
 
56
signal s:std_logic_vector(11 downto 0);
57
signal s_prev:std_logic_vector(11 downto 0);
58
signal step_sync:std_logic;
59
signal led_reg:std_logic;
60
signal led_cnt:std_logic_vector(19 downto 0);
61
begin
62
 
63
 
64
 
65
--parallel_out<=s(11 downto 3)&((s(2) xor s_prev(2)) and step_sync)&((s(1) xor s_prev(1)) and step_sync)&((s(0) xor s_prev(0)) and step_sync);
66
--parallel_out<=s(11 downto 0);
67
 
68
parallel_out<=(
69
                                0=>(s(0) xor s_prev(0)) and step_sync,--step x
70
                                1=>s(1),
71
                                2=>(s(2) xor s_prev(2)) and step_sync,--step a
72
                                3=>s(3),
73
                                4=>(s(4) xor s_prev(4)) and step_sync,--step y
74
                                5=>s(5),
75
                                6=>s(6),
76
                                7=>(s(7) xor s_prev(7)) and step_sync,--step z
77
                                8=>s(8),
78
                                9=>s(9),
79
                                10=>s(10),
80
                                11=>s(11));
81
 
82
 
83
 
84
led<=led_reg;
85
 
86
optic_receiver_inst:optic_receiver
87
    Port map ( iCLK=> iCLK,
88
              optic_in => fiber_in,
89
                                  s => s,
90
                                  s_prev => s_prev,
91
                                  step_sync => step_sync
92
                                  );
93
 
94
led_proc:process (iCLK)
95
begin
96
        if (iCLK'event and iCLK= '1') then
97
                if(led_cnt=0)then
98
                        led_reg<=not led_reg;
99
                end if;
100
                led_cnt<=led_cnt+1;
101
        end if;
102
end process;
103
 
104
end Behavioral;
105
 

powered by: WebSVN 2.1.0

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