
vhdl语言错误
libraryieee;useieee.std_logic_1164.all;useieee.std_logic_arith.all;useieee.std_logic_...
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity counter10 is
port(
clk,enable,clr:in std_logic;
cy:out std_logic;
q:out std_logic_vector(3 downto 0)
);
end counter10;
architecture counter_arch of counter10 is
begin
process(clk,clr,enable)
variable tmp:integer;
begin
if clr='1' then
tmp:=0;
elsif enable= '1' then
if clk'event and clk='1' then
if(tmp=9) then
tmp:=0;
cy<='1';
else
tmp:=tmp+1;
cy<='1';
end if;
end if;
end if;
end process;
q<=conv_std_logic_vector (tmp,4);
end counter_arch;
10进制计数器 编译没通过 q<=conv_std_logic_vector (tmp,4); 错误tmp未声明 有没有高手帮解答下 怎么修改啊 展开
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity counter10 is
port(
clk,enable,clr:in std_logic;
cy:out std_logic;
q:out std_logic_vector(3 downto 0)
);
end counter10;
architecture counter_arch of counter10 is
begin
process(clk,clr,enable)
variable tmp:integer;
begin
if clr='1' then
tmp:=0;
elsif enable= '1' then
if clk'event and clk='1' then
if(tmp=9) then
tmp:=0;
cy<='1';
else
tmp:=tmp+1;
cy<='1';
end if;
end if;
end if;
end process;
q<=conv_std_logic_vector (tmp,4);
end counter_arch;
10进制计数器 编译没通过 q<=conv_std_logic_vector (tmp,4); 错误tmp未声明 有没有高手帮解答下 怎么修改啊 展开
展开全部
这个tmp实在Process里面声明的,相当于C语言里面的局部变量,在外部当然就看不到了。所以编译的时候会出现这个错误信息。考虑将Tmp变成signal信号。
变量和信号的赋值信号变化是不一样的,一个是实时赋值,一个是在进程结束后赋值,希望你好好注意一下:)
变量和信号的赋值信号变化是不一样的,一个是实时赋值,一个是在进程结束后赋值,希望你好好注意一下:)

2023-06-12 广告
单片机,即单片微控制器,也称为单片微型计算机,是将中央处理器(CPU)、存储器(ROM,RAM)、输入/输出接口和其他功能部件集成在一块 在一个小块的集成电路上,从而实现对整个电路或系统的数字式控制。单片机不是完成某一个逻辑功能的芯片,而是...
点击进入详情页
本回答由意法半导体(中国)投资有限公司提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询