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

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [pli/] [env_aes.c] - Blame information for rev 11

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
 
76
#include "../../iverilog/vpi_user.h"
77
//#include <vpi_user.h>
78
#include <iostream>
79
#include <random>
80 9 redbear
#include<string.h>
81 4 redbear
 
82
 
83
s_vpi_value v_generate;
84
 
85
s_vpi_value v_ecb;
86
s_vpi_time  t_ecb;
87
 
88 9 redbear
s_vpi_value v_monitor;
89
s_vpi_value v_monitor_catch;
90
 
91
s_vpi_time  t_monitor;
92
 
93 4 redbear
s_vpi_value v_wr;
94
s_vpi_time  t_wr;
95
 
96
s_vpi_value v_reset;
97
s_vpi_time  t_reset;
98
 
99
 
100
s_vpi_value v_initial;
101
s_vpi_time  t_initial;
102
 
103 9 redbear
//USED BY BFM ONLY
104 4 redbear
unsigned long  int a;
105
unsigned long  int b;
106
unsigned long  int c;
107
unsigned long  int d;
108
 
109 9 redbear
 
110
//USED BY MONITOR ONLY
111
unsigned long  int A;
112
unsigned long  int B;
113
unsigned long  int C;
114
unsigned long  int D;
115
 
116
 
117
unsigned long  int E;
118
unsigned long  int F;
119
unsigned long  int G;
120
unsigned long  int H;
121
 
122
unsigned long  int I;
123
 
124
unsigned long  int J;
125
unsigned long  int L;
126
unsigned long  int M;
127
unsigned long  int N;
128
 
129 4 redbear
int type_bfm;
130
 
131
int STATE;
132
int STATE_RESET;
133
 
134
int counter;
135 9 redbear
int counter_monitor;
136
int cycle_counter;
137 4 redbear
 
138 9 redbear
 
139 4 redbear
int flag;
140
 
141
int reset_counter;
142
int counter_reset_enter;
143
int counter_reset_wait;
144
int FIPS_ENABLE;
145
 
146
int RESET_GENERATED;
147
int PACKETS_GENERATED;
148
 
149
int counter_write;
150
int counter_read;
151
int counter_wait;
152
 
153
/*AES REGISTERS*/
154
#define ADDR_AES_CR 0
155
#define ADDR_AES_SR 4
156
#define ADDR_AES_DINR 8
157
 
158
#define ADDR_AES_DOUTR 12
159
#define ADDR_AES_KEYR0 16
160
#define ADDR_AES_KEYR1 20
161
#define ADDR_AES_KEYR2 24
162
#define ADDR_AES_KEYR3 28
163
 
164
#define ADDR_AES_IVR0 32
165
#define ADDR_AES_IVR1 36
166
#define ADDR_AES_IVR2 40
167
#define ADDR_AES_IVR3 44
168
 
169
int vector_address[11];
170
 
171
/*STATE MACHINE TO WORK WITH BFM*/
172
#define IDLE           0
173
#define WRITE          1
174
#define WAIT           2
175
#define READ_RESULTS   3
176
 
177
#define WRITE_DINR     4
178
#define READ_DOUTR     5
179
#define WAIT_SR        6
180
#define RESET_SR       7 
181
#define READ_KEY_GEN   8
182
 
183
 
184
/*STATE MACHINE TO WORK WITH BFM RESET*/
185
#define ENTER_RESET    9
186
#define WAIT_RESET    10
187
#define GET_OUT_RESET 11
188
 
189
 
190
#define AES_WR_ONLY 99
191
#define AES_WR_ERROR_DINR_ONLY 100
192
#define AES_WR_ERROR_DOUTR_ONLY 100
193
 
194
/*TEST USING NAMES TO ENABLE BFMs*/
195 5 redbear
#define ECB_ENCRYPTION                   1
196
#define ECB_DECRYPTION                   2
197
#define ECB_KEY_GEN                      3
198
#define ECB_DERIVATION_DECRYPTION        4
199 4 redbear
 
200 5 redbear
#define ECB_ENCRYPTION_DMA               5
201
#define ECB_DECRYPTION_DMA               6
202
#define ECB_KEY_GEN_DMA                  7
203
#define ECB_DERIVATION_DECRYPTION_DMA    8
204 4 redbear
 
205
#define ECB_ENCRYPTION_CCFIE             9
206
#define ECB_DECRYPTION_CCFIE            10
207
#define ECB_DERIVATION_DECRYPTION_CCFIE 11
208
#define ECB_KEY_GEN_CCFIE               12
209
 
210 5 redbear
/*TEST USING CBC*/
211
 
212
#define CBC_ENCRYPTION                  13
213
#define CBC_DECRYPTION                  14
214
#define CBC_KEY_GEN                     15
215
#define CBC_DERIVATION_DECRYPTION       16
216
 
217
#define CBC_ENCRYPTION_DMA              17
218
#define CBC_DECRYPTION_DMA              18
219
#define CBC_KEY_GEN_DMA                 19
220
#define CBC_DERIVATION_DECRYPTION_DMA   20
221
 
222
#define CBC_ENCRYPTION_CCFIE            21
223
#define CBC_DECRYPTION_CCFIE            22
224
#define CBC_DERIVATION_DECRYPTION_CCFIE 23
225
#define CBC_KEY_GEN_CCFIE               24
226
 
227
/*TEST USING CTR*/
228
#define CTR_ENCRYPTION                  25
229
#define CTR_DECRYPTION                  26
230
#define CTR_KEY_GEN                     27
231
#define CTR_DERIVATION_DECRYPTION       28
232
 
233
#define CTR_ENCRYPTION_DMA              29
234
#define CTR_DECRYPTION_DMA              30
235
#define CTR_KEY_GEN_DMA                 31
236
#define CTR_DERIVATION_DECRYPTION_DMA   32
237
 
238
#define CTR_ENCRYPTION_CCFIE            33
239
#define CTR_DECRYPTION_CCFIE            34
240
#define CTR_DERIVATION_DECRYPTION_CCFIE 35
241
#define CTR_KEY_GEN_CCFIE               36
242
 
243 4 redbear
/*TYPE CONFIGURATION USED TO INSERT DATA ON DUT*/
244
#define FIPS 0
245
#define RANDOM_DATA 1
246
 
247
 
248
/*MAX PACKETS GENERATION*/
249 9 redbear
#define MAX_ITERATIONS 5
250 4 redbear
 
251
/*MAX RESET GENERATION */
252
#define MAX_RESET_TIMES 4
253
 
254 9 redbear
/*THIS IS USED BY MONITOR TO CATCH INPUTS AND OUTPUTS*/
255
unsigned char INPUT_KEYR[16];
256
unsigned char OUTPUT_KEYR[16];
257
 
258
unsigned char INPUT_IVR[16];
259
unsigned char OUTPUT_IVR[16];
260
 
261
unsigned char INPUT_TEXT[16];
262
unsigned char OUTPUT_TEXT[16];
263
 
264
 
265 4 redbear
/*THIS INCLUDE IS USED TO GENERATE DATA DO BE INSERTED ON DUT*/
266 9 redbear
unsigned char TEXT_FIPS_NOT_DERIVATED[]     = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF};
267
unsigned char KEY_FIPS_NOT_DERIVATED[]      = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
268 4 redbear
 
269 9 redbear
unsigned char TEXT_FIPS_DERIVATED[]         = {0x69,0xC4,0xE0,0xD8,0x6A,0x7B,0x04,0x30,0xD8,0xCD,0xB7,0x80,0x70,0xB4,0xC5,0x5A};
270
unsigned char KEY_FIPS_DERIVATED[]          = {0x13,0x11,0x1D,0x7F,0xE3,0x94,0x4A,0x17,0xF3,0x07,0xA7,0x8B,0x4D,0x2B,0x30,0xC5};
271 4 redbear
 
272 5 redbear
 
273
unsigned char KEY_FIPS_CBC_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
274
unsigned char IV_FIPS_CBC_NOT_DERIVATED[]   = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
275 9 redbear
 
276
 
277 5 redbear
unsigned char TEXT_FIPS_CBC_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
278 9 redbear
unsigned char KEY_FIPS_CBC_DERIVATED[]      = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
279 5 redbear
 
280
 
281
unsigned char TEXT_CBC_FIPS_DERIVATED[]     = {0x76,0x49,0xAB,0xAC,0x81,0x19,0xB2,0x46,0xCE,0xE9,0x8E,0x9B,0x12,0xE9,0x19,0x7D};
282
 
283
 
284
unsigned char KEY_FIPS_CTR_NOT_DERIVATED[]  = {0x2B,0x7E,0x15,0x16,0x28,0xAE,0xD2,0xA6,0xAB,0xF7,0x15,0x88,0x09,0xCF,0x4F,0x3C};
285
unsigned char IV_FIPS_CTR_NOT_DERIVATED[]   = {0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF};
286
unsigned char TEXT_FIPS_CTR_NOT_DERIVATED[] = {0x6B,0xC1,0xBE,0xE2,0x2E,0x40,0x9F,0x96,0xE9,0x3D,0x7E,0x11,0x73,0x93,0x17,0x2A};
287
 
288
unsigned char TEXT_CTR_FIPS_DERIVATED[]     = {0x87,0x4D,0x61,0x91,0xB6,0x20,0xE3,0x26,0x1B,0xEF,0x68,0x64,0x99,0x0D,0xB6,0xCE};
289 9 redbear
unsigned char KEY_FIPS_CTR_DERIVATED[]  = {0xD0,0x14,0xF9,0xA8,0xC9,0xEE,0x25,0x89,0xE1,0x3F,0x0C,0xC8,0xB6,0x63,0x0C,0xA6};
290 5 redbear
 
291 9 redbear
unsigned char TEXT_NULL[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
292
 
293 4 redbear
/*BFM CONTROL FLOW*/
294
#include "aes_bfm_generate.h"
295
 
296
/*BASIC TEST WRITE READ*/
297
#include "aes_bfm_wr.h"
298
#include "bfm_error/aes_bfm_wr_error_dinr.h"
299
#include "bfm_error/aes_bfm_wr_error_doutr.h"
300
 
301
/*ECB TEST CASES*/
302
#include "bfm_ecb/aes_bfm_encryption_ecb.h"
303
#include "bfm_ecb/aes_bfm_decryption_ecb.h"
304
#include "bfm_ecb/aes_bfm_derivation_decryption_ecb.h"
305
#include "bfm_ecb/aes_bfm_key_generation_ecb.h"
306
 
307
#include "bfm_ecb/aes_bfm_decryption_dma_ecb.h"
308
#include "bfm_ecb/aes_bfm_encryption_dma_ecb.h"
309
#include "bfm_ecb/aes_bfm_key_generation_dma_ecb.h"
310
#include "bfm_ecb/aes_bfm_derivation_decryption_dma_ecb.h"
311
 
312
#include "bfm_ecb/aes_bfm_encryption_ccfie_ecb.h"
313
#include "bfm_ecb/aes_bfm_decryption_ccfie_ecb.h"
314
#include "bfm_ecb/aes_bfm_derivation_decryption_ccfie_ecb.h"
315
#include "bfm_ecb/aes_bfm_key_generation_ccfie_ecb.h"
316
 
317 5 redbear
/*CBC TEST CASES*/
318
 
319
#include "bfm_cbc/aes_bfm_encryption_cbc.h"
320
#include "bfm_cbc/aes_bfm_decryption_cbc.h"
321
#include "bfm_cbc/aes_bfm_derivation_decryption_cbc.h"
322
#include "bfm_cbc/aes_bfm_key_generation_cbc.h"
323
 
324
#include "bfm_cbc/aes_bfm_encryption_dma_cbc.h"
325
#include "bfm_cbc/aes_bfm_decryption_dma_cbc.h"
326
#include "bfm_cbc/aes_bfm_derivation_decryption_dma_cbc.h"
327
#include "bfm_cbc/aes_bfm_key_generation_dma_cbc.h"
328
 
329
#include "bfm_cbc/aes_bfm_encryption_ccfie_cbc.h"
330
#include "bfm_cbc/aes_bfm_decryption_ccfie_cbc.h"
331
#include "bfm_cbc/aes_bfm_derivation_decryption_ccfie_cbc.h"
332
#include "bfm_cbc/aes_bfm_key_generation_ccfie_cbc.h"
333
 
334
/*CTR TEST CASES*/
335
 
336
#include "bfm_ctr/aes_bfm_encryption_ctr.h"
337
#include "bfm_ctr/aes_bfm_decryption_ctr.h"
338
#include "bfm_ctr/aes_bfm_key_generation_ctr.h"
339
#include "bfm_ctr/aes_bfm_derivation_decryption_ctr.h"
340
 
341
#include "bfm_ctr/aes_bfm_encryption_dma_ctr.h"
342
#include "bfm_ctr/aes_bfm_decryption_dma_ctr.h"
343
#include "bfm_ctr/aes_bfm_key_generation_dma_ctr.h"
344
#include "bfm_ctr/aes_bfm_derivation_decryption_dma_ctr.h"
345
 
346
#include "bfm_ctr/aes_bfm_encryption_ccfie_ctr.h"
347
#include "bfm_ctr/aes_bfm_decryption_ccfie_ctr.h"
348
#include "bfm_ctr/aes_bfm_key_generation_ccfie_ctr.h"
349
#include "bfm_ctr/aes_bfm_derivation_decryption_ccfie_ctr.h"
350
 
351
/*ENV CONFIG */
352 4 redbear
#include "aes_init.h"
353
#include "aes_monitor.h"
354
#include "aes_bfm_reset.h"
355
#include "aes_init_reset.h"
356
 
357
 
358
void AES_GLADIC_register()
359
{
360
 
361
      s_vpi_systf_data tf_data;
362
 
363
      tf_data.type      = vpiSysTask;
364
      tf_data.sysfunctype = 0;
365
      tf_data.tfname    = "$bfm_generate_type";
366
      tf_data.calltf    = aes_bfm_generate_calltf;
367
      tf_data.compiletf = 0;
368
      tf_data.sizetf    = 0;
369
      tf_data.user_data = 0;
370
      vpi_register_systf(&tf_data);
371
 
372
 
373
      tf_data.type      = vpiSysTask;
374
      tf_data.sysfunctype = 0;
375
      tf_data.tfname    = "$bfm_wr_aes128";
376
      tf_data.calltf    = aes_bfm_wr_calltf;
377
      tf_data.compiletf = 0;
378
      tf_data.sizetf    = 0;
379
      tf_data.user_data = 0;
380
      vpi_register_systf(&tf_data);
381
 
382
      //DMA WITH ERROR 
383
      tf_data.type      = vpiSysTask;
384
      tf_data.sysfunctype = 0;
385
      tf_data.tfname    = "$bfm_wr_error_dinr_aes128";
386
      tf_data.calltf    = aes_bfm_wr_error_dinr_calltf;
387
      tf_data.compiletf = 0;
388
      tf_data.sizetf    = 0;
389
      tf_data.user_data = 0;
390
      vpi_register_systf(&tf_data);
391
 
392
      tf_data.type      = vpiSysTask;
393
      tf_data.sysfunctype = 0;
394
      tf_data.tfname    = "$bfm_wr_error_doutr_aes128";
395
      tf_data.calltf    = aes_bfm_wr_error_doutr_calltf;
396
      tf_data.compiletf = 0;
397
      tf_data.sizetf    = 0;
398
      tf_data.user_data = 0;
399
      vpi_register_systf(&tf_data);
400
 
401 5 redbear
      //ECB ENCRYPTION
402 4 redbear
      tf_data.type      = vpiSysTask;
403
      tf_data.sysfunctype = 0;
404
      tf_data.tfname    = "$bfm_encryption_ecb_aes128";
405
      tf_data.calltf    = aes_bfm_encryption_ecb_calltf;
406
      tf_data.compiletf = 0;
407
      tf_data.sizetf    = 0;
408
      tf_data.user_data = 0;
409
      vpi_register_systf(&tf_data);
410
 
411
      tf_data.type      = vpiSysTask;
412
      tf_data.sysfunctype = 0;
413
      tf_data.tfname    = "$bfm_encryption_ecb_dma_aes128";
414
      tf_data.calltf    =  aes_bfm_encryption_ecb_dma_calltf;
415
      tf_data.compiletf = 0;
416
      tf_data.sizetf    = 0;
417
      tf_data.user_data = 0;
418
      vpi_register_systf(&tf_data);
419
 
420
      tf_data.type      = vpiSysTask;
421
      tf_data.sysfunctype = 0;
422
      tf_data.tfname    = "$bfm_encryption_ccfie_ecb_aes128";
423
      tf_data.calltf    =  aes_bfm_encryption_ccfie_ecb_calltf;
424
      tf_data.compiletf = 0;
425
      tf_data.sizetf    = 0;
426
      tf_data.user_data = 0;
427
      vpi_register_systf(&tf_data);
428
 
429 5 redbear
      //CBC ENCRYPTION
430 4 redbear
      tf_data.type      = vpiSysTask;
431
      tf_data.sysfunctype = 0;
432 5 redbear
      tf_data.tfname    = "$bfm_encryption_cbc_aes128";
433
      tf_data.calltf    = aes_bfm_encryption_cbc_calltf;
434
      tf_data.compiletf = 0;
435
      tf_data.sizetf    = 0;
436
      tf_data.user_data = 0;
437
      vpi_register_systf(&tf_data);
438
 
439
      tf_data.type      = vpiSysTask;
440
      tf_data.sysfunctype = 0;
441
      tf_data.tfname    = "$bfm_encryption_cbc_dma_aes128";
442
      tf_data.calltf    =  aes_bfm_encryption_cbc_dma_calltf;
443
      tf_data.compiletf = 0;
444
      tf_data.sizetf    = 0;
445
      tf_data.user_data = 0;
446
      vpi_register_systf(&tf_data);
447
 
448
      tf_data.type      = vpiSysTask;
449
      tf_data.sysfunctype = 0;
450
      tf_data.tfname    = "$bfm_encryption_ccfie_cbc_aes128";
451
      tf_data.calltf    =  aes_bfm_encryption_ccfie_cbc_calltf;
452
      tf_data.compiletf = 0;
453
      tf_data.sizetf    = 0;
454
      tf_data.user_data = 0;
455
      vpi_register_systf(&tf_data);
456
 
457
      //CTR ENCRYPTION
458
      tf_data.type      = vpiSysTask;
459
      tf_data.sysfunctype = 0;
460
      tf_data.tfname    = "$bfm_encryption_ctr_aes128";
461
      tf_data.calltf    = aes_bfm_encryption_ctr_calltf;
462
      tf_data.compiletf = 0;
463
      tf_data.sizetf    = 0;
464
      tf_data.user_data = 0;
465
      vpi_register_systf(&tf_data);
466
 
467
      tf_data.type      = vpiSysTask;
468
      tf_data.sysfunctype = 0;
469
      tf_data.tfname    = "$bfm_encryption_ctr_dma_aes128";
470
      tf_data.calltf    =  aes_bfm_encryption_ctr_dma_calltf;
471
      tf_data.compiletf = 0;
472
      tf_data.sizetf    = 0;
473
      tf_data.user_data = 0;
474
      vpi_register_systf(&tf_data);
475
 
476
      tf_data.type      = vpiSysTask;
477
      tf_data.sysfunctype = 0;
478
      tf_data.tfname    = "$bfm_encryption_ccfie_ctr_aes128";
479
      tf_data.calltf    =  aes_bfm_encryption_ccfie_ctr_calltf;
480
      tf_data.compiletf = 0;
481
      tf_data.sizetf    = 0;
482
      tf_data.user_data = 0;
483
      vpi_register_systf(&tf_data);
484
 
485
      //ECB DECRYPTION
486
      tf_data.type      = vpiSysTask;
487
      tf_data.sysfunctype = 0;
488 4 redbear
      tf_data.tfname    = "$bfm_decryption_ecb_aes128";
489
      tf_data.calltf    =  aes_bfm_decryption_ecb_calltf;
490
      tf_data.compiletf = 0;
491
      tf_data.sizetf    = 0;
492
      tf_data.user_data = 0;
493
      vpi_register_systf(&tf_data);
494
 
495
      tf_data.type      = vpiSysTask;
496
      tf_data.sysfunctype = 0;
497
      tf_data.tfname    = "$bfm_decryption_ecb_dma_aes128";
498
      tf_data.calltf    =  aes_bfm_decryption_ecb_dma_calltf;
499
      tf_data.compiletf = 0;
500
      tf_data.sizetf    = 0;
501
      tf_data.user_data = 0;
502
      vpi_register_systf(&tf_data);
503
 
504
      tf_data.type      = vpiSysTask;
505
      tf_data.sysfunctype = 0;
506
      tf_data.tfname    = "$bfm_decryption_ccfie_ecb_aes128";
507
      tf_data.calltf    =  aes_bfm_decryption_ccfie_ecb_calltf;
508
      tf_data.compiletf = 0;
509
      tf_data.sizetf    = 0;
510
      tf_data.user_data = 0;
511
      vpi_register_systf(&tf_data);
512
 
513 5 redbear
      //CBC DECRYPTION
514 4 redbear
      tf_data.type      = vpiSysTask;
515
      tf_data.sysfunctype = 0;
516 5 redbear
      tf_data.tfname    = "$bfm_decryption_cbc_aes128";
517
      tf_data.calltf    =  aes_bfm_decryption_cbc_calltf;
518
      tf_data.compiletf = 0;
519
      tf_data.sizetf    = 0;
520
      tf_data.user_data = 0;
521
      vpi_register_systf(&tf_data);
522
 
523
      tf_data.type      = vpiSysTask;
524
      tf_data.sysfunctype = 0;
525
      tf_data.tfname    = "$bfm_decryption_cbc_dma_aes128";
526
      tf_data.calltf    =  aes_bfm_decryption_cbc_dma_calltf;
527
      tf_data.compiletf = 0;
528
      tf_data.sizetf    = 0;
529
      tf_data.user_data = 0;
530
      vpi_register_systf(&tf_data);
531
 
532
      tf_data.type      = vpiSysTask;
533
      tf_data.sysfunctype = 0;
534
      tf_data.tfname    = "$bfm_decryption_ccfie_cbc_aes128";
535
      tf_data.calltf    =  aes_bfm_decryption_ccfie_cbc_calltf;
536
      tf_data.compiletf = 0;
537
      tf_data.sizetf    = 0;
538
      tf_data.user_data = 0;
539
      vpi_register_systf(&tf_data);
540
 
541
      //CTR DECRYPTION
542
      tf_data.type      = vpiSysTask;
543
      tf_data.sysfunctype = 0;
544
      tf_data.tfname    = "$bfm_decryption_ctr_aes128";
545
      tf_data.calltf    =  aes_bfm_decryption_ctr_calltf;
546
      tf_data.compiletf = 0;
547
      tf_data.sizetf    = 0;
548
      tf_data.user_data = 0;
549
      vpi_register_systf(&tf_data);
550
 
551
      tf_data.type      = vpiSysTask;
552
      tf_data.sysfunctype = 0;
553
      tf_data.tfname    = "$bfm_decryption_ctr_dma_aes128";
554
      tf_data.calltf    =  aes_bfm_decryption_ctr_dma_calltf;
555
      tf_data.compiletf = 0;
556
      tf_data.sizetf    = 0;
557
      tf_data.user_data = 0;
558
      vpi_register_systf(&tf_data);
559
 
560
      tf_data.type      = vpiSysTask;
561
      tf_data.sysfunctype = 0;
562
      tf_data.tfname    = "$bfm_decryption_ccfie_ctr_aes128";
563
      tf_data.calltf    =  aes_bfm_decryption_ccfie_ctr_calltf;
564
      tf_data.compiletf = 0;
565
      tf_data.sizetf    = 0;
566
      tf_data.user_data = 0;
567
      vpi_register_systf(&tf_data);
568
 
569
      //ECB DERIVATION DECRYPTION
570
      tf_data.type      = vpiSysTask;
571
      tf_data.sysfunctype = 0;
572 4 redbear
      tf_data.tfname    = "$bfm_derivation_decryption_ecb_aes128";
573
      tf_data.calltf    =  aes_bfm_derivation_decryption_ecb_calltf;
574
      tf_data.compiletf = 0;
575
      tf_data.sizetf    = 0;
576
      tf_data.user_data = 0;
577
      vpi_register_systf(&tf_data);
578
 
579
      tf_data.type      = vpiSysTask;
580
      tf_data.sysfunctype = 0;
581
      tf_data.tfname    = "$bfm_derivation_decryption_dma_ecb_aes128";
582
      tf_data.calltf    =  aes_bfm_derivation_decryption_dma_ecb_calltf;
583
      tf_data.compiletf = 0;
584
      tf_data.sizetf    = 0;
585
      tf_data.user_data = 0;
586
      vpi_register_systf(&tf_data);
587
 
588
      tf_data.type      = vpiSysTask;
589
      tf_data.sysfunctype = 0;
590
      tf_data.tfname    = "$bfm_derivation_decryption_ccfie_ecb_aes128";
591
      tf_data.calltf    =  aes_bfm_derivation_decryption_ccfie_ecb_calltf;
592
      tf_data.compiletf = 0;
593
      tf_data.sizetf    = 0;
594
      tf_data.user_data = 0;
595
      vpi_register_systf(&tf_data);
596
 
597 5 redbear
      //CBC DERIVATION DECRYPTION
598
      tf_data.type      = vpiSysTask;
599
      tf_data.sysfunctype = 0;
600
      tf_data.tfname    = "$bfm_derivation_decryption_cbc_aes128";
601
      tf_data.calltf    =  aes_bfm_derivation_decryption_cbc_calltf;
602
      tf_data.compiletf = 0;
603
      tf_data.sizetf    = 0;
604
      tf_data.user_data = 0;
605
      vpi_register_systf(&tf_data);
606
 
607
      tf_data.type      = vpiSysTask;
608
      tf_data.sysfunctype = 0;
609
      tf_data.tfname    = "$bfm_derivation_decryption_dma_cbc_aes128";
610
      tf_data.calltf    =  aes_bfm_derivation_decryption_dma_cbc_calltf;
611
      tf_data.compiletf = 0;
612
      tf_data.sizetf    = 0;
613
      tf_data.user_data = 0;
614
      vpi_register_systf(&tf_data);
615
 
616
      tf_data.type      = vpiSysTask;
617
      tf_data.sysfunctype = 0;
618
      tf_data.tfname    = "$bfm_derivation_decryption_ccfie_cbc_aes128";
619
      tf_data.calltf    =  aes_bfm_derivation_decryption_ccfie_cbc_calltf;
620
      tf_data.compiletf = 0;
621
      tf_data.sizetf    = 0;
622
      tf_data.user_data = 0;
623
      vpi_register_systf(&tf_data);
624
 
625
      //CTR DERIVATION DECRYPTION
626
      tf_data.type      = vpiSysTask;
627
      tf_data.sysfunctype = 0;
628
      tf_data.tfname    = "$bfm_derivation_decryption_ctr_aes128";
629
      tf_data.calltf    =  aes_bfm_derivation_decryption_ctr_calltf;
630
      tf_data.compiletf = 0;
631
      tf_data.sizetf    = 0;
632
      tf_data.user_data = 0;
633
      vpi_register_systf(&tf_data);
634
 
635
      tf_data.type      = vpiSysTask;
636
      tf_data.sysfunctype = 0;
637
      tf_data.tfname    = "$bfm_derivation_decryption_dma_ctr_aes128";
638
      tf_data.calltf    =  aes_bfm_derivation_decryption_dma_ctr_calltf;
639
      tf_data.compiletf = 0;
640
      tf_data.sizetf    = 0;
641
      tf_data.user_data = 0;
642
      vpi_register_systf(&tf_data);
643
 
644
      tf_data.type      = vpiSysTask;
645
      tf_data.sysfunctype = 0;
646
      tf_data.tfname    = "$bfm_derivation_decryption_ccfie_ctr_aes128";
647
      tf_data.calltf    =  aes_bfm_derivation_decryption_ccfie_ctr_calltf;
648
      tf_data.compiletf = 0;
649
      tf_data.sizetf    = 0;
650
      tf_data.user_data = 0;
651
      vpi_register_systf(&tf_data);
652
 
653
 
654 4 redbear
      //KEY DERIVATION
655
      tf_data.type      = vpiSysTask;
656
      tf_data.sysfunctype = 0;
657
      tf_data.tfname    = "$bfm_key_generation_ecb_aes128";
658
      tf_data.calltf    =  aes_bfm_key_generation_ecb_calltf;
659
      tf_data.compiletf = 0;
660
      tf_data.sizetf    = 0;
661
      tf_data.user_data = 0;
662
      vpi_register_systf(&tf_data);
663
 
664
      tf_data.type      = vpiSysTask;
665
      tf_data.sysfunctype = 0;
666
      tf_data.tfname    = "$bfm_key_generation_dma_ecb_aes128";
667
      tf_data.calltf    =  aes_bfm_key_generation_dma_ecb_calltf;
668
      tf_data.compiletf = 0;
669
      tf_data.sizetf    = 0;
670
      tf_data.user_data = 0;
671
      vpi_register_systf(&tf_data);
672
 
673
 
674
      tf_data.type      = vpiSysTask;
675
      tf_data.sysfunctype = 0;
676
      tf_data.tfname    = "$bfm_key_generation_ccfie_ecb_aes128";
677
      tf_data.calltf    =  aes_bfm_key_generation_ccfie_ecb_calltf;
678
      tf_data.compiletf = 0;
679
      tf_data.sizetf    = 0;
680
      tf_data.user_data = 0;
681
      vpi_register_systf(&tf_data);
682
 
683 5 redbear
      //CBC DERIVATION
684
      tf_data.type      = vpiSysTask;
685
      tf_data.sysfunctype = 0;
686
      tf_data.tfname    = "$bfm_key_generation_cbc_aes128";
687
      tf_data.calltf    =  aes_bfm_key_generation_cbc_calltf;
688
      tf_data.compiletf = 0;
689
      tf_data.sizetf    = 0;
690
      tf_data.user_data = 0;
691
      vpi_register_systf(&tf_data);
692
 
693
      tf_data.type      = vpiSysTask;
694
      tf_data.sysfunctype = 0;
695
      tf_data.tfname    = "$bfm_key_generation_dma_cbc_aes128";
696
      tf_data.calltf    =  aes_bfm_key_generation_dma_cbc_calltf;
697
      tf_data.compiletf = 0;
698
      tf_data.sizetf    = 0;
699
      tf_data.user_data = 0;
700
      vpi_register_systf(&tf_data);
701
 
702
      tf_data.type      = vpiSysTask;
703
      tf_data.sysfunctype = 0;
704
      tf_data.tfname    = "$bfm_key_generation_ccfie_cbc_aes128";
705
      tf_data.calltf    =  aes_bfm_key_generation_ccfie_cbc_calltf;
706
      tf_data.compiletf = 0;
707
      tf_data.sizetf    = 0;
708
      tf_data.user_data = 0;
709
      vpi_register_systf(&tf_data);
710
 
711
      //CTR DERIVATION
712
      tf_data.type      = vpiSysTask;
713
      tf_data.sysfunctype = 0;
714
      tf_data.tfname    = "$bfm_key_generation_ctr_aes128";
715
      tf_data.calltf    =  aes_bfm_key_generation_ctr_calltf;
716
      tf_data.compiletf = 0;
717
      tf_data.sizetf    = 0;
718
      tf_data.user_data = 0;
719
      vpi_register_systf(&tf_data);
720
 
721
      tf_data.type      = vpiSysTask;
722
      tf_data.sysfunctype = 0;
723
      tf_data.tfname    = "$bfm_key_generation_dma_ctr_aes128";
724
      tf_data.calltf    =  aes_bfm_key_generation_dma_ctr_calltf;
725
      tf_data.compiletf = 0;
726
      tf_data.sizetf    = 0;
727
      tf_data.user_data = 0;
728
      vpi_register_systf(&tf_data);
729
 
730
      tf_data.type      = vpiSysTask;
731
      tf_data.sysfunctype = 0;
732
      tf_data.tfname    = "$bfm_key_generation_ccfie_ctr_aes128";
733
      tf_data.calltf    =  aes_bfm_key_generation_ccfie_ctr_calltf;
734
      tf_data.compiletf = 0;
735
      tf_data.sizetf    = 0;
736
      tf_data.user_data = 0;
737
      vpi_register_systf(&tf_data);
738
 
739 4 redbear
      // RESET BFM
740
      tf_data.type      = vpiSysTask;
741
      tf_data.sysfunctype = 0;
742
      tf_data.tfname    = "$reset_aes128";
743
      tf_data.calltf    = aes_reset_calltf;
744
      tf_data.compiletf = 0;
745
      tf_data.sizetf    = 0;
746
      tf_data.user_data = 0;
747
      vpi_register_systf(&tf_data);
748
 
749
 
750
      //ENV CONFIGURATION
751
      tf_data.type      = vpiSysTask;
752
      tf_data.sysfunctype = 0;
753
      tf_data.tfname    = "$init";
754
      tf_data.calltf    = init_calltf;
755
      tf_data.compiletf = 0;
756
      tf_data.sizetf    = 0;
757
      tf_data.user_data = 0;
758
      vpi_register_systf(&tf_data);
759
 
760
      tf_data.type      = vpiSysTask;
761
      tf_data.sysfunctype = 0;
762
      tf_data.tfname    = "$init_reset";
763
      tf_data.calltf    = init_reset_calltf;
764
      tf_data.compiletf = 0;
765
      tf_data.sizetf    = 0;
766
      tf_data.user_data = 0;
767
      vpi_register_systf(&tf_data);
768
 
769
      tf_data.type      = vpiSysTask;
770
      tf_data.sysfunctype = 0;
771
      tf_data.tfname    = "$monitor_aes";
772
      tf_data.calltf    = mon_calltf;
773
      tf_data.compiletf = 0;
774
      tf_data.sizetf    = 0;
775
      tf_data.user_data = 0;
776
      vpi_register_systf(&tf_data);
777
 
778
}
779
 
780
 
781
void (*vlog_startup_routines[])() = {
782
    AES_GLADIC_register,
783
 
784
};
785
 

powered by: WebSVN 2.1.0

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