//I/O口以及其他信号啥的 ARCHITECTURE ONE OF SPORTS IS SIGNAL HCNT:STD_LOGIC_VECTOR(0 to 9); SIGNAL VCNT:STD_LOGIC_VECTOR(0 to 9); SIGNAL X1,Y1,X2,Y2,X3,Y3,X4,Y4:STD_LOGIC_VECTOR(0 to 9); SIGNAL X_shudu,Y_shudu:STD_LOGIC_VECTOR(0 to 9); SIGNAL X11,Y11,X21,Y21,X31,Y31,X41,Y41:STD_LOGIC_VECTOR(0 to 9); --底部滑块位置初始化 X1<=20;Y1<=400;X2<=20;Y2<=460; X3<=50;Y3<=400;X4<=50;Y4<=460; --自由移动的那个滑块位置的初始化 X11<=255;Y11<=420;X21<=255;Y21<=430; X31<=270;Y31<=420;X41<=270;Y41<=430; X_shudu<=10;Y_shudu<=10;
ELSIF (Y1<HCNT AND HCNT<Y2 and X1<VCNT AND VCNT<X3)THEN --底部滑块的显示 R <= '1'; G <= '1'; B <= '0'; ELSIF (Y11<HCNT AND HCNT<Y21 and X11<VCNT AND VCNT<X31)THEN --自由移动的那个滑块的显示 R <= '1'; G <= '1'; B <= '0';
PROCESS(X11,Y11,X21,Y21,X31,Y31,X41,Y41) BEGIN --自由物体移动方向右上的代码,水平和竖直方向的移动速度都是shudu个像素 X11<=X11+X_shudu; Y11<=Y11+Y_shudu; X21<=X21+X_shudu; Y21<=Y21+Y_shudu; X31<=X31+X_shudu; Y31<=Y31+Y_shudu; X41<=X41+X_shudu; Y41<=Y41+Y_shudu; IF(X31>640)THEN X_shudu=!X_shudu; X11<=X11+X_shudu; Y11<=Y11+Y_shudu; X21<=X21+X_shudu; Y21<=Y21+Y_shudu; X31<=X31+X_shudu; Y31<=Y31+Y_shudu; X41<=X41+X_shudu; Y41<=Y41+Y_shudu; END IF IF(X11<0)THEN X_shudu=!X_shudu; X11<=X11+X_shudu; Y11<=Y11+Y_shudu; X21<=X21+X_shudu; Y21<=Y21+Y_shudu; X31<=X31+X_shudu; Y31<=Y31+Y_shudu; X41<=X41+X_shudu; Y41<=Y41+Y_shudu; END IF IF(Y11<0)THEN Y_shudu=!Y_shudu; X11<=X11+X_shudu; Y11<=Y11+Y_shudu; X21<=X21+X_shudu; Y21<=Y21+Y_shudu; X31<=X31+X_shudu; Y31<=Y31+Y_shudu; X41<=X41+X_shudu; Y41<=Y41+Y_shudu; END IF IF(Y11>480)THEN Y_shudu=!Y_shudu; X11<=X11+X_shudu; Y11<=Y11+Y_shudu; X21<=X21+X_shudu; Y21<=Y21+Y_shudu; X31<=X31+X_shudu; Y31<=Y31+Y_shudu; X41<=X41+X_shudu; Y41<=Y41+Y_shudu; END IF END PROCESS;