次のコードでは、cipher_temp2を整数値1に初期化しました。しかし、私のコードをシミュレートすると、cipher_temp2の値は0の代わりに0に初期化されています。私はどこが間違っているのか理解できません。信号はVHDLの整数値に初期化できません
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity ciphercalculation is
Port (Msg_temp2 : in integer;
cipher : out integer);
end ciphercalculation;
architecture Behavioral of ciphercalculation is
CONSTANT e1: std_logic_vector(0 TO 2) := ('1', '0', '1');
CONSTANT Pk:integer:=377;
CONSTANT le:integer:=2;
Signal cipher_temp2:integer:=1;
begin
process(cipher_temp2,Msg_temp2)
begin
for i in 0 to le loop
if (e1(i)= '0') then
cipher_temp2<=((cipher_temp2*cipher_temp2) mod Pk);
else
cipher_temp2<=((cipher_temp2*cipher_temp2) mod Pk);
cipher_temp2<=((cipher_temp2*Msg_temp2)mod Pk);
end if;
end loop;
cipher<=cipher_temp2;
end process;
end Behavioral;
これを実証する最小のテストベンチを投稿してください。あなたが使用しているシミュレータ/バージョンについても言及してください。 ghdlでは、私はそれが1に初期化されているのを見ます。その後、プロセスは起動され、340に設定され、次に0に設定されます。 –
http://imgur.com/a/B2Lgjここにシミュレーションのスクリーンショットがあります。私はVivadoを使用しました2014.4 –
そして、私が説明したように、それはあなたが見たいものを貯めることはありません。 –