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

Subversion Repositories aes_all_keylength

[/] [aes_all_keylength/] [trunk/] [aesTB.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 feketebv
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   15:23:44 06/23/2013
6
-- Design Name:   
7
-- Module Name:   S:/project/aes/aes/aesTest.vhd
8
-- Project Name:  aes
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: aes
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--
21
-- Notes: 
22
-- This testbench has been automatically generated using types std_logic and
23
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24
-- that these types always be used for the top-level I/O of a design in order
25
-- to guarantee that the testbench will bind correctly to the post-implementation 
26
-- simulation model.
27
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
 
31
-- Uncomment the following library declaration if using
32
-- arithmetic functions with Signed or Unsigned values
33
--USE ieee.numeric_std.ALL;
34
 
35
ENTITY aesTB IS
36
END aesTB;
37
 
38
ARCHITECTURE behavior OF aesTB IS
39
 
40
    -- Component Declaration for the Unit Under Test (UUT)
41
 
42
    COMPONENT aes
43
    PORT(
44
         reset : IN  std_logic;
45
         clock : IN  std_logic;
46
         key : IN  std_logic_vector(31 downto 0);
47
         keynew : IN  std_logic;
48
         keyload : IN  std_logic;
49
         keyexpansionready : OUT  std_logic;
50
         text : IN  std_logic_vector(127 downto 0);
51
         empty : OUT  std_logic;
52
         enable : IN  std_logic;
53
         ciphertext : OUT  std_logic_vector(127 downto 0);
54
         ready : OUT  std_logic
55
        );
56
    END COMPONENT;
57
 
58
 
59
   --Inputs
60
   signal reset : std_logic := '0';
61
   signal clock : std_logic := '0';
62
   signal key : std_logic_vector(31 downto 0) := (others => '0');
63
   signal keynew : std_logic := '0';
64
   signal keyload : std_logic := '0';
65
   signal text : std_logic_vector(127 downto 0) := (others => '0');
66
   signal enable : std_logic := '0';
67
 
68
        --Outputs
69
   signal keyexpansionready : std_logic;
70
   signal empty : std_logic;
71
   signal ciphertext : std_logic_vector(127 downto 0);
72
   signal ready : std_logic;
73
 
74
   -- Clock period definitions
75
   constant clock_period : time := 10 ns;
76
 
77
BEGIN
78
 
79
        -- Instantiate the Unit Under Test (UUT)
80
   uut: aes PORT MAP (
81
          reset => reset,
82
          clock => clock,
83
          key => key,
84
          keynew => keynew,
85
          keyload => keyload,
86
          keyexpansionready => keyexpansionready,
87
          text => text,
88
          empty => empty,
89
          enable => enable,
90
          ciphertext => ciphertext,
91
          ready => ready
92
        );
93
 
94
   -- Clock process definitions
95
   clock_process :process
96
   begin
97
                clock <= '0';
98
                wait for clock_period/2;
99
                clock <= '1';
100
                wait for clock_period/2;
101
   end process;
102
 
103
 
104
   -- Stimulus process
105
   stim_proc: process
106
   begin
107
      -- hold reset state for 100 ns.
108
      wait for 100 ns;
109
 
110
      reset <= '1';
111
      wait for clock_period*10;
112
      reset <= '0';
113
      wait for clock_period;
114
 
115
      -- insert stimulus here 
116
      --testing for FIPS-197 specified test vectors with 128 bits key TEST PASSED
117
      keyNew <= '1';
118
      keyLoad <= '1';
119
      key <= x"0c0d0e0f";
120
      wait for clock_period;
121
      keyNew <= '0';
122
      key <= x"08090a0b";
123
      wait for clock_period;
124
      key <= x"04050607";
125
      wait for clock_period;
126
      key <= x"00010203";
127
      wait for clock_period;
128
      keyLoad <= '0';
129
      wait for clock_period*44;
130
      text <= x"00112233445566778899aabbccddeeff";
131
      wait for clock_period;
132
      enable <= '1';
133
      wait for clock_period;
134
      enable <= '0';
135
      wait for clock_period*44;
136
 
137
      --testing for FIPS-197 specified test vectors with 192 bits key TEST PASSED
138
      keyNew <= '1';
139
      keyLoad <= '1';
140
      key <= x"14151617";
141
      wait for clock_period;
142
      keyNew <= '0';
143
      key <= x"10111213";
144
      wait for clock_period;
145
      key <= x"0c0d0e0f";
146
      wait for clock_period;
147
      key <= x"08090a0b";
148
      wait for clock_period;
149
      key <= x"04050607";
150
      wait for clock_period;
151
      key <= x"00010203";
152
      wait for clock_period;
153
      keyLoad <= '0';
154
      wait for clock_period*52;
155
      text <= x"00112233445566778899aabbccddeeff";
156
      wait for clock_period;
157
      enable <= '1';
158
      wait for clock_period;
159
      enable <= '0';
160
      wait for clock_period*100;
161
 
162
      --testing for FIPS-197 specified test vectors with 256 bits key TEST PASSED
163
      keyNew <= '1';
164
      keyLoad <= '1';
165
      key <= x"1c1d1e1f";
166
      wait for clock_period;
167
      keyNew <= '0';
168
      key <= x"18191a1b";
169
      wait for clock_period;
170
      key <= x"14151617";
171
      wait for clock_period;
172
      key <= x"10111213";
173
      wait for clock_period;
174
      key <= x"0c0d0e0f";
175
      wait for clock_period;
176
      key <= x"08090a0b";
177
      wait for clock_period;
178
      key <= x"04050607";
179
      wait for clock_period;
180
      key <= x"00010203";
181
      wait for clock_period;
182
      keyLoad <= '0';
183
      wait for clock_period*60;
184
      text <= x"00112233445566778899aabbccddeeff";
185
      wait for clock_period;
186
      enable <= '1';
187
      wait for clock_period;
188
      enable <= '0';
189
      wait for clock_period*100;
190
 
191
      --key:                  0123456789abcdef0123456789abcdef
192
      --text0:                12300000000000000000000000000000
193
      --expected ciphertext0: a090f740e440bd3ca1225646926784f5 TEST PASSED
194
      --text1:                45600000000000000000000000000000
195
      --expected ciphertext1: ee6a61afb526be826365dd4bf809462d TEST PASSED
196
      --text2:                78900000000000000000000000000000    
197
      --expected ciphertext2: 1fa44b5078cfcb7de28018075a9b4e9f TEST PASSED
198
      --text3:                abc00000000000000000000000000000
199
      --expected ciphertext3: 5da0d16aba72dd33e973d95337f2e88d TEST PASSED
200
      keyNew <= '1';
201
      keyLoad <= '1';
202
      key <= x"89abcdef";
203
      wait for clock_period;
204
      keyNew <= '0';
205
      key <= x"01234567";
206
      wait for clock_period;
207
      key <= x"89abcdef";
208
      wait for clock_period;
209
      key <= x"01234567";
210
      wait for clock_period;
211
      keyLoad <= '0';
212
      wait for clock_period*44;
213
      text <= x"12300000000000000000000000000000";
214
      enable <= '1';
215
      wait for clock_period;
216
      text <= x"45600000000000000000000000000000";
217
      wait for clock_period;
218
      text <= x"78900000000000000000000000000000";
219
      wait for clock_period;
220
      text <= x"abc00000000000000000000000000000";
221
      wait for clock_period;
222
      enable <= '0';
223
      wait for clock_period*44;
224
 
225
      --key:                  0123456789abcdef0123456789abcdef
226
      --text4:                def00000000000000000000000000000
227
      --expected ciphertext4: 1499e53e8b0105164d61665d793bd665 TEST PASSED
228
      text <= x"def00000000000000000000000000000";
229
      enable <= '1';
230
      wait for clock_period;
231
      enable <= '0';
232
      wait for clock_period;
233
      text <= x"12300000000000000000000000000000";
234
      enable <= '1';
235
      wait for clock_period;
236
      enable <= '0';
237
      wait for clock_period*44;
238
 
239
      wait;
240
   end process;
241
 
242
END;

powered by: WebSVN 2.1.0

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