OpenCores
URL https://opencores.org/ocsvn/threeaesc/threeaesc/trunk

Subversion Repositories threeaesc

[/] [threeaesc/] [trunk/] [aes_c_2/] [src/] [tb_aes_enc.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
-- Copyright (c) 2011 Antonio de la Piedra
2
 
3
-- This program is free software: you can redistribute it and/or modify
4
-- it under the terms of the GNU General Public License as published by
5
-- the Free Software Foundation, either version 3 of the License, or
6
-- (at your option) any later version.
7
 
8
-- This program is distributed in the hope that it will be useful,
9
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
-- GNU General Public License for more details.
12
 
13
-- You should have received a copy of the GNU General Public License
14
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
LIBRARY ieee;
17
USE ieee.std_logic_1164.ALL;
18
 
19
ENTITY tb_aes_enc IS
20
END tb_aes_enc;
21
 
22
ARCHITECTURE behavior OF tb_aes_enc IS
23
 
24
    -- Component Declaration for the Unit Under Test (UUT)
25
 
26
    COMPONENT aes_enc
27
    PORT(
28
         clk : IN  std_logic;
29
         block_in : IN  std_logic_vector(127 downto 0);
30
         sub_key : IN std_logic_vector(127 downto 0);
31
         last : IN std_logic;
32
 
33
         block_out : OUT  std_logic_vector(127 downto 0));
34
    END COMPONENT;
35
 
36
 
37
   --Inputs
38
   signal clk : std_logic := '0';
39
   signal block_in : std_logic_vector(127 downto 0) := (others => '0');
40
   signal sub_key : std_logic_vector(127 downto 0) := (others=> '0');
41
   signal last : std_logic := '0';
42
 
43
        --Outputs
44
   signal block_out : std_logic_vector(127 downto 0);
45
 
46
   -- Clock period definitions
47
   constant clk_period : time := 10 ns;
48
 
49
BEGIN
50
 
51
        -- Instantiate the Unit Under Test (UUT)
52
   uut: aes_enc PORT MAP (
53
          clk => clk,
54
          block_in => block_in,
55
          sub_key => sub_key,
56
          last => last,
57
          block_out => block_out);
58
 
59
   -- Clock process definitions
60
   clk_process :process
61
   begin
62
                clk <= '0';
63
                wait for clk_period/2;
64
                clk <= '1';
65
                wait for clk_period/2;
66
   end process;
67
 
68
 
69
   -- Stimulus process
70
   stim_proc: process
71
   begin
72
 
73
                wait for clk_period/2 + clk_period*2;
74
 
75
                block_in <= X"5b75966825a9e32f5b7c424c37f6652b";
76
                sub_key  <= X"41bf6904bf0c596cbfc9c2d24e74ffb6";
77
 
78
                wait for clk_period;
79
 
80
                assert block_out = X"add6b976204688966765efb4cb5f01d1"
81
                 report "Stage 1 encryption FAILED" severity FAILURE;
82
 
83
                block_in <= X"add6b976204688966765efb4cb5f01d1";
84
                sub_key  <= X"fd8d05fdbc326cf9033e3595bcf7f747";
85
 
86
                wait for clk_period;
87
 
88
                assert block_out = X"f191a5f39fe59f7283a1352a4a06178e"
89
                 report "Stage 2 encryption FAILED" severity FAILURE;
90
 
91
                wait;
92
   end process;
93
 
94
END;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.