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

Subversion Repositories hight

[/] [hight/] [trunk/] [testbench/] [tb_WF.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 truemind
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  Testbench of whitening function for HIGHT Crypto Core       ////
4
////                                                              ////
5
////  This file is part of the HIGHT Crypto Core project          ////
6
////  http://github.com/OpenSoCPlus/hight_crypto_core             ////
7
////  http://www.opencores.org/project,hight                      ////
8
////                                                              ////
9
////  Description                                                 ////
10
////  __description__                                             ////
11
////                                                              ////
12
////  Author(s):                                                  ////
13
////      - JoonSoo Ha, json.ha@gmail.com                         ////
14
////      - Younjoo Kim, younjookim.kr@gmail.com                  ////
15
////                                                              ////
16
//////////////////////////////////////////////////////////////////////
17
////                                                              ////
18
//// Copyright (C) 2015 Authors, OpenSoCPlus and OPENCORES.ORG    ////
19
////                                                              ////
20
//// This source file may be used and distributed without         ////
21
//// restriction provided that this copyright statement is not    ////
22
//// removed from the file and that any derivative work contains  ////
23
//// the original copyright notice and the associated disclaimer. ////
24
////                                                              ////
25
//// This source file is free software; you can redistribute it   ////
26
//// and/or modify it under the terms of the GNU Lesser General   ////
27
//// Public License as published by the Free Software Foundation; ////
28
//// either version 2.1 of the License, or (at your option) any   ////
29
//// later version.                                               ////
30
////                                                              ////
31
//// This source is distributed in the hope that it will be       ////
32
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
33
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
34
//// PURPOSE.  See the GNU Lesser General Public License for more ////
35
//// details.                                                     ////
36
////                                                              ////
37
//// You should have received a copy of the GNU Lesser General    ////
38
//// Public License along with this source; if not, download it   ////
39
//// from http://www.opencores.org/lgpl.shtml                     ////
40
////                                                              ////
41
//////////////////////////////////////////////////////////////////////
42
 
43
`timescale 1ns/1ps
44
 
45
module tb_WF;
46
 
47
 
48
//=====================================
49
//
50
//          PARAMETERS 
51
//
52
//=====================================
53
 
54
 
55
//=====================================
56
//
57
//          I/O PORTS 
58
//
59
//=====================================
60
 
61
reg        i_op           ;
62
reg[63:0]  i_wf_in        ;
63
reg[31:0]  i_wk           ;
64
 
65
wire[63:0] o_wf_out       ;
66
 
67
//=====================================
68
//
69
//          
70
//
71
//=====================================
72
// uud0
73
WF uut0_WF(
74
     .i_op    (i_op    ),
75
     .i_wf_in (i_wf_in ),
76
     .i_wk    (i_wk    ),
77
 
78
         .o_wf_out(o_wf_out)
79
);
80
 
81
 
82
 
83
//=====================================
84
//
85
//          STIMULUS
86
//
87
//=====================================
88
 
89
 
90
// stimulus
91
integer i;
92
initial begin
93
        #1000;
94
 
95
 
96
        $display("//===============================//");
97
        $display("//========= SIM START ===========//");
98
        $display("//===============================//");
99
        $display("********** Test vectors 1 *********");
100
       i_op = 1'b0;
101
       i_wf_in = 64'h00_00_00_00_00_00_00_00 ;
102
       i_wk = 32'h00_11_22_33 ;
103
        #50;
104
     $display ("Encryption(I)   : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h0000001100220033) ? "Correct" : "Wrong", o_wf_out );
105
        #50;
106
 
107
       i_op = 1'b0;
108
           i_wf_in = 64'h00_38_18_d1_d9_a1_03_f3;
109
       i_wk = 32'hcc_dd_ee_ff;
110
        #50;
111
     $display ("Encryption(F)   : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h00f418aed94f03f2) ? "Correct" : "Wrong", o_wf_out );
112
        #50;
113
 
114
       i_op = 1'b1;
115
       i_wf_in = 64'h00_f4_18_ae_d9_4f_03_f2 ;
116
       i_wk = 32'hcc_dd_ee_ff ;
117
        #50;
118
         $display ("Decryption (F-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h003818d1d9a103f3) ? "Correct" : "Wrong", o_wf_out);
119
        #50;
120
 
121
           i_op = 1'b1;
122
           i_wf_in = 64'h00_00_00_11_00_22_00_33;
123
       i_wk = 32'h00_11_22_33;
124
        #50;
125
         $display ("Decryption (I-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h0000000000000000) ? "Correct" : "Wrong", o_wf_out);
126
        #50;
127
 
128
 
129
 
130
 
131
        $display("********** Test vectors 2 *********");
132
       i_op = 1'b0;
133
       i_wf_in = 64'h00_11_22_33_44_55_66_77 ;
134
       i_wk = 32'hff_ee_dd_cc ;
135
        #50;
136
     $display ("Encryption(I)  : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h00ee222144886643) ? "Correct" : "Wrong", o_wf_out);
137
        #50;
138
 
139
       i_op = 1'b0;
140
           i_wf_in = 64'h23_fd_9f_50_e5_52_e6_d8;
141
       i_wk = 32'h33_22_11_00;
142
        #50;
143
     $display ("Encryption(F)  : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h23ce9f72e543e6d8) ? "Correct" : "Wrong", o_wf_out);
144
        #50;
145
 
146
       i_op = 1'b1;
147
       i_wf_in = 64'h23_ce_9f_72_e5_43_e6_d8 ;
148
       i_wk = 32'h33_22_11_00 ;
149
        #50;
150
         $display ("Decryption(F-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h23fd9f50e552e6d8) ? "Correct" : "Wrong", o_wf_out);
151
        #50;
152
 
153
           i_op = 1'b1;
154
           i_wf_in = 64'h00_ee_22_21_44_88_66_43;
155
       i_wk = 32'hff_ee_dd_cc;
156
        #50;
157
         $display ("Decryption(I-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h0011223344556677) ? "Correct" : "Wrong", o_wf_out);
158
        #50;
159
 
160
 
161
 
162
 
163
        $display("********** Test vectors 3 *********");
164
       i_op = 1'b0;
165
       i_wf_in = 64'h01_23_45_67_89_ab_cd_ef ;
166
       i_wk = 32'h00_01_02_03 ;
167
        #50;
168
     $display ("Encryption(I) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h0123456889a9cdf2) ? "Correct" : "Wrong", o_wf_out);
169
        #50;
170
 
171
       i_op = 1'b0;
172
           i_wf_in = 64'h7a_63_b2_95_8d_2d_f4_57;
173
       i_wk = 32'h0c_0d_0e_0f;
174
        #50;
175
     $display ("Encryption(F) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'h7a6fb2a28d23f466) ? "Correct" : "Wrong", o_wf_out);
176
        #50;
177
 
178
       i_op = 1'b1;
179
       i_wf_in = 64'h7a_6f_b2_a2_8d_23_f4_66 ;
180
       i_wk = 32'h0c_0d_0e_0f ;
181
        #50;
182
         $display ("Decryption(F-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h7a63b2958d2df457) ? "Correct" : "Wrong", o_wf_out);
183
        #50;
184
 
185
           i_op = 1'b1;
186
           i_wf_in = 64'h01_23_45_68_89_a9_cd_f2;
187
       i_wk = 32'h00_01_02_03;
188
        #50;
189
         $display ("Decryption(I-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'h0123456789abcdef) ? "Correct" : "Wrong", o_wf_out);
190
        #50;
191
 
192
 
193
 
194
 
195
        $display("********** Test vectors 4 *********");
196
       i_op = 1'b0;
197
       i_wf_in = 64'hb4_1e_6b_e2_eb_a8_4a_14 ;
198
       i_wk = 32'h28_db_c3_bc ;
199
        #50;
200
     $display ("Encryption(I) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'hb4366bbdeb6b4ad0) ? "Correct" : "Wrong", o_wf_out);
201
        #50;
202
 
203
       i_op = 1'b0;
204
           i_wf_in = 64'hcc_19_7a_33_20_b7_1f_df;
205
       i_wk = 32'h1d_42_2b_e7;
206
        #50;
207
     $display ("Encryption(F) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h" , i_wf_in, i_wk, (o_wf_out == 64'hcc047a75209c1fc6) ? "Correct" : "Wrong", o_wf_out);
208
        #50;
209
 
210
       i_op = 1'b1;
211
       i_wf_in = 64'hcc_04_7a_75_20_9c_1f_c6 ;
212
       i_wk = 32'h1d_42_2b_e7 ;
213
        #50;
214
         $display ("Decryption(F-) : i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'hcc197a3320b71fdf) ? "Correct" : "Wrong", o_wf_out);
215
        #50;
216
 
217
           i_op = 1'b1;
218
           i_wf_in = 64'hb4_36_6b_bd_eb_6b_4a_d0;
219
       i_wk = 32'h28_db_c3_bc;
220
        #50;
221
         $display ("Decryption(I-): i_wf_in = %16h, i_wk = %8h ==> o_wf_out (%s) = %16h ", i_wf_in, i_wk, (o_wf_out == 64'hb41e6be2eba84a14) ? "Correct" : "Wrong", o_wf_out);
222
        #50;
223
 
224
 
225
 
226
 
227
        $display("========== SIM END ==========");
228
        $finish;
229
        end
230
 
231
// vcd dump
232
initial begin
233
        $dumpfile("dump/sim_tb_WF.vcd");
234
        $dumpvars(0, tb_WF);
235
end
236
 
237
 
238
endmodule
239
 

powered by: WebSVN 2.1.0

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