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

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [testbench/] [aes_tb_vpi.v] - Blame information for rev 6

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

Line No. Rev Author Line
1 4 redbear
//////////////////////////////////////////////////////////////////
2
////
3
////
4
////    AES CORE BLOCK
5
////
6
////
7
////
8
//// This file is part of the APB to AES128 project
9
////
10
//// http://www.opencores.org/cores/apbtoaes128/
11
////
12
////
13
////
14
//// Description
15
////
16
//// Implementation of APB IP core according to
17
////
18
//// aes128_spec IP core specification document.
19
////
20
////
21
////
22
//// To Do: Things are right here but always all block can suffer changes
23
////
24
////
25
////
26
////
27
////
28
//// Author(s): - Felipe Fernandes Da Costa, fefe2560@gmail.com
29
////
30
///////////////////////////////////////////////////////////////// 
31
////
32
////
33
//// Copyright (C) 2009 Authors and OPENCORES.ORG
34
////
35
////
36
////
37
//// This source file may be used and distributed without
38
////
39
//// restriction provided that this copyright statement is not
40
////
41
//// removed from the file and that any derivative work contains
42
//// the original copyright notice and the associated disclaimer.
43
////
44
////
45
//// This source file is free software; you can redistribute it
46
////
47
//// and/or modify it under the terms of the GNU Lesser General
48
////
49
//// Public License as published by the Free Software Foundation;
50
//// either version 2.1 of the License, or (at your option) any
51
////
52
//// later version.
53
////
54
////
55
////
56
//// This source is distributed in the hope that it will be
57
////
58
//// useful, but WITHOUT ANY WARRANTY; without even the implied
59
////
60
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
61
////
62
//// PURPOSE. See the GNU Lesser General Public License for more
63
//// details.
64
////
65
////
66
////
67
//// You should have received a copy of the GNU Lesser General
68
////
69
//// Public License along with this source; if not, download it
70
////
71
//// from http://www.opencores.org/lgpl.shtml
72
////
73
////
74
///////////////////////////////////////////////////////////////////
75
module AES_GLADIC_tb;
76
 
77
 
78
        reg PCLK;
79
        wire PRESETn;
80
        wire PSEL;
81
        wire PENABLE;
82
        wire PWRITE;
83
 
84
        wire [31:0] PWDATA;
85
        wire [31:0] PADDR;
86
        wire [31:0] PRDATA;
87
 
88
 
89
        wire PREADY;
90
        wire PSLVERR;
91
 
92
        wire int_ccf;
93
        wire int_err;
94
        wire dma_req_wr;
95
        wire dma_req_rd;
96
 
97
 
98
        wire [3:0] core_addr;
99
 
100
        assign core_addr = PADDR[5:2];
101
 
102
        aes_ip  DUT (
103
 
104
                .PCLK (PCLK),
105
                .PRESETn (PRESETn),
106
                .PENABLE (PENABLE),
107
                .PSEL (PSEL),
108
                .PWDATA (PWDATA),
109
                .PADDR (core_addr),
110
                .PWRITE(PWRITE),
111
                .PRDATA (PRDATA),
112
                .PREADY (PREADY),
113
                .PSLVERR (PSLVERR),
114
                .int_ccf(int_ccf),
115
                .int_err(int_err),
116
                .dma_req_wr(dma_req_wr),
117
                .dma_req_rd(dma_req_rd)
118
        );
119
 
120
        integer i;
121
 
122
        initial
123
         begin
124
            $dumpfile("AES_GLADIC_tb.vcd");
125
            $dumpvars(0,AES_GLADIC_tb);
126
            $init;
127
            $init_reset;
128
         end
129
 
130
        initial PCLK = 1'b0;
131
        always #(5) PCLK = ~PCLK;
132
 
133 6 redbear
        //ECB
134 4 redbear
        always@(posedge PCLK)
135
                $bfm_encryption_ecb_aes128;
136
 
137
        always@(posedge PCLK)
138
                $bfm_encryption_ecb_dma_aes128;
139
 
140
        always@(posedge PCLK)
141
                $bfm_encryption_ccfie_ecb_aes128;
142
 
143 6 redbear
        //CBC
144 4 redbear
        always@(posedge PCLK)
145 6 redbear
                $bfm_encryption_cbc_aes128;
146
 
147
        always@(posedge PCLK)
148
                $bfm_encryption_cbc_dma_aes128;
149
 
150
        always@(posedge PCLK)
151
                $bfm_encryption_ccfie_cbc_aes128;
152
 
153
        //CTR
154
        always@(posedge PCLK)
155
                $bfm_encryption_ctr_aes128;
156
 
157
        always@(posedge PCLK)
158
                $bfm_encryption_ctr_dma_aes128;
159
 
160
        always@(posedge PCLK)
161
                $bfm_encryption_ccfie_ctr_aes128;
162
 
163
 
164
        //ECB
165
        always@(posedge PCLK)
166 4 redbear
                $bfm_key_generation_ecb_aes128;
167
 
168
        always@(posedge PCLK)
169
                $bfm_key_generation_dma_ecb_aes128;
170
 
171
        always@(posedge PCLK)
172
                $bfm_key_generation_ccfie_ecb_aes128;
173
 
174 6 redbear
        //CBC
175 4 redbear
        always@(posedge PCLK)
176 6 redbear
                $bfm_key_generation_cbc_aes128;
177
 
178
        always@(posedge PCLK)
179
                $bfm_key_generation_dma_cbc_aes128;
180
 
181
        always@(posedge PCLK)
182
                $bfm_key_generation_ccfie_cbc_aes128;
183
 
184
        //CTR
185
        always@(posedge PCLK)
186
                $bfm_key_generation_ctr_aes128;
187
 
188
        always@(posedge PCLK)
189
                $bfm_key_generation_dma_ctr_aes128;
190
 
191
        always@(posedge PCLK)
192
                $bfm_key_generation_ccfie_ctr_aes128;
193
 
194
        //ECB
195
        always@(posedge PCLK)
196 4 redbear
                $bfm_decryption_ecb_aes128;
197
 
198
        always@(posedge PCLK)
199
                $bfm_decryption_ecb_dma_aes128;
200
 
201
        always@(posedge PCLK)
202
                $bfm_decryption_ccfie_ecb_aes128;
203
 
204 6 redbear
        //CBC
205 4 redbear
        always@(posedge PCLK)
206 6 redbear
                $bfm_decryption_cbc_aes128;
207
 
208
        always@(posedge PCLK)
209
                $bfm_decryption_cbc_dma_aes128;
210
 
211
        always@(posedge PCLK)
212
                $bfm_decryption_ccfie_cbc_aes128;
213
 
214
        //CTR
215
        always@(posedge PCLK)
216
                $bfm_decryption_ctr_aes128;
217
 
218
        always@(posedge PCLK)
219
                $bfm_decryption_ctr_dma_aes128;
220
 
221
        always@(posedge PCLK)
222
                $bfm_decryption_ccfie_ctr_aes128;
223
 
224
        //ECB
225
        always@(posedge PCLK)
226 4 redbear
                $bfm_derivation_decryption_ecb_aes128;
227
 
228
        always@(posedge PCLK)
229
                $bfm_derivation_decryption_dma_ecb_aes128;
230
 
231
        always@(posedge PCLK)
232
                $bfm_derivation_decryption_ccfie_ecb_aes128;
233
 
234 6 redbear
        //CTR
235
        always@(posedge PCLK)
236
                $bfm_derivation_decryption_ctr_aes128;
237
 
238
        always@(posedge PCLK)
239
                $bfm_derivation_decryption_dma_ctr_aes128;
240
 
241
        always@(posedge PCLK)
242
                $bfm_derivation_decryption_ccfie_ctr_aes128;
243
 
244
        //CBC
245
        always@(posedge PCLK)
246
                $bfm_derivation_decryption_cbc_aes128;
247
 
248
        always@(posedge PCLK)
249
                $bfm_derivation_decryption_dma_cbc_aes128;
250
 
251
        always@(posedge PCLK)
252
                $bfm_derivation_decryption_ccfie_cbc_aes128;
253
 
254 4 redbear
        //
255
        always@(posedge PCLK)
256
                $bfm_wr_aes128;
257
 
258
        always@(posedge PCLK)
259
                $bfm_wr_error_dinr_aes128;
260
 
261
        always@(posedge PCLK)
262
                $bfm_wr_error_doutr_aes128;
263
 
264
        //
265
        always@(posedge PCLK)
266
                $bfm_generate_type;
267
 
268
        //
269
        always@(posedge PCLK)
270
                $reset_aes128;
271
 
272
        //
273
        always@(posedge PCLK)
274
                $monitor_aes;
275
 
276
        //
277
        always@(negedge PRESETn)
278
                $init;
279
 
280
        always@(posedge PCLK)
281
        begin
282
                while( i != 1)
283
                begin
284
                        @(posedge PCLK);
285
                end
286
                $finish();
287
        end
288
 
289
 
290
 
291
endmodule

powered by: WebSVN 2.1.0

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