📄 move.vhd
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity move is
port( vs_in,clk,rset : in std_logic;
hcnt,vcnt : in std_logic_vector(9 downto 0);
q : out std_logic_vector(2 downto 0));
end entity move;
architecture one of move is
signal a : integer range 0 to 400;
signal cnt : integer range 0 to 32;
signal full : std_logic;
signal q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13,q14,q15,q16,q17,q18,q19,
q20,q21,q22,q23,q24,q25,q26,q27,q28,q29,q30,q31,q32 : std_logic_vector(2 downto 0);
begin
process(vs_in)
begin
if vs_in'event and vs_in ='0' then
if a=400 then
a<=0;full<='1';
else a<=a+4;full<='0';
end if;
end if;
end process;
process(full)
begin
if full'event and full='1' then
if rset='0' then cnt<=0;
elsif cnt=32 then
cnt<=0;
else cnt<=cnt+1;
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk ='1' then
if(hcnt<a and vcnt<75) then q0<="111";
else q0<="111";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(hcnt<a+400 and vcnt<75) then q1<="111";
elsif(hcnt<a and(vcnt>=75 and vcnt<150)) then q1<="110";
else q1<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q2<="111";
elsif(hcnt<a+400 and vcnt<150) then q2<="110";
elsif(hcnt<a and(vcnt>=150 and vcnt<225)) then q2<="101";
else q2<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q3<="111";
elsif(vcnt<150) then q3<="110";
elsif(hcnt<a+400 and vcnt<225) then q3<="101";
elsif(hcnt<a and(vcnt>=225 and vcnt<300)) then q3<="100";
else q3<="100";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q4<="111";
elsif(vcnt<150) then q4<="110";
elsif(vcnt<225) then q4<="101";
elsif(hcnt<a+400 and vcnt<300) then q4<="100";
elsif(hcnt<a and(vcnt>=300 and vcnt<375)) then q4<="011";
else q4<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q5<="111";
elsif(vcnt<150) then q5<="110";
elsif(vcnt<225) then q5<="101";
elsif(vcnt<300) then q5<="100";
elsif(hcnt<a+400 and vcnt<375) then q5<="011";
elsif(hcnt<a and(vcnt>=375 and vcnt<450)) then q5<="010";
else q5<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q6<="111";
elsif(vcnt<150) then q6<="110";
elsif(vcnt<225) then q6<="101";
elsif(vcnt<300) then q6<="100";
elsif(vcnt<375) then q6<="011";
elsif(hcnt<a+400 and vcnt<450) then q6<="010";
elsif(hcnt<a and(vcnt>=450 and vcnt<525)) then q6<="001";
else q6<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q7<="111";
elsif(vcnt<150) then q7<="110";
elsif(vcnt<225) then q7<="101";
elsif(vcnt<300) then q7<="100";
elsif(vcnt<375) then q7<="011";
elsif(vcnt<450) then q7<="010";
elsif(hcnt<a+400 and vcnt<525) then q7<="001";
elsif(hcnt<a and(vcnt>=525 and vcnt<600)) then q7<="000";
else q7<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q8<="111";
elsif(vcnt<150) then q8<="110";
elsif(vcnt<225) then q8<="101";
elsif(vcnt<300) then q8<="100";
elsif(vcnt<375) then q8<="011";
elsif(vcnt<450) then q8<="010";
elsif(vcnt<525) then q8<="001";
elsif(hcnt<a+400 and vcnt<600) then q8<="000";
else q8<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(hcnt>=a and vcnt<75) then q9<="111";
elsif(vcnt>=75 and vcnt<150) then q9<="110";
elsif(vcnt>=150 and vcnt<225) then q9<="101";
elsif(vcnt>=225 and vcnt<300) then q9<="100";
elsif(vcnt>=300 and vcnt<375) then q9<="011";
elsif(vcnt>=375 and vcnt<450) then q9<="010";
elsif(vcnt>=450 and vcnt<525) then q9<="001";
else q9<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(hcnt>=a+400 and vcnt<75) then q10<="111";
elsif((vcnt>=75 and vcnt<150)and hcnt>=a) then q10<="110";
elsif(vcnt>=150 and vcnt<225) then q10<="101";
elsif(vcnt>=225 and vcnt<300) then q10<="100";
elsif(vcnt>=300 and vcnt<375) then q10<="011";
elsif(vcnt>=375 and vcnt<450) then q10<="010";
elsif(vcnt>=450 and vcnt<525) then q10<="001";
else q10<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q11<="000";
elsif(vcnt<150 and hcnt>=a+400) then q11<="110";
elsif(hcnt>=a and (vcnt>=150 and vcnt<225)) then q11<="101";
elsif(vcnt>=225 and vcnt<300) then q11<="100";
elsif(vcnt>=300 and vcnt<375) then q11<="011";
elsif(vcnt>=375 and vcnt<450) then q11<="010";
elsif(vcnt>=450 and vcnt<525) then q11<="001";
else q11<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q12<="000";
elsif(vcnt<150) then q12<="000";
elsif(hcnt>=a+400 and vcnt<225) then q12<="101";
elsif(hcnt>=a and(vcnt>=225 and vcnt<300)) then q12<="100";
elsif(vcnt>=300 and vcnt<375) then q12<="011";
elsif(vcnt>=375 and vcnt<450) then q12<="010";
elsif(vcnt>=450 and vcnt<525) then q12<="001";
else q12<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q13<="000";
elsif(vcnt<150) then q13<="000";
elsif(vcnt<225) then q13<="000";
elsif(hcnt>=a+400 and vcnt<300) then q13<="100";
elsif(hcnt>=a and(vcnt>=300 and vcnt<375)) then q13<="011";
elsif(vcnt>=375 and vcnt<450) then q13<="010";
elsif(vcnt>=450 and vcnt<525) then q13<="001";
else q13<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q14<="000";
elsif(vcnt<150) then q14<="000";
elsif(vcnt<225) then q14<="000";
elsif(vcnt<300) then q14<="000";
elsif(hcnt>=a+400 and vcnt<375) then q14<="011";
elsif(hcnt>=a and(vcnt>=375 and vcnt<450)) then q14<="010";
elsif(vcnt>=450 and vcnt<525) then q14<="001";
else q14<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q15<="000";
elsif(vcnt<150) then q15<="000";
elsif(vcnt<225) then q15<="000";
elsif(vcnt<300) then q15<="000";
elsif(vcnt<375) then q15<="000";
elsif(hcnt>=a+400 and vcnt<450) then q15<="010";
elsif(hcnt>=a and(vcnt>=450 and vcnt<525)) then q15<="001";
else q15<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q16<="000";
elsif(vcnt<150) then q16<="000";
elsif(vcnt<225) then q16<="000";
elsif(vcnt<300) then q16<="000";
elsif(vcnt<375) then q16<="000";
elsif(vcnt<450) then q16<="000";
elsif(hcnt>=a+400 and vcnt<525) then q16<="001";
elsif(hcnt>=a and vcnt>=525) then q16<="000";
else q16<="000";
end if;
end if;
end process;
process(clk,a,hcnt,vcnt)
begin
if clk'event and clk='1' then
if(vcnt<75) then q17<="000";
elsif(vcnt<150) then q17<="000";
elsif(vcnt<225) then q17<="000";
elsif(vcnt<300) then q17<="000";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -