Vhdl 近文本“=&引用;期待;(“或”或“或”;
我试图创建一个实体来从信号填充数组,但我得到了以下错误:靠近文本“=”预期“(”或“””或“.” 这是我的vhdl代码Vhdl 近文本“=&引用;期待;(“或”或“或”;,vhdl,Vhdl,我试图创建一个实体来从信号填充数组,但我得到了以下错误:靠近文本“=”预期“(”或“””或“.” 这是我的vhdl代码 library ieee; use ieee.std_logic_1164.all; library work; use work.all; entity decryptionarray is port( clk: in std_logic; key_in: in std_logic_vector(7 downto 0);
library ieee;
use ieee.std_logic_1164.all;
library work;
use work.all;
entity decryptionarray is
port(
clk: in std_logic;
key_in: in std_logic_vector(7 downto 0);
encrypted_data : in std_logic_vector(127 downto 0);
encrypted_data_in : in std_logic_vector(127 downto 0);
decryption_key: out std_logic_vector(7 downto 0)
);
end entity decryptionarray;
architecture bhv of decryptionarray is
type deckeyarray is array (0 to 10) of std_logic_vector(127 downto 0);
signal dkey, keyin : std_logic_vector(7 downto 0);
signal edatain, edata : std_logic_vector(127 downto 0);
begin
P0:process(clk) is
begin
if(deckeyarray(10)/=null) then
for j in 0 to 10 loop
deckeyarray(j)=null;
end loop;
else
keyin <= key_in;
edata <= encrypted_data;
edatain <= encrypted_data_in ;
dkey <= decryption_key ;
end if;
end process P0;
end architecture bhv;
ieee库;
使用ieee.std_logic_1164.all;
图书馆工作;
使用work.all;
实体解密是
港口(
clk:标准逻辑中;
输入:输入标准逻辑向量(7到0);
加密的_数据:标准_逻辑_向量(127到0);
加密的_数据_in:std_逻辑_向量(127向下至0);
解密密钥:输出标准逻辑向量(7到0)
);
末端实体解密;
decryptionarray的架构bhv是
deckeyarray类型是std_逻辑_向量(127到0)的数组(0到10);
信号dkey,keyin:std_逻辑_向量(7到0);
信号edatain,edata:std_逻辑_向量(127向下至0);
开始
P0:过程(clk)为
开始
如果(deckeyarray(10)/=null),则
对于0到10循环中的j
deckeyarray(j)=空;
端环;
其他的
keyinVHDL与deckeyarray(10)/=null中的null
没有比较,而deckeyarray
是一种类型,而不是信号
要检查所有0,您可以执行以下操作:
use ieee.numeric_std.all;
...
type deckeyarray_t is array (0 to 10) of std_logic_vector(127 downto 0);
signal deckeyarray : deckeyarray_t;
...
if unsigned(deckeyarray(10)) = 0 then
deckeyarray(j) <= (others => '0');
也可以在不使用无符号
和数字_std
的情况下进行比较,但可以使用deckeyarray(10)=(deckeyarray(10)范围=>'0')
要填充所有0,您可以执行以下操作:
use ieee.numeric_std.all;
...
type deckeyarray_t is array (0 to 10) of std_logic_vector(127 downto 0);
signal deckeyarray : deckeyarray_t;
...
if unsigned(deckeyarray(10)) = 0 then
deckeyarray(j) <= (others => '0');
deckeyarray(j)'0');
请注意,decryption\u key
输出端口是在dkey中读取的。您创建了一个“类型”,但必须使用此类型创建一个信号/变量。“信号示例信号:deckeyarray;”现在您可以在for循环中使用此信号。类型就像std\u ulogic等。您始终必须基于类型创建一个信号/变量。(1)声明类型后,您可能希望声明该类型的信号并对该信号而不是类型本身进行操作!(2)赋值语句中使用的相等运算符(报告的错误)(3)“null”是保留字,并且不声明有效的std_逻辑向量值。解密_key
是输出端口