sunhinur 发表于 2013-4-24 08:42:33

妹子新学VHDL,到坛子报道+请教频率计数器问题!在线等回复~~~~

本帖最后由 sunhinur 于 2013-4-24 08:42 编辑

背景如题。。。
刚刚接触FPGA, 学的VHDL语言,目前只做成功过LED 显示二进制计数此类的小东西。。。。惭愧
现在是要做一个频率计数器啊,板子上有一个125MHZ的时钟信号,要求对1-128KHZ的方波进行频率计数,出来一个8为的二进制频率值,同用8个LED 显示。 研究了下理论好像也不难,写码各种写不出来啊。。

这是我写的
ibrary IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity top_module is
    Port ( input, reset,clock : inSTD_LOGIC;
         output : outSTD_LOGIC_VECTOR (7 downto 0));
end top_module;

architecture Behavioral of top_module is

signal mmsecond: integer range 0 to 125000;
signal s0,en: STD_LOGIC;
signal count: STD_LOGIC_VECTOR(7 downto 0);

begin--用这个process产生一个时长1ms的门信号
geten: process(reset,clock,mmsecond)
   begin
if reset='1' then
   s0<='0';
   en<='0';
else
   if clock' event and clock='1' then
    s0<=input;
   
      if mmsecond<125000 then
en<='1';
mmsecond<=mmsecond+1;
else if mmsecond=125000 then
       mmsecond<=0;
       en<='0';
end if;
end if;
end if;
end if;
end process;

docount:process(en,s0)--在1ms中计数输入信号的个数
    begin
    if s0' event and s0='1' then
   if en='0' then
   output<=count;
   count<=conv_std_logic_vector(0,8);
   else
   count<=count+'1';
   end if;
end if;
end process;

end Behavioral;

这个码编译能过,但是连到板子上的结果就是。。。啥都没有,,几个LED一直都是暗的,完全没有反应。
求各位大神帮忙看看,尽管指正。。编的荒谬的地方,求严厉批评。

多谢各位了!!
在线等回复。。。

sunhinur 发表于 2013-4-25 01:24:33

没有人解答一下么,,顶起来~~

sunhinur 发表于 2013-4-25 01:28:06

再顶:dizzy:
页: [1]
查看完整版本: 妹子新学VHDL,到坛子报道+请教频率计数器问题!在线等回复~~~~