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

Subversion Repositories vga_lcd

[/] [vga_lcd/] [tags/] [beta/] [tgen.vhd] - Blame information for rev 62

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rherveille
--
2
-- File tgen.vhd, Video Horizontal and Vertical Timing Generator
3
-- Project: VGA
4
-- Author : Richard Herveille
5
-- rev.: 0.1 April 13th, 2001
6
--
7
--
8
--
9
 
10
library ieee;
11
use ieee.std_logic_1164.all;
12
use ieee.std_logic_arith.all;
13
 
14
entity Tgen is
15
        port(
16
                clk : in std_logic;
17
                rst : in std_logic;
18
 
19
                -- horizontal timing settings
20
                HSyncL : in std_logic;              -- horizontal sync pulse polarization level (pos/neg)
21
                Thsync : in unsigned(7 downto 0);   -- horizontal sync pulse width (in pixels)
22
                Thgdel : in unsigned(7 downto 0);   -- horizontal gate delay (in pixels)
23
                Thgate : in unsigned(15 downto 0);  -- horizontal gate (number of visible pixels per line)
24
                Thlen  : in unsigned(15 downto 0);  -- horizontal length (number of pixels per line)
25
 
26
                -- vertical timing settings
27
                VSyncL : in std_logic;              -- vertical sync pulse polarization level (pos/neg)
28
                Tvsync : in unsigned(7 downto 0);   -- vertical sync width (in lines)
29
                Tvgdel : in unsigned(7 downto 0);   -- vertical gate delay (in lines)
30
                Tvgate : in unsigned(15 downto 0);  -- vertical gate (visible number of lines in frame)
31
                Tvlen  : in unsigned(15 downto 0);  -- vertical length (number of lines in frame)
32
 
33
                CSyncL : in std_logic;              -- composite sync pulse polarization level (pos/neg)
34
                BlankL : in std_logic;              -- blank signals polarizatio level
35
 
36
                eol,                                -- end of line
37
                eof,                                -- end of frame
38
                gate,                               -- vertical AND horizontal gate (logical and function)
39
 
40
                Hsync,                              -- horizontal sync pulse
41
                Vsync,                              -- vertical sync pulse
42
                Csync,                              -- composite sync
43
                Blank : out std_logic               -- blank signal
44
        );
45
end entity Tgen;
46
 
47
architecture dataflow of Tgen is
48
        --
49
        -- Component declarations
50
        --
51
        component vtim is
52
        port(
53
                clk : in std_logic;                -- master clock
54
                ena : in std_logic := '1';         -- count enable
55
                rst : in std_logic;                -- synchronous active high reset
56
 
57
                Tsync : in unsigned(7 downto 0);   -- sync duration
58
                Tgdel : in unsigned(7 downto 0);   -- gate delay
59
                Tgate : in unsigned(15 downto 0);  -- gate length
60
                Tlen  : in unsigned(15 downto 0);  -- line time / frame time
61
 
62
                Sync  : out std_logic;             -- synchronization pulse
63
                Gate  : out std_logic;             -- gate
64
                Done  : out std_logic              -- done with line/frame
65
        );
66
        end component vtim;
67
 
68
        --
69
        -- signals
70
        --
71
        signal Hgate, Vgate : std_logic;
72
        signal Hdone : std_logic;
73
        signal iHsync, iVsync, igate : std_logic;
74
begin
75
        -- hookup horizontal timing generator
76
        hor_gen: vtim port map (clk => clk, rst => rst,
77
                Tsync => Thsync, Tgdel => Thgdel, Tgate => Thgate, Tlen => Thlen,
78
                Sync => iHsync, Gate => Hgate, Done => Hdone);
79
 
80
        -- hookup vertical timing generator
81
        ver_gen: vtim port map (clk => clk, ena => Hdone, rst => rst,
82
                Tsync => Tvsync, Tgdel => Tvgdel, Tgate => Tvgate, Tlen => Tvlen,
83
                Sync => iVsync, Gate => Vgate, Done => eof);
84
 
85
        -- assign outputs
86
        eol   <= Hdone;
87
        igate <= Hgate and Vgate;
88
        gate  <= igate;
89
 
90
        Hsync <= iHsync xor HsyncL;
91
        Vsync <= iVsync xor VsyncL;
92
        Csync <= (iHsync or iVsync) xor CsyncL;
93
        Blank <= igate xnor BlankL;
94
end architecture dataflow;
95
 
96
 

powered by: WebSVN 2.1.0

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