cryptography ip-cores in vhdl / verilog
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.5 KiB

10 years ago
10 years ago
  1. -- ======================================================================
  2. -- AES encryption/decryption testbench
  3. -- tests according to NIST special publication
  4. -- Copyright (C) 2011 Torsten Meissner
  5. -------------------------------------------------------------------------
  6. -- This program is free software; you can redistribute it and/or modify
  7. -- it under the terms of the GNU General Public License as published by
  8. -- the Free Software Foundation; either version 2 of the License, or
  9. -- (at your option) any later version.
  10. -- This program is distributed in the hope that it will be useful,
  11. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. -- GNU General Public License for more details.
  14. -- You should have received a copy of the GNU General Public License
  15. -- along with this program; if not, write to the Free Software
  16. -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. -- ======================================================================
  18. library ieee;
  19. use ieee.std_logic_1164.all;
  20. use ieee.numeric_std.all;
  21. use std.env.all;
  22. use work.aes_pkg.all;
  23. entity tb_aes is
  24. end entity tb_aes;
  25. architecture rtl of tb_aes is
  26. signal s_reset : std_logic := '0';
  27. signal s_clk : std_logic := '0';
  28. signal s_mode : std_logic := '0';
  29. signal s_key : std_logic_vector(0 to 127) := (others => '0');
  30. signal s_datain : std_logic_vector(0 to 127) := (others => '0');
  31. signal s_validin : std_logic := '0';
  32. signal s_acceptout : std_logic;
  33. signal s_dataout : std_logic_vector(0 to 127);
  34. signal s_validout : std_logic;
  35. signal s_acceptin : std_logic;
  36. component aes is
  37. port (
  38. reset_i : in std_logic;
  39. clk_i : in std_logic;
  40. mode_i : in std_logic;
  41. key_i : in std_logic_vector(0 TO 127);
  42. data_i : in std_logic_vector(0 TO 127);
  43. valid_i : in std_logic;
  44. accept_o : out std_logic;
  45. data_o : out std_logic_vector(0 TO 127);
  46. valid_o : out std_logic;
  47. accept_i : in std_logic
  48. );
  49. end component aes;
  50. begin
  51. s_clk <= not(s_clk) after 10 ns;
  52. s_reset <= '1' after 100 ns;
  53. i_aes : aes
  54. port map (
  55. reset_i => s_reset,
  56. clk_i => s_clk,
  57. mode_i => s_mode,
  58. key_i => s_key,
  59. data_i => s_datain,
  60. valid_i => s_validin,
  61. accept_o => s_acceptout,
  62. data_o => s_dataout,
  63. valid_o => s_validout,
  64. accept_i => s_acceptin
  65. );
  66. end architecture rtl;