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

Subversion Repositories uart_fiber

[/] [uart_fiber/] [trunk/] [Version3/] [q_period.vhd] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 chipmaker7
----------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer: 
4
-- 
5
-- Create Date:    00:04:51 11/17/2013 
6
-- Design Name: 
7
-- Module Name:    q_period - 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
 
35
--q_period entity
36
--parameter : period (local oscillator frequency / fiber bitrate )
37
--calulate :
38
-- period01 = 1/4 period
39
-- periodA =  1/2 period
40
-- period10 = 3/4 period
41
-- These parameters are used in the Receiver and in the Transmitter
42
 
43
 
44
entity q_period is
45
    Port ( period : in  STD_LOGIC_VECTOR (6 downto 0);
46
           period01 : out  STD_LOGIC_VECTOR (6 downto 0);
47
           periodA : out  STD_LOGIC_VECTOR (6 downto 0);
48
           period10 : out  STD_LOGIC_VECTOR (6 downto 0));
49
end q_period;
50
 
51
architecture Behavioral of q_period is
52
 
53
begin
54
 
55
process(period)
56
 
57
variable varA:STD_LOGIC_VECTOR (6 downto 0);
58
variable var01:STD_LOGIC_VECTOR (6 downto 0);
59
 
60
begin
61
        if(period(0)='1')then
62
                varA:=(6=>'0')&period(6 downto 1)+1;
63
        else
64
                varA:=(6=>'0')&period(6 downto 1);
65
        end if;
66
        var01:=(6 downto 5=>'0')&period(6 downto 2);
67
 
68
        periodA<=varA;
69
        period01<=var01;
70
        period10<=varA + var01;
71
 
72
end process;
73
 
74
 
75
 
76
 
77
end Behavioral;
78
 

powered by: WebSVN 2.1.0

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