6278|4

81

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

VHDL计数器问题 [复制链接]

各位帮忙看下我这个程序 哪有问题?
还有我想在加个输入端口,挡给这个端口1个高电平时计数清零,在给他一个低电平时候 在重新计数
library ieee;
use ieee.std_logic_1164.all;
entity aa is
port (clk,hold : in std_logic;
      ones     : out integer range 9 downto 0;
      tens     : out integer range 2 downto 0);
end aa;
architecture dh of aa is
begin
process (clk)
variable ones : integer range 9 downto 0;
variable tens : integer range 2 downto 0;
begin
if(clk'event and clk='1') then
if hold ='1' then
if (ones = 9) and (tens =2) then
   ones : = 0;
   tens : = 0;
elsif (ones <9) and (tens =2)then
   ones : = ones-1;
elsif (ones =0) and (tens =2)then
   ones : = 0;
   tens : = tens-1;
elsif (ones <9) and (tens =1)then
   ones : = ones-1;
elsif (ones =0) and (tens =1)then
   ones : = 9;
   tens : = tens-1;
elsif (ones <9) and (tens =0)then
   ones : = ones-1;
end if;
end if;
end if;
ones <= ones;
tens <= tens;
end process;
end;

最新回复

这里揭帖率太低!  详情 回复 发表于 2008-6-12 11:50
点赞 关注

回复
举报

84

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
Error (10500): VHDL syntax error at aa.vhd(17) near text "=";  expecting "(", or an identifier, or a sequential statement,
每个个位上的运算都出现这个错误提示
比如
elsif (ones  <9) and (tens =2)then  
   ones : = ones-1;
elsif (ones =0) and (tens =2)then  
   ones : = 0;中的ones : = ones-1; 和ones : = 0;提示上面的错误
 
 

回复

66

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
我刚才又修改了下程序 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity aa is
port (clk,hold : in std_logic;
      ones     : out integer range 9 downto 0;
      tens     : out integer range 2 downto 0);
end aa;
architecture dh of aa is
begin
process (clk,hold)
variable ones : integer range 9 downto 0;
variable tens : integer range 2 downto 0;
begin
if(clk'event and clk='1') then
if hold <='1' then
if (ones = 0) and (tens =0) then
ones := 9;
tens := 2;  
elsif (ones <9) and (tens =2)then
  ones := ones-1;
  tens := 2;
elsif (ones =0) and (tens =2)then
ones := 9;
tens := 1;
elsif (ones <9) and (tens =1)then
ones := ones-1;
elsif (ones =0) and (tens =1)then
ones := 9;
tens := 0;
elsif (ones <9) and (tens = 0)then
ones := ones-1;
end if;
end if;
end if;
ones := ones;
tens := tens;
end process;
end;
现在是没有错了 可是老是提示Warning (10034): Output port "ones[3]" at aa.vhd(6) has no driver
              Warning (10034): Output port "ones[2]" at aa.vhd(6) has no driver
Warning (10034): Output port "ones[1]" at aa.vhd(6) has no driver
Warning (10034): Output port "ones[0]" at aa.vhd(6) has no driver
Warning (10034): Output port "tens[1]" at aa.vhd(7) has no driver
Warning (10034): Output port "tens[0]" at aa.vhd(7) has no driver
Warning: Entity "aa" contains only dangling pins
Warning: Output pins are stuck at VCC or GND
        Warning: Pin "ones[0]" stuck at GND
        Warning: Pin "ones[1]" stuck at GND
        Warning: Pin "ones[2]" stuck at GND
        Warning: Pin "ones[3]" stuck at GND
        Warning: Pin "tens[0]" stuck at GND
        Warning: Pin "tens[1]" stuck at GND
Warning: Design contains 2 input pin(s) that do not drive logic
        Warning: No output dependent on input pin "clk"
        Warning: No output dependent on input pin "hold"
Warning: Following 6 pins have nothing, GND, or VCC driving datain port -- changes to this      connectivity may change fitting results
        Info: Pin ones[0] has GND driving its datain port
        Info: Pin ones[1] has GND driving its datain port
        Info: Pin ones[2] has GND driving its datain port
        Info: Pin ones[3] has GND driving its datain port
        Info: Pin tens[0] has GND driving its datain port
        Info: Pin tens[1] has GND driving its datain port
Warning: No paths found for timing analysis
 
 
 

回复

70

帖子

0

TA的资源

一粒金砂(初级)

4
 
has no driver
说明你的程序中没有对这些端子赋值(do not care)
Output pins are stuck at VCC or GND
说明你程序中某些端口接地或者悬空了(do not care)
Design contains 2 input pin(s) that do not drive logic
说明你没有用到两个端子(do not care)

作简单的调试逻辑的话,这些警告可以忽略

不过看了你的程序
觉得你没有理解std_logic_vector的含义呢
 
 
 

回复

65

帖子

0

TA的资源

一粒金砂(初级)

5
 
这里揭帖率太低!
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表