|
@ -1,7 +1,6 @@ |
|
|
-- ====================================================================== |
|
|
-- ====================================================================== |
|
|
-- AES encryption/decryption |
|
|
-- AES encryption/decryption |
|
|
-- algorithm according to FIPS 197 specification |
|
|
|
|
|
-- Copyright (C) 2011 Torsten Meissner |
|
|
|
|
|
|
|
|
-- Copyright (C) 2019 Torsten Meissner |
|
|
------------------------------------------------------------------------- |
|
|
------------------------------------------------------------------------- |
|
|
-- This program is free software; you can redistribute it and/or modify |
|
|
-- This program is free software; you can redistribute it and/or modify |
|
|
-- it under the terms of the GNU General Public License as published by |
|
|
-- it under the terms of the GNU General Public License as published by |
|
@ -34,11 +33,11 @@ entity aes_enc is |
|
|
port ( |
|
|
port ( |
|
|
reset_i : in std_logic; -- async reset |
|
|
reset_i : in std_logic; -- async reset |
|
|
clk_i : in std_logic; -- clock |
|
|
clk_i : in std_logic; -- clock |
|
|
key_i : in std_logic_vector(0 TO 127); -- key input |
|
|
|
|
|
data_i : in std_logic_vector(0 TO 127); -- data input |
|
|
|
|
|
|
|
|
key_i : in std_logic_vector(0 to 127); -- key input |
|
|
|
|
|
data_i : in std_logic_vector(0 to 127); -- data input |
|
|
valid_i : in std_logic; -- input key/data valid flag |
|
|
valid_i : in std_logic; -- input key/data valid flag |
|
|
accept_o : out std_logic; |
|
|
accept_o : out std_logic; |
|
|
data_o : out std_logic_vector(0 TO 127); -- data output |
|
|
|
|
|
|
|
|
data_o : out std_logic_vector(0 to 127); -- data output |
|
|
valid_o : out std_logic; -- output data valid flag |
|
|
valid_o : out std_logic; -- output data valid flag |
|
|
accept_i : in std_logic |
|
|
accept_i : in std_logic |
|
|
); |
|
|
); |
|
@ -70,12 +69,15 @@ architecture rtl of aes_enc is |
|
|
begin |
|
|
begin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IterG : if design_type = "ITER" generate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signal s_round : natural range t_rounds'low to t_rounds'high+1; |
|
|
|
|
|
|
|
|
-- psl default clock is rising_edge(Clk_i); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IterG : if design_type = "ITER" generate |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signal s_round : t_enc_rounds; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
begin |
|
|
begin |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -133,7 +135,22 @@ begin |
|
|
end process CryptP; |
|
|
end process CryptP; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- psl cover accept_o; |
|
|
|
|
|
-- psl assert always (accept_o -> s_round = 0); |
|
|
|
|
|
|
|
|
|
|
|
-- psl cover valid_i and accept_o; |
|
|
|
|
|
-- psl assert always (valid_i and accept_o -> next not accept_o); |
|
|
|
|
|
|
|
|
|
|
|
-- psl cover valid_o and accept_i; |
|
|
|
|
|
-- psl assert always (valid_o and accept_i -> next not valid_o); |
|
|
|
|
|
|
|
|
|
|
|
-- psl cover valid_o and not accept_i; |
|
|
|
|
|
-- psl assert always (valid_o and not accept_i -> next data_o'stable); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end generate IterG; |
|
|
end generate IterG; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end architecture rtl; |
|
|
end architecture rtl; |
|
|
|
|
|
|