summaryrefslogtreecommitdiffstats
path: root/fpga/hp_lcd_driver/tmds_phy_artix7.vhdl
blob: 8c8106e290108d3e2d0dad3409fc61c87a418faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
library ieee;
use ieee.std_logic_1164.all;
use IEEE.NUMERIC_STD.all;

library UNISIM;
use UNISIM.vcomponents.all;


entity tmds_phy_artix7 is
    port (
        reset      : in  std_logic;
        pix_clk    : in  std_logic;
        phy_clk    : in  std_logic;
        din        : in  std_logic_vector(9 downto 0);
        b          : in  natural;
        tmds_out_p : out std_logic;
        tmds_out_n : out std_logic
        );
end tmds_phy_artix7;


architecture beh of tmds_phy_artix7 is

    signal ld : std_logic_vector(9 downto 0);
    signal sr : std_logic_vector(9 downto 0);

    signal s : std_logic;

begin


    process(pix_clk)
    begin
        if rising_edge(pix_clk) then
            ld <= din;
        end if;
    end process;


-- Using ODDR
--   process(phy_clk)
--   begin
--      if rising_edge(phy_clk) then 
--       if b=0 then
--              sr<= ld;
--         else
--            sr(7 downto 0) <= sr  (9 downto 2);
--         end if;
--      end if;
--   end process;
--
--ODDR_inst : ODDR
--generic map(
--   DDR_CLK_EDGE => "SAME_EDGE", -- "OPPOSITE_EDGE" or "SAME_EDGE"
--   INIT => '0',   -- Initial value for Q port ('1' or '0')
--   SRTYPE => "ASYNC") -- Reset Type ("ASYNC" or "SYNC")
--port map (
--   Q => s,   -- 1-bit DDR output
--   C => phy_clk,    -- 1-bit clock input
--   CE => '1',  -- 1-bit clock enable input
--   D1 => sr(0),  -- 1-bit data input (positive edge)
--   D2 => sr(1),  -- 1-bit data input (negative edge)
--   R => '0',    -- 1-bit reset input
--   S => '0'     -- 1-bit set input
--);


-- Using a shift register
    process(phy_clk)
    begin
        if rising_edge(phy_clk) then
            if b = 0 then
                sr <= ld;
            else
                sr(8 downto 0) <= sr (9 downto 1);
                s              <=sr(0);
            end if;
        end if;
    end process;



    od : OBUFDS port map (O => tmds_out_p, OB => tmds_out_n, I => s);

end beh;