Вы находитесь на странице: 1из 7

library IEEE;

use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use IEEE.NUMERIC_STD.ALL;

entity chessboard is
� � Port ( clk,reset : in �STD_LOGIC;

� � � � � �r,g,b,vs,hs : out �STD_LOGIC);


end chessboard;
architecture Behavioral of chessboard is
signal crtclk : std_logic;
signal vc,hc : integer range 0 to 1400:= 0;

begin

process(clk)
variable c : std_logic := '0';
begin
if clk' event and clk = '1' then
c := not c;
end if;
crtclk <= c;
end process;

process (reset,crtclk)
begin

if reset = '1' then


hs <= '0';
vs <= '0';
r <= '0';
g<= '0';
b <='0';

elsif crtclk'event and crtclk = '1' then


if vc = 488 then
vc <= 0;
elsif hc = 768 then
hc <= 0;
vc <= vc + 1;
else�
hc <= hc + 1;
end if;

if hc > 624 and hc < 720 then


hs <= '0';
else
hs <= '1';
end if;

if vc > 442 and vc < 444 then


vs <= '0';
else
vs<= '1';
end if;

if (0<hc and hc<96) and (0<vc and vc<96) then


r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (96<hc and hc<192) and (0<vc and vc<96) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (192<hc and hc<288) and (0<vc and vc<96) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (288<hc and hc<384) and (0<vc and vc<96) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (384<hc and hc<480) and (0<vc and vc<96) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (480<hc and hc<576) and (0<vc and vc<96) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (576<hc and hc<672) and (0<vc and vc<96) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (672<hc and hc<768) and (0<vc and vc<96) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;----------------------------------------------------------------------1

if (0<hc and hc<96) and (96<vc and vc<192) then


r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (96<hc and hc<192) and (96<vc and vc<192) then
r<='1';g<='1';b<='1';
--else
---r<='0';g<='0';b<='0';
end if;
if (192<hc and hc<288) and (96<vc and vc<192) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (288<hc and hc<384) and (96<vc and vc<192) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (384<hc and hc<480) and (96<vc and vc<192) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (480<hc and hc<576) and (96<vc and vc<192) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (576<hc and hc<672) and (96<vc and vc<192) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (672<hc and hc<768) and (96<vc and vc<192) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end
if;--------------------------------------------------------------------------------
---2
if (0<hc and hc<96) and (192<vc and vc<288) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (96<hc and hc<192) and (192<vc and vc<288) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (192<hc and hc<288) and (192<vc and vc<288) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (288<hc and hc<384) and (192<vc and vc<288) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (384<hc and hc<480) and (192<vc and vc<288) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (480<hc and hc<576) and (192<vc and vc<288) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (576<hc and hc<672) and (192<vc and vc<288) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (672<hc and hc<768) and (192<vc and vc<288) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end
if;--------------------------------------------------------------------------------
----3
if (0<hc and hc<96) and (288<vc and vc<384) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (96<hc and hc<192) and (288<vc and vc<384) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (192<hc and hc<288) and (288<vc and vc<384) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (288<hc and hc<384) and (288<vc and vc<384) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (384<hc and hc<480) and (288<vc and vc<384) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (480<hc and hc<576) and (288<vc and vc<384) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (576<hc and hc<672) and (288<vc and vc<384) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (672<hc and hc<768) and (288<vc and vc<384) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end
if;--------------------------------------------------------------------------------
--4

if (0<hc and hc<96) and (384<vc and vc<480) then


r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (96<hc and hc<192) and (384<vc and vc<480) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (192<hc and hc<288) and (384<vc and vc<480) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (288<hc and hc<384) and (384<vc and vc<480) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (384<hc and hc<480) and (384<vc and vc<480) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (480<hc and hc<576) and (384<vc and vc<480) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (576<hc and hc<672) and (384<vc and vc<480) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (672<hc and hc<768) and (384<vc and vc<480) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end
if;--------------------------------------------------------------------------------
----------------5
if (0<hc and hc<96) and (480<vc and vc<576) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (96<hc and hc<192) and (480<vc and vc<576) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (192<hc and hc<288) and (480<vc and vc<576) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (288<hc and hc<384) and (480<vc and vc<576) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (384<hc and hc<480) and (480<vc and vc<576) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (480<hc and hc<576) and (480<vc and vc<576) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (576<hc and hc<672) and (480<vc and vc<576) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (672<hc and hc<768) and (480<vc and vc<576) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end
if;-------------------------------------------------------------------------------6
if (0<hc and hc<96) and (576<vc and vc<672) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (96<hc and hc<192) and (576<vc and vc<672) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (192<hc and hc<288) and (576<vc and vc<672) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (288<hc and hc<384) and (576<vc and vc<672) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (384<hc and hc<480) and (576<vc and vc<672) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (480<hc and hc<576) and (576<vc and vc<672) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (576<hc and hc<672) and (576<vc and vc<672) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (576<hc and hc<678) and (576<vc and vc<672) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;--------------------------------------------------------------------------7
if (0<hc and hc<96) and (672<vc and vc<768) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (96<hc and hc<192) and (672<vc and vc<768) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (192<hc and hc<288) and (672<vc and vc<768) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (288<hc and hc<384) and (672<vc and vc<768) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (384<hc and hc<480) and (672<vc and vc<768) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (480<hc and hc<576) and (672<vc and vc<768) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end if;
if (576<hc and hc<672) and (672<vc and vc<768) then
r<='0';g<='0';b<='0';
--else
--r<='1';g<='1';b<='1';
end if;
if (672<hc and hc<768) and (672<vc and vc<768) then
r<='1';g<='1';b<='1';
--else
--r<='0';g<='0';b<='0';
end
if;--------------------------------------------------------------------------------
-------------8
end if;

end process;

end behavioral;

Вам также может понравиться