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

Subversion Repositories apbtoaes128

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

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

powered by: WebSVN 2.1.0

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