Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

display port vga vhdl coding

Status
Not open for further replies.

vhdl34

Newbie level 6
Joined
Nov 13, 2012
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,349
im trying to display a whole screen red however its not being possible im using 640 by 480 screen and im timing on25 mhz clock and refresh at 60 hz here unde ris my code can some one help me find the mistake
Code:
library IEEE; 
use IEEE.std_logic_1164.all; 
use IEEE.std_logic_arith.all; 
use IEEE.std_logic_misc.all; 
use IEEE.std_logic_unsigned.all; 

entity vgatest is
  port(clk :in std_logic;
      hs : out std_logic;
      vs : out std_logic;
      red1 : out std_logic;
      green2 : out std_logic;
      reset : in std_logic;
blue2: out std_logic
     
      );
            end vgatest;

Architecture vga_arch of vgatest is
  signal clkout : std_logic;
 begin
   
process (clk)
variable counter : integer :=1 ;
variable clktemp : std_logic:= '0';

begin
	if(clk'event and clk ='1') then
    if(counter /= 2) then
		   counter := counter + 1;
		   clkout <= clktemp;
		
		elsif(counter =2) then
		 if(clktemp = '0')then
			clktemp :='1';
			counter := 1 ;
			elsif(clktemp = '1') then
				clktemp := '0';
				counter := 1;
		end if;
		end if;
		end if;
  end process; 
  
  
    process(clkout,reset)
      variable count: integer := 0;
      variable vert : std_logic_vector (8 downto 0) := "000000000";
      variable horiz :std_logic_vector (9 downto 0) := "0000000000";
      variable countv : integer := 0;
      begin
		if (reset = '1') then
		 count := 0;
		 countv := 0;
		 vert := "000000000";
		 horiz :=  "0000000000";
		 red1 <= '0';
          green2<= '0';
          blue2<= '0';
          hs <= '0';
			 vs <='0';
		 
        elsif(clkout'event and clkout ='1') then
      
        
        if(vert = "111011111") then
        vert := "000000000" ;
      end if;
         
          count := count +1;
        if(  count <= 96)then
          
          red1 <= '0';
          green2<= '0';
          blue2<= '0';
          hs <= '0';
          
     
    elsif(count>=97 and count <=144)then
          hs <= '1';
          
          red1 <= '0';
          green2<= '0';
          blue2<= '0';
        
     elsif(count >= 145 and count<=784) then
          horiz := horiz + "0000000001";
        
          hs <='1';
          
          
     
      elsif(count >=785 and count < 800) then 
       horiz := "0000000000";
          hs <='1';
         
         
          red1 <= '0';
          green2<= '0';
          blue2<= '0';
      elsif(count >= 800)then
         countv := countv + 1;
       
  
    vert := vert + "000000001";
     
       count := 0;
     
        end if;
    if(countv < 2) then
      vs <= '0';
      red1 <= '0';
          green2<= '0';
          blue2<= '0';
          
    elsif(countv >=2 and countv < 31 ) then
     vs <='1';
     red1 <= '0';
          green2<= '0';
          blue2<= '0';
          
   elsif(countv >= 31 and countv < 511) then 
   vs <='1';
			red1 <= '1';
          green2<= '0';
          blue2<= '0';

   elsif(countv >= 511 and countv < 521) then 
   vs <='1';
	red1 <= '0';
          green2<= '0';
          blue2<= '0';
      
  elsif (countv > 521) then
   countv :=0 ;
    end if;
      end if;
        end process;
end vga_arch;
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top