summaryrefslogtreecommitdiff
path: root/src/add_vhdltbc/decrypt/state_register.vhd
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-26 15:20:53 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-26 15:44:53 +0100
commitd522f00fa80c91da25aff834f446c285e4654e7b (patch)
tree2a59d03ecb22c3d09a8ac2c438adc7aa464ad33d /src/add_vhdltbc/decrypt/state_register.vhd
parentec7e5a5fca16bc8e16ca6ba4734f4ba1f1612cff (diff)
downloadlilliput-ae-implem-d522f00fa80c91da25aff834f446c285e4654e7b.tar.xz
[implem-vhdl] Déplacement dans SOUMISSION_NIST
Diffstat (limited to 'src/add_vhdltbc/decrypt/state_register.vhd')
-rw-r--r--src/add_vhdltbc/decrypt/state_register.vhd30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/add_vhdltbc/decrypt/state_register.vhd b/src/add_vhdltbc/decrypt/state_register.vhd
new file mode 100644
index 0000000..cdba362
--- /dev/null
+++ b/src/add_vhdltbc/decrypt/state_register.vhd
@@ -0,0 +1,30 @@
+library IEEE;
+library work;
+use IEEE.numeric_std.ALL;
+use IEEE.STD_LOGIC_1164.ALL;
+use work.crypt_pack.ALL;
+
+entity state_register is
+ port(
+ state_i : in type_state; -- Etat d'entrée
+ state_o : out type_state; -- Etatde sortie
+ clock_i : in std_logic; -- Permet de gérer la clock
+ reset_i : in std_logic);
+end state_register;
+
+architecture state_register_arch of state_register is
+begin
+ process(reset_i, clock_i) -- On définit ici un process car les fonctions ne doivent pas se faire en même temps
+ begin
+ if(reset_i = '0') then
+ for i in 0 to 3 loop
+ for j in 0 to 3 loop
+ state_o(i)(j) <= (others => '0'); --si rest_i est nul c'est que les valeurs de state_o sont nuls
+ end loop;
+ end loop;
+ elsif(clock_i'event and clock_i = '1') then -- Dans le cas d'un front descendant d'horloge state_o prend la valeur de state_i. On utilise un front descendant d'horloge pour un soucis de synchronisation avec sbox
+ state_o <= state_i;
+ end if;
+ end process;
+
+ end state_register_arch;