kexp.v
2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// This confidential and propriety software may be used
// only as authorized by a licensing agreement from
// Ocean Logic Pty Ltd http://www.ocean-logic.com
//
// In the event of publication, the following notice is
// applicable
//
// (C) COPYRIGHT 2001 Ocean Logic Pty Ltd
// ALL RIGHTS RESERVED
//
// the entire notice must be reproduced on all
// authorized copies
//
// File : aes.vhd
// Author : Vincenzo Liguori
// Date : 01-03-02
// Version 1.0
// Abstract :
// This implements the key expander top module
//
// Modification history :
// Date by Version Change description
// -------------------------------------------------
// 01-03-02 VL 1.0 Original
module kexp(
clk,
rstn,
go,
en,
ksize,
kin,
key,
addr,
first,
final,
key_req,
key_last
);
// Inputs
input clk, rstn;
input go, en;
input[1:0] ksize;
input[31:0] kin;
// Outputs
output[31:0] key;
output[5:0] addr;
output first, final, key_req, key_last;
wire clk;
wire rstn;
wire go;
wire en;
wire [1:0] ksize;
wire [31:0] kin;
wire [31:0] key;
wire [5:0] addr;
wire first;
wire final;
wire key_req;
wire key_last;
wire [4:0] rcaddr;
wire rotsel;
wire sel;
wire kinit;
wire [2:0] kaddr;
wire [31:0] oldkey;
ctrl ct(
// Inputs
.clk(clk),
.rstn(rstn),
.en(en),
.go(go),
.ksize(ksize),
// Outputs
.rotsel(rotsel),
.sel(sel),
.kinit(kinit),
.kaddr(kaddr),
.rcaddr(rcaddr),
.addr(addr),
.first(first),
.final(final),
.key_last(key_last));
assign key_req = kinit;
// Key storage area
mem8 km(
.clk(clk),
.rstn(rstn),
.en(en),
.we(go),
.ar(kaddr),
.aw(kaddr),
.din(key),
.dout(oldkey));
// Key scheduler/expander
keysched ks(
.clk(clk),
.rstn(rstn),
.en(en),
.rotsel(rotsel),
.sel(sel),
.kinit(kinit),
.kin(kin),
.oldkey(oldkey),
.rcaddr(rcaddr),
// Outputs
.key(key));
endmodule