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

Subversion Repositories apbtoaes128

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

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 9 redbear
        v_monitor.value.integer=0;
114
        v_monitor_catch.value.integer=0;
115
        A=B=C=D=E=F=G=H=I=J=L=M=N=0;
116
 
117
        for(counter_monitor=0;counter_monitor < 16;counter_monitor++)
118
        {
119
                INPUT_KEYR[counter_monitor] =0x00;
120
                OUTPUT_KEYR[counter_monitor]=0x00;
121
 
122
                INPUT_IVR[counter_monitor]  =0x00;
123
                OUTPUT_IVR[counter_monitor] =0x00;
124
 
125
                INPUT_TEXT[counter_monitor]=0x00;
126
                OUTPUT_TEXT[counter_monitor]=0x00;
127
        }
128
 
129
        counter_monitor=0;
130
        cycle_counter =0;
131
 
132 4 redbear
        /* WRITE READ
133
        vector_address[0]= ADDR_AES_CR;
134
        vector_address[1]= ADDR_AES_SR;
135
        vector_address[2]= ADDR_AES_DINR;
136
        vector_address[3]= ADDR_AES_DOUTR;
137
        vector_address[4]= ADDR_AES_KEYR3;
138
        vector_address[5]= ADDR_AES_KEYR2;
139
        vector_address[6]= ADDR_AES_KEYR1;
140
        vector_address[7]= ADDR_AES_KEYR0;
141
        vector_address[8]= ADDR_AES_IVR3;
142
        vector_address[9]= ADDR_AES_IVR2;
143
        vector_address[10]=ADDR_AES_IVR1;
144
        vector_address[11]=ADDR_AES_IVR0;
145
        */
146
 
147
 
148
        vector_address[0]= ADDR_AES_CR;
149 9 redbear
        vector_address[1]= ADDR_AES_KEYR3;
150
        vector_address[2]= ADDR_AES_KEYR2;
151
        vector_address[3]= ADDR_AES_KEYR1;
152
        vector_address[4]= ADDR_AES_KEYR0;
153 4 redbear
        vector_address[5]= ADDR_AES_IVR3;
154
        vector_address[6]= ADDR_AES_IVR2;
155
        vector_address[7]= ADDR_AES_IVR1;
156
        vector_address[8]= ADDR_AES_IVR0;
157
        vector_address[9]= ADDR_AES_CR;
158
 
159
 
160
        /*
161
        vector_address[0]= ADDR_AES_CR;
162
        vector_address[1]= ADDR_AES_SR;
163
        vector_address[2]= ADDR_AES_DINR;
164
        vector_address[3]= ADDR_AES_DOUTR;
165
        vector_address[4]= ADDR_AES_KEYR3;
166
        vector_address[5]= ADDR_AES_KEYR2;
167
        vector_address[6]= ADDR_AES_KEYR1;
168
        vector_address[7]= ADDR_AES_KEYR0;
169
        vector_address[8]= ADDR_AES_IVR3;
170
        vector_address[9]= ADDR_AES_IVR2;
171
        vector_address[10]=ADDR_AES_IVR1;
172
        vector_address[11]=ADDR_AES_IVR0;
173
        */
174
        v_initial.format=vpiIntVal;
175
 
176
        v_initial.value.integer = 0;
177
        vpi_put_value(PENABLE, &v_initial, NULL, vpiNoDelay);
178
        vpi_put_value(PSEL , &v_initial, NULL, vpiNoDelay);
179
        vpi_put_value(PADDR, &v_initial, NULL, vpiNoDelay);
180
        vpi_put_value(i, &v_initial, NULL, vpiNoDelay);
181
        vpi_put_value(PWRITE, &v_initial, NULL, vpiNoDelay);
182
        vpi_put_value(PWDATA, &v_initial, NULL, vpiNoDelay);
183
 
184
 
185
 
186
        return 0;
187
}

powered by: WebSVN 2.1.0

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