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

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [pli/] [aes_init.h] - Blame information for rev 8

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
static int init_calltf(char*user_data)
76
{
77
 
78
        vpiHandle PRESETn = vpi_handle_by_name("AES_GLADIC_tb.PRESETn", NULL);
79
        vpiHandle PWDATA = vpi_handle_by_name("AES_GLADIC_tb.PWDATA", NULL);
80
        vpiHandle PENABLE = vpi_handle_by_name("AES_GLADIC_tb.PENABLE", NULL);
81
        vpiHandle PSEL = vpi_handle_by_name("AES_GLADIC_tb.PSEL", NULL);
82
        vpiHandle PWRITE = vpi_handle_by_name("AES_GLADIC_tb.PWRITE", NULL);
83
        vpiHandle PADDR = vpi_handle_by_name("AES_GLADIC_tb.PADDR", NULL);
84
        vpiHandle PRDATA = vpi_handle_by_name("AES_GLADIC_tb.PRDATA", NULL);
85
        vpiHandle PREADY = vpi_handle_by_name("AES_GLADIC_tb.PREADY", NULL);
86
        vpiHandle PSLVERR = vpi_handle_by_name("AES_GLADIC_tb.PSLVERR", NULL);
87
        vpiHandle int_ccf = vpi_handle_by_name("AES_GLADIC_tb.int_ccf", NULL);
88
        vpiHandle int_err = vpi_handle_by_name("AES_GLADIC_tb.int_err", NULL);
89
        vpiHandle dma_req_wr = vpi_handle_by_name("AES_GLADIC_tb.dma_req_wr", NULL);
90
        vpiHandle dma_req_rd = vpi_handle_by_name("AES_GLADIC_tb.dma_req_rd", NULL);
91
        vpiHandle i = vpi_handle_by_name("AES_GLADIC_tb.i", NULL);
92
 
93
 
94
 
95
        //type_bfm = AES_WR_ONLY;
96
 
97
 
98
        STATE = IDLE;
99
 
100
 
101
        counter_write = 0;
102
        counter_read  = 0;
103
        PACKETS_GENERATED = 0;
104
        counter = 0;
105
        reset_counter = 0;
106
        flag = 0;
107
 
108
        a = 0;
109
        b = 0;
110
        c = 0;
111
        d = 0;
112
 
113
        /* WRITE READ
114
        vector_address[0]= ADDR_AES_CR;
115
        vector_address[1]= ADDR_AES_SR;
116
        vector_address[2]= ADDR_AES_DINR;
117
        vector_address[3]= ADDR_AES_DOUTR;
118
        vector_address[4]= ADDR_AES_KEYR3;
119
        vector_address[5]= ADDR_AES_KEYR2;
120
        vector_address[6]= ADDR_AES_KEYR1;
121
        vector_address[7]= ADDR_AES_KEYR0;
122
        vector_address[8]= ADDR_AES_IVR3;
123
        vector_address[9]= ADDR_AES_IVR2;
124
        vector_address[10]=ADDR_AES_IVR1;
125
        vector_address[11]=ADDR_AES_IVR0;
126
        */
127
 
128
 
129
        vector_address[0]= ADDR_AES_CR;
130
        vector_address[1]= ADDR_AES_KEYR0;
131
        vector_address[2]= ADDR_AES_KEYR1;
132
        vector_address[3]= ADDR_AES_KEYR2;
133
        vector_address[4]= ADDR_AES_KEYR3;
134
        vector_address[5]= ADDR_AES_IVR3;
135
        vector_address[6]= ADDR_AES_IVR2;
136
        vector_address[7]= ADDR_AES_IVR1;
137
        vector_address[8]= ADDR_AES_IVR0;
138
        vector_address[9]= ADDR_AES_CR;
139
 
140
 
141
        /*
142
        vector_address[0]= ADDR_AES_CR;
143
        vector_address[1]= ADDR_AES_SR;
144
        vector_address[2]= ADDR_AES_DINR;
145
        vector_address[3]= ADDR_AES_DOUTR;
146
        vector_address[4]= ADDR_AES_KEYR3;
147
        vector_address[5]= ADDR_AES_KEYR2;
148
        vector_address[6]= ADDR_AES_KEYR1;
149
        vector_address[7]= ADDR_AES_KEYR0;
150
        vector_address[8]= ADDR_AES_IVR3;
151
        vector_address[9]= ADDR_AES_IVR2;
152
        vector_address[10]=ADDR_AES_IVR1;
153
        vector_address[11]=ADDR_AES_IVR0;
154
        */
155
        v_initial.format=vpiIntVal;
156
 
157
        v_initial.value.integer = 0;
158
        vpi_put_value(PENABLE, &v_initial, NULL, vpiNoDelay);
159
        vpi_put_value(PSEL , &v_initial, NULL, vpiNoDelay);
160
        vpi_put_value(PADDR, &v_initial, NULL, vpiNoDelay);
161
        vpi_put_value(i, &v_initial, NULL, vpiNoDelay);
162
        vpi_put_value(PWRITE, &v_initial, NULL, vpiNoDelay);
163
        vpi_put_value(PWDATA, &v_initial, NULL, vpiNoDelay);
164
 
165
 
166
 
167
        return 0;
168
}

powered by: WebSVN 2.1.0

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