I've been trying to display something with a vga. I wanted a signal 640 x 480 @ 60 Hz. So what I have so far in my code: Implemented the clk signal, the red, blue, green, hsync and vsync. Using a Clocking Wizard I made the 25.175MHz needed from 100MHz(nexys 3 board) then the hcounter and vcounter but this is where I get lost, when I have to asign the 1's to all RGB signals I kinda don't know where I need to use it to make it work. Also the timing I got it from here http://tinyvga.com/vga-timing/640x480@60Hz .ucf
1 | --------------------------------------------------------
|
2 | NET "clk" LOC = V10; |
3 | |
4 | NET "red[0]" LOC = U7; |
5 | NET "red[1]" LOC = V7; |
6 | NET "red[2]" LOC = N7; |
7 | |
8 | NET "green[0]" LOC = P8; |
9 | NET "green[1]" LOC = T6; |
10 | NET "green[2]" LOC = V6; |
11 | |
12 | NET "blue[1]" LOC = R7; |
13 | NET "blue[2]" LOC = T7; |
14 | |
15 | |
16 | NET "Hsync" LOC = N6; |
17 | NET "Vsync" LOC = P7; |
18 | --------------------------------------------------------
|
.vhd
1 | ---------------------------------------------------------
|
2 | library IEEE; |
3 | use IEEE.STD_LOGIC_1164.ALL; |
4 | use IEEE.NUMERIC_STD.ALL; |
5 | use IEEE.STD_LOGIC_UNSIGNED.ALL; |
6 | |
7 | entity vgax is |
8 | Port ( clk : in STD_LOGIC; |
9 | Hsync : out STD_LOGIC; |
10 | Vsync : out STD_LOGIC; |
11 | red : out STD_LOGIC_VECTOR (2 downto 0); |
12 | green : out STD_LOGIC_VECTOR (2 downto 0); |
13 | blue : out STD_LOGIC_VECTOR (2 downto 1)); |
14 | end vgax; |
15 | |
16 | architecture Behavioral of vgax is |
17 | COMPONENT dcmx |
18 | port(CLK_IN1 : in std_logic; |
19 | CLK_OUT1 : out std_logic); |
20 | END COMPONENT; |
21 | |
22 | signal clk25M : std_logic; |
23 | signal hcounter : std_logic_vector(9 downto 0) := (others => '0'); |
24 | signal vcounter : std_logic_vector(9 downto 0) := (others => '0'); |
25 | |
26 | begin
|
27 | Inst_dcmx: dcmx PORT MAP( |
28 | CLK_IN1 => clk, |
29 | CLK_OUT1 => clk25M |
30 | );
|
31 | |
32 | --process(hcounter,vcounter)
|
33 | --end process;
|
34 | |
35 | process(clk25m) |
36 | begin
|
37 | ------------------------------------------
|
38 | if clk25M'event and clk25M = '1' then |
39 | if hcounter = 799 then |
40 | hcounter <= (others => '0'); |
41 | if vcounter = 524 then |
42 | vcounter <= (others => '0'); |
43 | else
|
44 | vcounter <= vcounter+1; |
45 | end if; |
46 | else
|
47 | hcounter <= hcounter+1; |
48 | end if; |
49 | ---------------------------------------
|
50 | |
51 | ----------------------
|
52 | if hcounter > 656 and hcounter < 752 then |
53 | hsync<='0'; |
54 | else
|
55 | hsync<='1'; |
56 | end if; |
57 | |
58 | if vcounter > 490 and vcounter < 491 then |
59 | vsync <='0'; |
60 | else
|
61 | vsync <='1'; |
62 | end if; |
63 | ------------------------------------
|
64 | --He I want to make it always display the white colour
|
65 | ---------------------------------------
|
66 | if hcounter < 640 and vcounter < 480 then |
67 | red<= "111"; |
68 | green<="111"; |
69 | blue<="11"; |
70 | hsync<='1'; |
71 | vsync<='0'; |
72 | else
|
73 | red<= "111"; |
74 | green<="111"; |
75 | blue<="11"; |
76 | hsync<='1'; |
77 | vsync<='0'; |
78 | end if; |
79 | -------------------------------------------
|
80 | |
81 | |
82 | end if; |
83 | end process; |
84 | |
85 | end Behavioral; |
86 | ---------------------------------------------------------
|
The result of this is nothing displayed at the screen.