aes_d.v
2.63 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
// 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_d.vhd
// Author : Vincenzo Liguori
// Date : 02-03-02
// Version 1.0
// Abstract :
// This implements the AES decryption top module
//
// Modification history :
// Date by Version Change description
// -------------------------------------------------
// 02-03-02 VL 1.0 Original
// 08-07-02 frank name change to avoid vcs module name conflict
module aes_d(
clk,
rstn,
en,
go,
ksize,
din,
key,
din_req,
dout,
dout_vld
);
// Inputs
input clk, rstn;
input en, go;
input[1:0] ksize;
input[31:0] din, key;
// Outputs
output din_req;
output[31:0] dout;
output dout_vld;
wire clk;
wire rstn;
wire en;
wire go;
wire [1:0] ksize;
wire [31:0] din;
wire [31:0] key;
wire din_req;
wire [31:0] dout;
wire dout_vld;
wire dinit;
wire [31:0] olddata;
wire ibypass;
wire final;
wire [1:0] raddr0;
wire [1:0] raddr1;
wire [1:0] raddr2;
wire [1:0] raddr3;
wire [1:0] waddr0;
wire [1:0] waddr1;
wire [1:0] waddr2;
wire [1:0] waddr3;
assign din_req = dinit;
aes_ctrl ct(
// Inputs
.clk(clk),
.rstn(rstn),
.en(en),
.go(go),
.ksize(ksize),
// Outputs
.dinit(dinit),
.ibypass(ibypass),
.final(final),
.raddr0(raddr0),
.raddr1(raddr1),
.raddr2(raddr2),
.raddr3(raddr3),
.waddr0(waddr0),
.waddr1(waddr1),
.waddr2(waddr2),
.waddr3(waddr3),
.dout_vld(dout_vld));
// Status storage area
aes_mem4 sm0(
.clk(clk),
.rstn(rstn),
.en(en),
.we(go),
.ar(raddr0),
.aw(waddr0),
.din(dout[31:24] ),
.dout(olddata[31:24] ));
aes_mem4 sm1(
.clk(clk),
.rstn(rstn),
.en(en),
.we(go),
.ar(raddr1),
.aw(waddr1),
.din(dout[23:16] ),
.dout(olddata[23:16] ));
aes_mem4 sm2(
.clk(clk),
.rstn(rstn),
.en(en),
.we(go),
.ar(raddr2),
.aw(waddr2),
.din(dout[15:8] ),
.dout(olddata[15:8] ));
aes_mem4 sm3(
.clk(clk),
.rstn(rstn),
.en(en),
.we(go),
.ar(raddr3),
.aw(waddr3),
.din(dout[7:0] ),
.dout(olddata[7:0] ));
// Main AES block
aes_main ma(
// Inputs
.clk(clk),
.rstn(rstn),
.en(en),
.dinit(dinit),
.ibypass(ibypass),
.final(final),
.din(din),
.olddata(olddata),
.key(key),
// Outputs
.dout(dout));
endmodule