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 11

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 9 homer.hsin
        /*
44
         * TIMEGRP "key" OFFSET = IN 6.4 ns VALID 6 ns AFTER "clk" HIGH;
45
         * TIMEGRP "state" OFFSET = IN 6.4 ns VALID 6 ns AFTER "clk" HIGH;
46
         * TIMEGRP "out" OFFSET = OUT 2.2 ns BEFORE "clk" HIGH;
47
         */
48 2 homer.hsin
        @ (negedge clk);
49 9 homer.hsin
        # 2;
50 2 homer.hsin
        state = 128'h3243f6a8_885a308d_313198a2_e0370734;
51
        key   = 128'h2b7e1516_28aed2a6_abf71588_09cf4f3c;
52
        #10;
53
        state = 128'h00112233_44556677_8899aabb_ccddeeff;
54
        key   = 128'h00010203_04050607_08090a0b_0c0d0e0f;
55
        #10;
56
        state = 128'h0;
57
        key   = 128'h0;
58
        #10;
59
        state = 128'h0;
60
        key   = 128'h1;
61
        #10;
62
        state = 128'h1;
63
        key   = 128'h0;
64
        #170;
65
        if (out !== 128'h3925841d02dc09fbdc118597196a0b32)
66
          begin $display("E"); $finish; end
67
        #10;
68
        if (out !== 128'h69_c4_e0_d8_6a_7b_04_30_d8_cd_b7_80_70_b4_c5_5a)
69
          begin $display("E"); $finish; end
70
        #10;
71
        if (out !== 128'h66_e9_4b_d4_ef_8a_2c_3b_88_4c_fa_59_ca_34_2b_2e)
72
          begin $display("E"); $finish; end
73
        #10;
74
        if (out !== 128'h05_45_aa_d5_6d_a2_a9_7c_36_63_d1_43_2a_3d_1c_84)
75
          begin $display("E"); $finish; end
76
        #10;
77
        if (out !== 128'h58_e2_fc_ce_fa_7e_30_61_36_7f_1d_57_a4_e7_45_5a)
78
          begin $display("E"); $finish; end
79
        $display("Good.");
80
        $finish;
81
        end
82
 
83
    always #5 clk = ~clk;
84
endmodule
85
 

powered by: WebSVN 2.1.0

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