vvt 发表于 2010-11-16 16:59:14

请教一个VHDL程序

请教一个VHDL程序

vvt 发表于 2010-11-16 16:59:32

屏幕上显示一个方块,然后这个方块是在水平方向上移动的

为此写了下面一段程序,但是运行后结果是只是屏幕上方块位置的初始值处显示,运动不起来,不晓得程序是不是程序问题,如果是出在哪里呢?

对了,VGA显示用的屏幕是800*64060Hz的,是digilent上给个那个VGA的ip核来显示的

下面是我的程序:
      library IEEE;
      use IEEE.STD_LOGIC_1164.ALL;
      use IEEE.STD_LOGIC_ARITH.ALL;
      use IEEE.STD_LOGIC_UNSIGNED.ALL;
      
      entity colormap is
                port( hloc:in std_logic_vector(10 downto 0);
                              vloc:in std_logic_vector(10 downto 0);
                              rgbx:out std_logic_vector(7 downto 0);
                              hlocat: inout std_logic_vector(10 downto 0));
      end colormap;
      architecture Behavioral of colormap is
      signal hlocat1:integer:=220;
      signal i:integer:=0;
      begin         
                process(hloc,vloc)      
                begin
                        rgbx<="00000000";
                        if (hloc>=100 and hloc<=550 and vloc>=60 and vloc<=360) then
                              if      (hloc>=320 and hloc<=330) then
                                        rgbx<="00011100";
                              else
                                        rgbx<="11100000";
                              end if;
                        end if;
                        i<=i+1;
                     if i>=60000 then
                              i<=0;
                              hlocat1<=hlocat1+1;
                                        if hlocat1 >500 then
                                        hlocat1<=420;
                                        end if;
                              end if;
                if (hloc>=hlocat1 and hloc<=hlocat1+5 and vloc>=205 and vloc<=210) then
                  i<=i+1;
                  if i>=60000 then
                        i<=0;
                        hlocat1<=hlocat1+1;
                              if hlocat1 >500 then
                              hlocat1<=420;
                              end if;
                        end if;
                  rgbx<="00000011";
                end if;

                              
         end process
      
      end Behavioral;

vvt 发表于 2010-11-16 16:59:46

用FPGA实现打砖块游戏啊

vvt 发表于 2010-11-16 16:59:56

其实是打乒乓球呵呵 一个课程的project

vvt 发表于 2010-11-16 17:00:11

其实就是屏幕刷新的平率比较高然后让那个小方块移动的速度慢下来所以用了一个计数器来实现分频   

好像是用错了数据类型了

用VHDL时因为老师上课用这个做例子然后我也是现学现卖   所以VHDL和Verilog对我没有区别   都不熟

weibode01 发表于 2010-11-17 10:29:59

呵,VHDL跟verilog是有一定的区别滴
页: [1]
查看完整版本: 请教一个VHDL程序