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

Subversion Repositories simon_core

[/] [simon_core/] [codes/] [Simon_bit_serial_testbench.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 aydinay
`timescale 1ns / 1ps
2
 
3
////////////////////////////////////////////////////////////////////////////////
4
// Team: Virginia Tech Secure Embedded Systems (SES) Lab 
5
// Implementer: Ege Gulcan
6
//
7
// Create Date:   19:49:46 11/13/2013
8
// Design Name:   top_module
9
// Module Name:   top_module_test.v
10
// Project Name:  SIMON
11
// Target Device:  
12
// Tool versions:  
13
// Description: 
14
//
15
// Verilog Test Fixture created by ISE for module: top_module
16
//
17
// Dependencies:
18
// 
19
// Revision:
20
// Revision 0.01 - File Created
21
// Additional Comments:
22
// 
23
////////////////////////////////////////////////////////////////////////////////
24
 
25
module top_module_test;
26
 
27
        // Inputs
28
        reg clk;
29
        reg data_in;
30
        reg [1:0] data_rdy;
31
 
32
        // Outputs
33
        wire cipher_out;
34
 
35
        // Plaintext and key from the NSA Simon and Speck paper
36
        reg [127:0] plaintext = 128'h63736564207372656c6c657661727420;
37
        reg [127:0] key = 128'h0f0e0d0c0b0a09080706050403020100;
38
 
39
        integer i;
40
 
41
        // Instantiate the Unit Under Test (UUT)
42
        top_module uut (
43
                .clk(clk),
44
                .data_in(data_in),
45
                .data_rdy(data_rdy),
46
                .cipher_out(cipher_out)
47
        );
48
 
49
        initial begin
50
                // Initialize Inputs
51
                clk = 0;
52
                data_in = 0;
53
                data_rdy = 0;
54
 
55
                #110;
56
                #5;
57
                //Set data_rdy=1 to load plaintext
58
                data_rdy=1;
59
 
60
                //Loads the plaintext one bit per clock cycle for 128 cycles
61
                for(i=0;i<128;i = i+1)
62
                begin
63
                        data_in = plaintext[i];
64
                        #20;
65
                end
66
 
67
                //Set data_rdy=2 to load key
68
                data_rdy = 2;
69
 
70
                //Loads the key one bit per clock cycle for 128 cycles
71
                for(i=0;i<128;i = i+1)
72
                begin
73
                        data_in = key[i];
74
                        #20;
75
                end
76
                //Set data_rdy=0 after loading is done
77
                data_rdy = 0;
78
                #20;
79
 
80
                //Keep data_rdy=3 while the cipher is running
81
                data_rdy = 3;
82
 
83
 
84
        end
85
 
86
 
87
 
88
        always #10 clk = ~clk;
89
 
90
 
91
 
92
endmodule
93
 

powered by: WebSVN 2.1.0

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