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

Subversion Repositories apbtoaes128

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

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

powered by: WebSVN 2.1.0

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