OpenCores
URL https://opencores.org/ocsvn/aes-encryption/aes-encryption/trunk

Subversion Repositories aes-encryption

[/] [aes-encryption/] [trunk/] [aes_1cycle_1stage/] [test_bench_top.v] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 tariq786
/////////////////////////////////////////////////////////////////////
2
////                                                             ////
3
////     Test Bench for 1 cycle AES128-ENC                       ////
4
////                                                             ////
5
////                                                             ////
6
////  Author: Tariq Bashir Ahmad                                 ////
7
////          tariq.bashir@gmail.com                             ////
8
////                                                             ////
9
////  Downloaded from: http://www.opencores.org/                 ////
10
////                                                             ////
11
/////////////////////////////////////////////////////////////////////
12
////                                                             ////
13
//// Copyright (C) 2010          Tariq Bashir Ahmad              ////   
14
////                         http://www.ecs.umass.edu/~tbashir   ////
15
////                                                             ////
16
////                                                             ////
17
//// This source file may be used and distributed without        ////
18
//// restriction provided that this copyright statement is not   ////
19
//// removed from the file and that any derivative work contains ////
20
//// the original copyright notice and the associated disclaimer.////
21
////                                                             ////
22
////     THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY     ////
23
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   ////
24
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS   ////
25
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR      ////
26
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,         ////
27
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    ////
28
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE   ////
29
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR        ////
30
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  ////
31
//// LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT  ////
32
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT  ////
33
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE         ////
34
//// POSSIBILITY OF SUCH DAMAGE.                                 ////
35
////                                                             ////
36
/////////////////////////////////////////////////////////////////////
37
 
38
 
39
`timescale 1 ns/1 ps
40
 
41
module test;
42
 
43
reg             clk;
44
reg             rst;
45
reg      aes_en;
46
reg             kld;
47
reg     [127:0]  key;
48
reg     [127:0]  text_in;
49
 
50
wire    [127:0]  text_out;
51
wire            done;
52
 
53
 
54
initial
55
   begin
56
 
57
        clk <=  0;
58
        repeat(1) @(posedge clk);
59
        rst <=  1;
60
        aes_en <=  1;
61
        repeat(200) @(posedge clk);
62
        rst <=  0;
63
        repeat(1) @(posedge clk);
64
        kld             <= #1 1;
65
//      repeat(1) @(posedge clk);
66
        key             <=  128'h0;
67
        text_in  <=  128'h00112233445566778899aabbccddeeff;
68
        repeat(2) @(posedge clk);            //you need 2 cycles after loading the key and input
69
        kld  <= #1 0;
70
        repeat(20) @(posedge clk);
71
        aes_en <=  0;
72
        end
73
 
74
aes_cipher_top uut(
75
        .clk(           clk             ),
76
        .rst(           rst             ),
77
        .ld(            kld             ),
78
        .done(          done            ),
79
        .key(           key             ),
80
        .text_in(       text_in         ),
81
        .text_out(      text_out        ),
82
        .aes_en(aes_en)
83
        );
84
 
85
 
86
 
87
 
88
initial
89
        forever #15 clk = ~clk;
90
 
91
initial
92
        #2050 $stop;
93
 
94
initial
95
                $monitor($time," TEXT_OUT is %h, DONE is %b\n",text_out,done);
96
 
97
endmodule
98
 
99
 

powered by: WebSVN 2.1.0

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