library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use ieee.numeric_std.all;
- 实体部分包含R代表注册VHDL - 如何将1添加到STD_LOGIC_VECTOR?
的输出entity register_16 is
port( input: in std_logic_vector(15 downto 0);
ld, inc, clk, clr: in std_logic;
R: buffer std_logic_vector(15 downto 0));
end register_16 ;
- 它必须平行处理在该步骤
inc_R: process (inc)
begin
R <= R+'1';
end process inc_R;
end behavioral ;
architecture behavioral of register_16 is
begin
reg: process (input, ld, clk, clr)
variable R_temp : std_logic_vector(15 downto 0);
begin
if (clr='1') then
R_temp := b"0000000000000000";
elsif (clk'event and clk='1') then
if (ld='1') then
R_temp := input;
end if;
end if;
R <= R_temp;
end process reg;
- 我的错误 - 主进程(reg)正常工作 - 但其他进程有加载错误g 1.
从#6开始,“使用整数来代替”一个更好的选择是经常使用来自ieee.numeric_std的'unsigned'。这可以让你保留'std_logic'语义,并且可以让你使用'unsigned(127 downto 0)''这样的大数值,你不能用整数。 – wjl 2014-02-21 18:04:04
@wjl我的意思是整数1,而不是R.OP是试图添加一个std_logic_vector和一个std_logic,这是不允许的。给定5.,可以将整数1加到R. – zennehoy 2014-02-23 16:37:45
我同意这很有道理! – wjl 2014-02-23 16:51:33