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

Subversion Repositories apbtoaes128

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

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

powered by: WebSVN 2.1.0

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