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

Subversion Repositories graphicsaccelerator

[/] [graphicsaccelerator/] [trunk/] [Synchronizer.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 OmarMokhta
library IEEE;
2
use IEEE.std_logic_1164.all;
3
use IEEE.numeric_std.all;
4
use IEEE.std_logic_unsigned.all;
5
entity Synchronizer is
6
    Port ( R : out  STD_LOGIC;
7
           G : out  STD_LOGIC;
8
           B : out  STD_LOGIC;
9
           HS : out  STD_LOGIC;
10
           VS : out  STD_LOGIC;
11
           Clk : in  STD_LOGIC;
12
                          dataIn : in  STD_LOGIC_VECTOR (2 downto 0);
13
                          AddressX : out  STD_LOGIC_VECTOR (9 downto 0);
14
                          AddressY : out  STD_LOGIC_VECTOR (8 downto 0));
15
end Synchronizer;
16
architecture Behavioral of Synchronizer is
17
signal X,nX : STD_LOGIC_VECTOR (10 downto 0) := (others=>'0');
18
signal Y,nY : STD_LOGIC_VECTOR (20 downto 0) := (others=>'0');
19
constant TPW : STD_LOGIC_VECTOR (1 downto 0) := "00";
20
constant TBP : STD_LOGIC_VECTOR (1 downto 0) := "01";
21
constant TDP : STD_LOGIC_VECTOR (1 downto 0) := "10";
22
constant TFP : STD_LOGIC_VECTOR (1 downto 0) := "11";
23
signal XState : STD_LOGIC_VECTOR (1 downto 0) := TPW;
24
signal YState : STD_LOGIC_VECTOR (1 downto 0) := TPW;
25
signal EnableDisplay : STD_LOGIC;
26
signal AddressOfY,nAddressOfY : STD_LOGIC_VECTOR (8 downto 0);
27
begin
28
nX <= X+1;
29
nY <= Y+1;
30
nAddressOfY <= AddressOfY+1;
31
HS <= '0' when XState=TPW else '1';
32
VS <= '0' when YState=TPW else '1';
33
EnableDisplay <= '1' when XState=TDP and YState=TDP else '0';
34
R <= dataIn(0) when EnableDisplay='1' else '0';
35
B <= dataIn(1) when EnableDisplay='1' else '0';
36
G <= dataIn(2) when EnableDisplay='1' else '0';
37
AddressX <= X(10 downto 1);
38
AddressY <= AddressOfY-30;
39
process (Clk) begin
40
        if (rising_edge(Clk)) then
41
                if (XState=TPW and X(7 downto 1)="1100000") then
42
                        X <= (others=>'0');
43
                        XState <= TBP;
44
                elsif (XState=TBP and X(6 downto 1)="110000") then
45
                        X <= (others=>'0');
46
                        XState <= TDP;
47
                elsif (XState=TDP and X(10 downto 1)="1010000000") then
48
                        X <= (others=>'0');
49
                        XState <= TFP;
50
                elsif (XState=TFP and X(5 downto 1)="10000") then
51
                        X <= (others=>'0');
52
                        XState <= TPW;
53
                        AddressOfY <= nAddressOfY;
54
                else
55
                        X <= nX;
56
                end if;
57
                if (YState=TPW and Y(12 downto 1)="11001000000") then
58
                        Y <= (others=>'0');
59
                        YState <= TBP;
60
                elsif (YState=TBP and Y(16 downto 1)="101101010100000") then
61
                        Y <= (others=>'0');
62
                        YState <= TDP;
63
                elsif (YState=TDP and Y(20 downto 1)="1011101110000000000") then
64
                        Y <= (others=>'0');
65
                        YState <= TFP;
66
                elsif (YState=TFP and Y(14 downto 1)="1111101000000") then
67
                        Y <= (others=>'0');
68
                        X <= (others=>'0');
69
                        YState <= TPW;
70
                        XState <= TPW;
71
                        AddressOfY <= (others=>'0');
72
                else
73
                        Y <= nY;
74
                end if;
75
        end if;
76
end process;
77
end Behavioral;

powered by: WebSVN 2.1.0

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