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

Subversion Repositories apbtoaes128

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

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

powered by: WebSVN 2.1.0

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