我在做类似的事情时遇到了麻烦
b(0 to 7) <= a(7 downto 0)
Run Code Online (Sandbox Code Playgroud)
当我用ghdl编译它时,我有一个订单错误.我发现使电路工作的唯一方法如下:
library ieee;
use ieee.std_logic_1164.all;
entity reverser is
port(
a: in std_logic_vector(7 downto 0);
y: out std_logic_vector(7 downto 0);
rev: in std_logic
);
end reverser;
architecture rtl of reverser is
signal b: std_logic_vector (7 downto 0);
begin
b(7) <= a(0);
b(6) <= a(1);
b(5) <= a(2);
b(4) <= a(3);
b(3) <= a(4);
b(2) <= a(5);
b(1) <= a(6);
b(0) <= a(7);
y <= b when rev = '1' else a;
end rtl; …
Run Code Online (Sandbox Code Playgroud) 我正在尝试将输入值分配给下面代码中的aa
信号。t
编译成功,但是有警告:
警告[9]:C:/Modeltech_5.7f/examples/hassan1.vhd(14):(vcom-1013)“t”的初始值取决于信号“aa”的值。
这是代码:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all ;
use ieee.numeric_std.all;
entity counter is
port(clk :in std_logic;
reset : in std_logic;
aa: in std_logic_vector(3 downto 0);
check : out std_logic_vector(3 downto 0));
end counter;
architecture imp of counter is
signal i:std_logic_vector(3 downto 0):="0000";
signal t:std_logic_vector(3 downto 0):=aa;
begin
process(clk)
begin
if rising_edge(clk) and (t>0) then
t<=t-1;
i<=i+1;
end if;
end process;
check<=i;
end imp;
Run Code Online (Sandbox Code Playgroud)
我应该做什么才能减少过程中的输入“aa”?该程序旨在将输入值递减aa
至 0。
出于教育目的,我试图声明一个字符文字的枚举值的别名.在下面的示例中,我正在尝试bit_one
在枚举类型bit
(在std.standard中声明)中为值"1" 创建别名.
我很疑惑为什么下面的第一个表格被两个编译器(GHDL 0.29.1和Quartus II 13.01)拒绝,而第二个表单被同样的两个,以及ModelSim和ActiveHDL接受.因此,问题是:在下面的注释掉的行中声明这个别名是非法的吗?
entity character_literal_alias is
end;
architecture rtl of character_literal_alias is
--alias bit_one is '1'[return bit]; -- Doesn't work in GHDL or Quartus
alias bit_one is std.standard.'1'[return bit]; -- Works with ModelSim, ActiveHDL, GHDL, and Quartus
alias append is append_mode[return file_open_kind]; -- Works with the whole bunch
begin
end;
Run Code Online (Sandbox Code Playgroud)
我在其他工具中使用GHDL和VHDL-2008中的VHDL-2002开关.
如果我稍微推测一下,在VHDL-2008 LRM中,所有示例都是以下列形式编写的:
-- implicit aliases ...
-- alias '0' is STD.STANDARD.'0' [return STD.STANDARD.BIT];
-- alias '1' is STD.STANDARD.'1' [return STD.STANDARD.BIT]; …
Run Code Online (Sandbox Code Playgroud)