集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 852|回复: 2

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

[复制链接]
sunhinur 发表于 2013-4-24 08:42:33 | 显示全部楼层 |阅读模式
本帖最后由 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 : in  STD_LOGIC;
           output : out  STD_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 | 显示全部楼层
再顶
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-6-27 13:02 , Processed in 0.066450 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表