对不起,如果我的问题很明显,我是VHDL的新手 我试图编写一个奇偶校验生成器,它计算Vector(d)中的1的数量,并为变量odds和even分配一个true或false。
我的代码:
unsigned char rand_val[128];
RAND_bytes(rand_val, sizeof(rand_val));
我收到以下错误,但我不知道从哪里开始,你们可以帮帮我吗?
错误:
library ieee;
use ieee.std_logic_1164.all;
--------------------------------------------------
ENTITY testing IS
GENERIC (N : positive := 4);
PORT (d : IN bit_vector(N-1 DOWNTO 0);
odd : OUT bit;
even : OUT bit);
END testing;
--------------------------------------------------
architecture verhalten of testing is
begin
process(d)
function anzahl_1(d_s : in std_logic_vector) return natural is
variable nb : natural;
begin
nb :=0;
lbl: for i in N-1 DOWNTO 0 generate
---d_S(i) <= d_S(i+1) XOR d(i);
if d_s(i) = '1' then
nb := nb +1 ;
end if;
end generate lbl;
return nb;
end anzahl_1;
begin
if (anzahl_1(d) REM 2) = 0 then
odd <= '0';
even <='1';
else
odd <= '1';
even <='0';
end if;
end process;
end verhalten;