Hello again trciky, i'm still facing some errors:
Error (10327): VHDL error at XTEA.vhd(55): can't determine definition of operator ""+"" -- found 0 possible definitions
The following is the code and the bolded are the changes done:
Library IEEE;
USE IEEE.std_logic_1164.all;
use ieee.numeric_std.all;
entity XTEA is
Port (
clk:in std_logic;
input: in std_logic_vector(63 downto 0);
key : in std_logic_vector(127 downto 0);
Encoder_output,Decoder_output: out std_logic_vector(63 downto 0)
);
end entity;
architecture rtl of XTEA is
signal k: std_logic_vector(0 to 3);
signal n:integer:=0;
begin
process(clk,input)
variable z,z_up,z_mid,z_down,z_total,y,y_up,y_mid,y_down,y_total: std_logic_vector (31 downto 0);
variable sum: std_logic_vector (31 downto 0) := x"00000000";
variable delta: std_logic_vector (31 downto 0) := x"9e3779b9";
variable test: std_logic_vector (31 downto 0);
variable natvar : integer;
begin
--divide the key into 4 parts
k(0 downto 0)<=key(127 downto 96);
k(1 downto 1)<=key(95 downto 64);
k(2 downto 2)<=key(63 downto 32);
k(3 downto 3)<=key(31 downto 0);
if(rising_edge(clk)) then
if (n=0) then
--divide input into y and z
y:= input(63 downto 32);
z:= input (31 downto 0);
--sum:=x"00000000"; -- try take this out later
elsif (n=32) then
--for decode:delta is delta*2^5 for 32=(2^5) round
sum:=delta(26 downto 0)&"00000";
end if;
--encode
if (n <32) then
test:=sum and x"00000003";
natvar := to_integer(unsigned(test));
z_total:=(((z(27 downto 0)&"0000") XOR ("00000"&z(31 downto 5)))+z) XOR( sum + k( natvar downto natvar ) );
y:=y+z_total; sum:=sum+delta;
y_total:=(((y(27 downto 0)&"0000") XOR ("00000"&y(31 downto 5)))+y) XOR (sum+ k( natvar downto natvar ) );
z:=z+y_total;
Encoder_output<=y&z;
--decode
elsif(n<64) then
if(n=32) then
sum:=delta*32;
end if;
y_total:=(((y(27 downto 0)&"0000") XOR ("00000"&y(31 downto 5)))+y) XOR (sum+ k(sum(31 downto 11) & 3));
z:=z-y_total;
sum:=sum-delta;
z_total:=(((z(27 downto 0)&"0000") XOR ("00000"&z(31 downto 5)))+z) XOR(sum + k(sum & 3));
y:=y+z_total;
Decoder_output<=y&z;
end if;
n<=n+1; --counter
end if;
end process;
end rtl;
The error begins at the line of z_total which is bolded. Why is summation undefined for this case? am i doing anything wrong? Thanx again for the help!:)