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

Subversion Repositories apbtoaes128

[/] [apbtoaes128/] [trunk/] [rtl/] [aes_core.v] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 redbear
//////////////////////////////////////////////////////////////////
2
////
3
////
4
////    AES CORE BLOCK
5
////
6
////
7
////
8 7 redbear
//// This file is part of the APB to I2C project
9 2 redbear
////
10 7 redbear
//// http://www.opencores.org/cores/apbi2c/
11 2 redbear
////
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
////              Julio Cesar 
30
////
31
///////////////////////////////////////////////////////////////// 
32
////
33
////
34
//// Copyright (C) 2009 Authors and OPENCORES.ORG
35
////
36
////
37
////
38
//// This source file may be used and distributed without
39
////
40
//// restriction provided that this copyright statement is not
41
////
42
//// removed from the file and that any derivative work contains
43
//// the original copyright notice and the associated disclaimer.
44
////
45
////
46
//// This source file is free software; you can redistribute it
47
////
48
//// and/or modify it under the terms of the GNU Lesser General
49
////
50
//// Public License as published by the Free Software Foundation;
51
//// either version 2.1 of the License, or (at your option) any
52
////
53
//// later version.
54
////
55
////
56
////
57
//// This source is distributed in the hope that it will be
58
////
59
//// useful, but WITHOUT ANY WARRANTY; without even the implied
60
////
61
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
62
////
63
//// PURPOSE. See the GNU Lesser General Public License for more
64
//// details.
65
////
66
////
67
////
68
//// You should have received a copy of the GNU Lesser General
69
////
70
//// Public License along with this source; if not, download it
71
////
72
//// from http://www.opencores.org/lgpl.shtml
73
////
74
////
75
///////////////////////////////////////////////////////////////////
76
 
77
module aes_core
78
(
79
        //OUTPUTS
80
        output [31:0] col_out,
81
        output [31:0] key_out,
82
        output [31:0] iv_out,
83
        output end_aes,
84
        //INPUTS
85
        input  [31:0] bus_in,
86
        input  [ 3:0] iv_en,
87
        input  [ 3:0] iv_sel_rd,
88
        input  [ 3:0] key_en,
89
        input  [ 1:0] key_sel_rd,
90
        input  [ 1:0] data_type,
91
        input  [ 1:0] addr,
92
        input  [ 1:0] op_mode,
93
        input  [ 1:0] aes_mode,
94
        input start,
95
        input disable_core,
96
        input write_en,
97
        input read_en,
98
        input first_block,
99
        input rst_n,
100
        input clk
101
);
102
 
103
wire [ 1:0] rk_sel;
104
wire [ 1:0] key_out_sel;
105
wire [ 3:0] round;
106
wire [ 2:0] sbox_sel;
107
wire [ 3:0] col_en_host;
108
wire [ 3:0] iv_en_host;
109
wire [ 3:0] col_en_cnt_unit;
110
wire [ 3:0] key_en_host;
111
wire [ 3:0] key_en_cnt_unit;
112
wire [ 1:0] col_sel;
113
wire        key_sel;
114
wire bypass_rk;
115
wire bypass_key_en;
116
wire last_round;
117
wire iv_cnt_en;
118
wire iv_cnt_sel;
119
wire mode_ctr;
120
wire mode_cbc;
121
wire key_init;
122
wire key_gen;
123
wire [1:0] col_addr_host;
124
 
125
assign col_en_host = (4'b0001 << addr) & {4{write_en}};
126
assign col_addr_host = addr & {2{read_en}};
127
assign iv_en_host  = iv_en;
128
assign key_en_host = key_en;
129
 
130
datapath AES_CORE_DATAPATH
131
(
132
        .col_bus           ( col_out           ),
133
        .key_bus           ( key_out           ),
134
        .iv_bus            ( iv_out            ),
135
        .bus_in                              ( bus_in                              ),
136
        .end_aes           ( end_aes           ),
137
        .data_type         ( data_type                     ),
138
        .rk_sel                                    ( rk_sel                        ),
139
        .key_out_sel               ( key_out_sel                   ),
140
        .round                                     ( round                         ),
141
        .sbox_sel                                  ( sbox_sel                      ),
142
        .iv_en                                     ( iv_en_host                    ),
143
        .iv_sel_rd         ( iv_sel_rd         ),
144
        .col_en_host       ( col_en_host       ),
145
        .col_en_cnt_unit   ( col_en_cnt_unit   ),
146
        .key_host_en               ( key_en_host       ),
147
        .key_en                                    ( key_en_cnt_unit   ),
148
        .key_sel_rd        ( key_sel_rd        ),
149
        .col_sel_host              ( col_addr_host         ),
150
        .col_sel           ( col_sel           ),
151
        .key_sel                                   ( key_sel               ),
152
        .bypass_rk                         ( bypass_rk             ),
153
        .bypass_key_en     ( bypass_key_en         ),
154
        .first_block       ( first_block           ),
155
        .last_round        ( last_round        ),
156
        .iv_cnt_en         ( iv_cnt_en             ),
157
        .iv_cnt_sel                        ( iv_cnt_sel            ),
158
        .enc_dec                                   ( enc_dec               ),
159
        .mode_ctr                                  ( mode_ctr              ),
160
        .mode_cbc                                  ( mode_cbc              ),
161
        .key_init          ( key_init          ),
162
        .key_gen           ( key_gen           ),
163
        .key_derivation_en ( key_derivation_en ),
164
        .end_comp          ( end_comp          ),
165
        .rst_n                                     ( rst_n                 ),
166
        .clk                                               ( clk                           )
167
);
168
 
169
control_unit AES_CORE_CONTROL_UNIT
170
(
171
        .end_comp          ( end_comp          ),
172
        .sbox_sel          ( sbox_sel          ),
173
        .rk_sel            ( rk_sel            ),
174
        .key_out_sel       ( key_out_sel       ),
175
        .col_sel           ( col_sel           ),
176
        .key_en            ( key_en_cnt_unit   ),
177
        .col_en            ( col_en_cnt_unit   ),
178
        .round               ( round             ),
179
        .bypass_rk         ( bypass_rk         ),
180
        .bypass_key_en     ( bypass_key_en     ),
181
        .key_sel           ( key_sel           ),
182
        .last_round        ( last_round        ),
183
        .iv_cnt_en         ( iv_cnt_en         ),
184
        .iv_cnt_sel        ( iv_cnt_sel        ),
185
        .mode_ctr          ( mode_ctr          ),
186
        .mode_cbc          ( mode_cbc          ),
187
        .key_init          ( key_init          ),
188
        .encrypt_decrypt   ( enc_dec                               ),
189
        .key_gen           ( key_gen           ),
190
        .operation_mode    ( op_mode                               ),
191
        .aes_mode                                  ( aes_mode                              ),
192
        .start                                     ( start                                         ),
193
        .key_derivation_en ( key_derivation_en ),
194
        .disable_core      ( disable_core      ),
195
        .clk                                               ( clk                                                         ),
196
        .rst_n                                           ( rst_n                                                 )
197
);
198
 
199
endmodule

powered by: WebSVN 2.1.0

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