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

Subversion Repositories vga_lcd

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rherveille
--
2
-- File vtim.vhd, Video 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
library count;
15
use count.count.all;
16
 
17
entity vtim is
18
        port(
19
                clk : in std_logic;                -- master clock
20
                ena : in std_logic;                -- count enable
21
                rst : in std_logic;                -- synchronous active high reset
22
 
23
                Tsync : in unsigned(7 downto 0);   -- sync duration
24
                Tgdel : in unsigned(7 downto 0);   -- gate delay
25
                Tgate : in unsigned(15 downto 0);  -- gate length
26
                Tlen  : in unsigned(15 downto 0);  -- line time / frame time
27
 
28
                Sync  : out std_logic;             -- synchronization pulse
29
                Gate  : out std_logic;             -- gate
30
                Done  : out std_logic              -- done with line/frame
31
        );
32
end entity vtim;
33
 
34
architecture structural of vtim is
35
        signal Dsync, Dgdel, Dgate, Dlen : std_logic;
36
        signal go, drst, rst_strb : std_logic;
37
begin
38
        -- generate go signal
39
        gen_go: process(clk)
40
        begin
41
                if (clk'event and clk = '1') then
42
                        drst <= rst;
43
                        go <= Dlen or (not rst and drst);
44
                end if;
45
        end process gen_go;
46
--      go <= Dlen or (not rst and drst); does not work => horizontal Dlen counter does not reload
47
 
48
        -- hookup sync counter
49
        sync_cnt : ro_cnt generic map (SIZE => 8)
50
                port map (clk => clk, rst => rst, cnt_en => ena, go => go, D => Tsync, iD => Tsync, done => Dsync);
51
 
52
        -- hookup gate delay counter
53
        gdel_cnt : ro_cnt generic map (SIZE => 8)
54
                port map (clk => clk, rst => rst, cnt_en => ena, go => Dsync, D => Tgdel, iD => Tgdel, done => Dgdel);
55
 
56
        -- hookup gate counter
57
        gate_cnt : ro_cnt generic map (SIZE => 16)
58
                port map (clk => clk, rst => rst, cnt_en => ena, go => Dgdel, D => Tgate, iD => Tgate, done => Dgate);
59
 
60
        -- hookup gate counter
61
        len_cnt : ro_cnt generic map (SIZE => 16)
62
                port map (clk => clk, rst => rst, cnt_en => ena, go => go, D => Tlen, iD => Tlen, done => Dlen);
63
 
64
        -- generate output signals
65
        gen_sync: block
66
                signal iSync : std_logic;
67
        begin
68
                process(clk)
69
                begin
70
                        if (clk'event and clk = '1') then
71
                                if (rst = '1') then
72
                                        iSync <= '0';
73
                                else
74
                                        iSync <= (go or iSync) and not Dsync;
75
                                end if;
76
                        end if;
77
                end process;
78
                Sync <= iSync;
79
        end block gen_sync;
80
 
81
        gen_gate: block
82
                signal iGate : std_logic;
83
        begin
84
                process(clk)
85
                begin
86
                        if (clk'event and clk = '1') then
87
                                if (rst = '1') then
88
                                        iGate <= '0';
89
                                else
90
                                        iGate <= (Dgdel or iGate) and not Dgate;
91
                                end if;
92
                        end if;
93
                end process;
94
 
95
                Gate <= iGate;
96
        end block gen_gate;
97
 
98
        Done <= Dlen;
99
end architecture structural;

powered by: WebSVN 2.1.0

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