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

Subversion Repositories tiny_aes

[/] [tiny_aes/] [trunk/] [testbench/] [test_aes_128.v] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 homer.hsin
/*
2
 * Copyright 2012, Homer Hsing <homer.hsing@gmail.com>
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
 
17
`timescale 1ns / 1ps
18
 
19
module test_aes_128;
20
 
21
        // Inputs
22
        reg clk;
23
        reg [127:0] state;
24
        reg [127:0] key;
25
 
26
        // Outputs
27
        wire [127:0] out;
28
 
29
        // Instantiate the Unit Under Test (UUT)
30
        aes_128 uut (
31
                .clk(clk),
32
                .state(state),
33
                .key(key),
34
                .out(out)
35
        );
36
 
37
        initial begin
38
                clk = 0;
39
                state = 0;
40
                key = 0;
41
 
42
                #100;
43
        @ (negedge clk);
44
        state = 128'h3243f6a8_885a308d_313198a2_e0370734;
45
        key   = 128'h2b7e1516_28aed2a6_abf71588_09cf4f3c;
46
        #10;
47
        state = 128'h00112233_44556677_8899aabb_ccddeeff;
48
        key   = 128'h00010203_04050607_08090a0b_0c0d0e0f;
49
        #10;
50
        state = 128'h0;
51
        key   = 128'h0;
52
        #10;
53
        state = 128'h0;
54
        key   = 128'h1;
55
        #10;
56
        state = 128'h1;
57
        key   = 128'h0;
58
        #170;
59
        if (out !== 128'h3925841d02dc09fbdc118597196a0b32)
60
          begin $display("E"); $finish; end
61
        #10;
62
        if (out !== 128'h69_c4_e0_d8_6a_7b_04_30_d8_cd_b7_80_70_b4_c5_5a)
63
          begin $display("E"); $finish; end
64
        #10;
65
        if (out !== 128'h66_e9_4b_d4_ef_8a_2c_3b_88_4c_fa_59_ca_34_2b_2e)
66
          begin $display("E"); $finish; end
67
        #10;
68
        if (out !== 128'h05_45_aa_d5_6d_a2_a9_7c_36_63_d1_43_2a_3d_1c_84)
69
          begin $display("E"); $finish; end
70
        #10;
71
        if (out !== 128'h58_e2_fc_ce_fa_7e_30_61_36_7f_1d_57_a4_e7_45_5a)
72
          begin $display("E"); $finish; end
73
        $display("Good.");
74
        $finish;
75
        end
76
 
77
    always #5 clk = ~clk;
78
endmodule
79
 

powered by: WebSVN 2.1.0

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