1 |
2 |
schengopen |
////////////////////////////////////////////////////////////////// ////
|
2 |
|
|
//// ////
|
3 |
|
|
//// AES Decryption Core for FPGA ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the AES Decryption Core for FPGA project ////
|
6 |
|
|
//// http://www.opencores.org/cores/xxx/ ////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Description ////
|
9 |
|
|
//// Implementation of AES Decryption Core for FPGA according to ////
|
10 |
|
|
//// core specification document. ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// To Do: ////
|
13 |
|
|
//// - ////
|
14 |
|
|
//// ////
|
15 |
|
|
//// Author(s): ////
|
16 |
|
|
//// - scheng, schengopencores@opencores.org ////
|
17 |
|
|
//// ////
|
18 |
|
|
//////////////////////////////////////////////////////////////////////
|
19 |
|
|
//// ////
|
20 |
|
|
//// Copyright (C) 2009 Authors and OPENCORES.ORG ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// This source file may be used and distributed without ////
|
23 |
|
|
//// restriction provided that this copyright statement is not ////
|
24 |
|
|
//// removed from the file and that any derivative work contains ////
|
25 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source file is free software; you can redistribute it ////
|
28 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
29 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
30 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
31 |
|
|
//// later version. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// This source is distributed in the hope that it will be ////
|
34 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
35 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
36 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
37 |
|
|
//// details. ////
|
38 |
|
|
//// ////
|
39 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
40 |
|
|
//// Public License along with this source; if not, download it ////
|
41 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
42 |
|
|
//// //// ///
|
43 |
|
|
///////////////////////////////////////////////////////////////////
|
44 |
|
|
//// ////
|
45 |
|
|
//// The file contains the definition of the InvShiftRows ////
|
46 |
|
|
//// transformation in section 5.3.1 of the FIPS-197 specification. ////
|
47 |
|
|
//// ////
|
48 |
|
|
////////////////////////////////////////////////////////////////////////
|
49 |
|
|
|
50 |
|
|
module InvShiftRows(
|
51 |
|
|
input [0:127] din,
|
52 |
|
|
output [0:127] dout);
|
53 |
|
|
|
54 |
|
|
wire [0:7] S00, S01, S02, S03;
|
55 |
|
|
wire [0:7] S10, S11, S12, S13;
|
56 |
|
|
wire [0:7] S20, S21, S22, S23;
|
57 |
|
|
wire [0:7] S30, S31, S32, S33;
|
58 |
|
|
|
59 |
|
|
wire [0:7] S_00, S_01, S_02, S_03;
|
60 |
|
|
wire [0:7] S_10, S_11, S_12, S_13;
|
61 |
|
|
wire [0:7] S_20, S_21, S_22, S_23;
|
62 |
|
|
wire [0:7] S_30, S_31, S_32, S_33;
|
63 |
|
|
|
64 |
|
|
assign S00 = din[0+:8]; assign S01 = din[32+:8]; assign S02 = din[64+:8]; assign S03 = din[96+:8];
|
65 |
|
|
assign S10 = din[8+:8]; assign S11 = din[40+:8]; assign S12 = din[72+:8]; assign S13 = din[104+:8];
|
66 |
|
|
assign S20 = din[16+:8]; assign S21 = din[48+:8]; assign S22 = din[80+:8]; assign S23 = din[112+:8];
|
67 |
|
|
assign S30 = din[24+:8]; assign S31 = din[56+:8]; assign S32 = din[88+:8]; assign S33 = din[120+:8];
|
68 |
|
|
|
69 |
|
|
assign S_00 = S00; assign S_01 = S01; assign S_02 = S02; assign S_03 = S03;
|
70 |
|
|
assign S_10 = S13; assign S_11 = S10; assign S_12 = S11; assign S_13 = S12;
|
71 |
|
|
assign S_20 = S22; assign S_21 = S23; assign S_22 = S20; assign S_23 = S21;
|
72 |
|
|
assign S_30 = S31; assign S_31 = S32; assign S_32 = S33; assign S_33 = S30;
|
73 |
|
|
|
74 |
|
|
assign dout = { S_00, S_10, S_20, S_30, S_01, S_11, S_21, S_31, S_02, S_12, S_22, S_32, S_03, S_13, S_23, S_33};
|
75 |
|
|
endmodule
|