summaryrefslogtreecommitdiff
path: root/src/add_vhdltbc/i/i-256/tb/top_tb.vhd
diff options
context:
space:
mode:
authorGaetan Leplus <gaetan.leplus@airbus.com>2019-07-04 14:01:34 +0200
committerGaetan Leplus <gaetan.leplus@airbus.com>2019-07-04 14:09:13 +0200
commitd560b7c442c950a59cea691d90abdd42a35b9bf1 (patch)
tree91417728bad80e945029cd946949bd745af19e77 /src/add_vhdltbc/i/i-256/tb/top_tb.vhd
parent7e4b76b05d9a3945b916af09de0f9672abd2b22c (diff)
downloadlilliput-ae-implem-d560b7c442c950a59cea691d90abdd42a35b9bf1.tar.xz
Remplacement de la version vhdltbc par la version optimisée et corrigée
Diffstat (limited to 'src/add_vhdltbc/i/i-256/tb/top_tb.vhd')
-rw-r--r--src/add_vhdltbc/i/i-256/tb/top_tb.vhd88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/add_vhdltbc/i/i-256/tb/top_tb.vhd b/src/add_vhdltbc/i/i-256/tb/top_tb.vhd
new file mode 100644
index 0000000..bfc1da0
--- /dev/null
+++ b/src/add_vhdltbc/i/i-256/tb/top_tb.vhd
@@ -0,0 +1,88 @@
+-- Implementation of the Lilliput-TBC tweakable block cipher by the
+-- Lilliput-AE team, hereby denoted as "the implementer".
+--
+-- For more information, feedback or questions, refer to our website:
+-- https://paclido.fr/lilliput-ae
+--
+-- To the extent possible under law, the implementer has waived all copyright
+-- and related or neighboring rights to the source code in this file.
+-- http://creativecommons.org/publicdomain/zero/1.0/
+
+library IEEE;
+library work;
+use IEEE.numeric_std.all;
+use IEEE.std_logic_1164.all;
+use work.crypt_pack.all;
+
+
+entity top_tb is
+end top_tb;
+
+architecture top_tb_arch of top_tb is
+
+ component top is port (
+ start_i : in std_logic;
+ clock_i : in std_logic;
+ reset_i : in std_logic;
+ data_i : in bit_data;
+ key_i : in bit_key;
+ data_o : out bit_data;
+ tweak_i : in bit_tweak;
+ decrypt_i : in std_logic;
+ liliput_on_out : out std_logic;
+ valid_o : out std_logic
+ );
+ end component;
+
+ signal start_i_s, clock_i_s, reset_i_s : std_logic := '0';
+ signal data_i_s : bit_data;
+ signal key_i_s : bit_key;
+ signal tweak_i_s : bit_tweak;
+ signal data_o_s : bit_data;
+ signal liliput_on_o_s : std_logic;
+ signal decrypt_s : std_logic;
+ signal valid_s : std_logic;
+begin
+ DUT : top
+ port map(
+ start_i => start_i_s,
+ clock_i => clock_i_s,
+ reset_i => reset_i_s,
+ data_i => data_i_s,
+ key_i => key_i_s,
+ tweak_i => tweak_i_s,
+ data_o => data_o_s,
+ decrypt_i => decrypt_s,
+ liliput_on_out => liliput_on_o_s,
+ valid_o => valid_s
+ );
+
+ clock_i_s <= not(clock_i_s) after 100 ns;
+ reset_i_s <= '0' , '1' after 50 ns;
+
+ -----------Decrypt KEY128 TWEAK192 IN32----------
+ decrypt_s <= '1';
+ start_i_s <= '1' after 50 ns, '0' after 1600 ns; --mettre start_i a 0 des lors que le chiffrement commence
+ data_i_s <= X"D983AA90BF6F3F40629CC0601BEFC8BC";
+ key_i_s <= X"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";
+ tweak_i_s <= X"000102030405060708090A0B0C0D0E0F1011121314151617";
+ ----------RESULT X"000102030405060708090Q0B0C0D0E0F";
+
+ -----------------Encrypt KEY128 TWEAK192 IN32----------
+-- decrypt_s <= '0';
+-- start_i_s <= '0','1' after 50 ns, '0' after 1600 ns; --mettre start_i a 0 des lors que le chiffrement commence
+ --data_i_s <= X"000102030405060708090A0B0C0D0E0F";
+ --key_i_s <= X"000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";
+ --tweak_i_s <= X"000102030405060708090A0B0C0D0E0F1011121314151617";
+ ----------RESULT X"D983AA90BF6F3F40629CC0601BEFC8BC";
+
+end top_tb_arch;
+
+configuration top_tb_conf of top_tb is
+ for top_tb_arch
+ for DUT : top
+ use entity work.top(top_arch);
+ --use configuration lib_sources.roundexe_arch;
+ end for;
+ end for;
+end configuration top_tb_conf;