vhdl - (VHDL)顶级实体中的两个组件,但只有一个工作
问题描述
我在 QUARTUS II 下使用 VHDL 1993 进行编程,我刚刚创建了两个组件以尝试解决我即将提出的问题,因为它们不是解决方案。在此之前,组件文件包含在设计中,并且一次一个地工作。
因此,在我的基本应用程序中,我尝试做两项工作,一项是闪烁一个 LED 并打开另一个由开关控制的 LED,当我声明两个组件时,只有一个通过开关控制 LED 的组件工作,然后当我未声明时led-switch 组件及其在顶级实体中的信号 闪光灯工作,我猜这是顶级实体“test2”的信号声明有问题,但我不明白为什么它只在使用时有效一次的事情,我在顶级实体编码的是:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity test2 is
port( clk_cpu, K2: in std_logic;
led1, led2: out std_logic);
end test2;
architecture struct of test2 is
component tmp_toogler
port( clk: in std_logic;
led: out std_logic);
end component;
component yes_driver
port( input: in std_logic;
output: out std_logic);
end component;
begin
instanciaD: yes_driver PORT MAP(
K2, led2
);
instancia1: tmp_toogler PORT MAP(
clk_cpu, led1
);
end struct;
闪光灯组件:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity tmp_toogler is
port( clk: in std_logic;
led: out std_logic);
end tmp_toogler;
architecture struct of tmp_toogler is
signal counter: integer range 0 to 50000000;
signal state : std_logic := '1';
begin
process(clk)
begin
if(rising_edge(clk)) then
counter <= counter + 1;
end if;
if(counter = 50000000) then
counter <= 0;
if(state = '0') then
led <= '1';
state <= '1';
else
led <= '0';
state <= '0';
end if;
end if;
end process;
end struct;
LED开关:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity yes_driver is
port( input: in std_logic;
output: out std_logic);
end yes_driver;
architecture struct of yes_driver is
begin
process(input)
begin
output <= input;
end process;
end struct;
我觉得这是一个关于执行多项任务的非常基本的问题,所以我敦促一些帮助,在此先感谢。
解决方案
推荐阅读
- c++ - 如何在 C++ 中创建一个指向整数和逗号串联的 char 指针?
- flutter - 如何编辑 Flutter 暗模式
- python - 使用 k 最近邻回归时拟合错误
- regex - 使用 RegEx 解析地址字段中的合法描述
- youtube - Youtube 视频嵌入缩略图
- kubernetes - 我可以让 NGinX 入口控制器代理外部(不在我的云中)资源吗?
- python - 我安装了 bs4,但随后得到“没有名为 'bs4' 的模块”
- azure - Azure Web Job App.Config 转换在 TFS 发布管道中不起作用
- python - 如何克服 Gnu Radio 3.8 版中的 AttributeError
- java - 某些 JUnit 测试在 Ant 中花费大量时间