帮忙看一下,输入的信号被忽略了!

gary0451 2007-06-06 04:51:12
程序实现功能如下:
通过clk的脉冲,在recive=0时统计clk的跳变数,达到计时的目的,再把时间通过4个七段数码管显示出来。

程序代码如下:

library ieee;
use ieee.std_logic_1164.all;

entity device is
port(clk :in std_logic; --输入的时钟频率
recive :in std_logic; --计数开关
segs :out std_logic_vector(6 downto 0);--七段数码管的输出
segcs :out std_logic_vector(3 downto 0) --七段数码管的片选
);
end device;

architecture distance_device of device is
constant speed:integer:=278;--音速,在不同环境下有所不同
constant frequency:integer:=32768;--输入的时钟频率
signal temp: integer range 0 to 9;
signal count:integer; --计时的周期数
signal distance:integer; --距离,以分米为单位
begin
process(clk)
begin
segs<="0000000";
segcs<="0000";
if clk'event and clk='1' then
if recive='0' then
count<=count+1;
else
distance<=1000 * speed * count / frequency;--以毫米为单位
for i in 4 to 1 loop
temp<=distance / (i * 10);--高位
distance<=distance - (i * 10 * temp);
case temp is
when 0=> segs <= "1000000";
when 1=> segs <= "1111001";
when 2=> segs <= "0100100";
when 3=> segs <= "0110000";
when 4=> segs <= "0011001";
when 5=> segs <= "0010010";
when 6=> segs <= "0000011";
when 7=> segs <= "1111000";
when 8=> segs <= "0000000";
when 9=> segs <= "0011000";
end case;
for j in 4 to 1 loop
if(j=i) then
segcs(j)<='1';
else
segcs(j)<='0';
end if;
end loop;
end loop;
end if;
end if;
end process;
end distance_device;

每次编译提示如下:
warning:ignored unnecessary INPUT pin 'recive'
warning:ignored unnecessary INPUT pin 'clk'

波形仿真就无法继续下去了,请问这个是什么问题导致的?


...全文
437 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Spartan2 2007-06-11
  • 打赏
  • 举报
回复
推荐搂主有空看看这个库 :use ieee.std_logic_1164.all;(硬件不像软件阿,)
有空的话规范一下代码风格,(不光是对齐,还有硬件化的思想)
Great_Bug 2007-06-08
  • 打赏
  • 举报
回复
居然还有除法,通常除法是不被支持的
Great_Bug 2007-06-08
  • 打赏
  • 举报
回复
什么工具?可以是因为你用了乘法,不被它支持.
ningxin 2007-06-06
  • 打赏
  • 举报
回复
你的代码逻辑混乱。建议把count计数单独写在一个process里面,这样你更能知道自己在表达什么。


6,125

社区成员

发帖
与我相关
我的任务
社区描述
硬件/嵌入开发 硬件设计
社区管理员
  • 硬件设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧