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

Subversion Repositories aes_decrypt_fpga

[/] [aes_decrypt_fpga/] [trunk/] [rtl/] [verilog/] [InvMixCol_slice.sv] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
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
//// This module computes one column of the InvMixColumns() defined     ////
46
//// in section 5.3.3 in FIPS-197 specification.                                        ////
47
////                                                                                                                            ////
48
////////////////////////////////////////////////////////////////////////
49
module InvMixCol_slice(
50
        input   [7:0]   S0c,
51
        input   [7:0]   S1c,
52
        input   [7:0]   S2c,
53
        input   [7:0]   S3c,
54
        input   bypass,
55
        output  [31:0]  new_S);
56
 
57
        wire    [7:0]   S0cx9, S0cxb, S0cxd, S0cxe;
58
        wire    [7:0]   S1cx9, S1cxb, S1cxd, S1cxe;
59
        wire    [7:0]   S2cx9, S2cxb, S2cxd, S2cxe;
60
        wire    [7:0]   S3cx9, S3cxb, S3cxd, S3cxe;
61
 
62
        wire    [7:0]   sum0, sum1, sum2, sum3;
63
 
64
        // GF multipliers to generate products for x9, xb, xd, xe
65
        gfmul_inv gfmul_inv_u0(.d(S0c), .x2(), .x3(), .x9(S0cx9), .xb(S0cxb), .xd(S0cxd), .xe(S0cxe));
66
        gfmul_inv gfmul_inv_u1(.d(S1c), .x2(), .x3(), .x9(S1cx9), .xb(S1cxb), .xd(S1cxd), .xe(S1cxe));
67
        gfmul_inv gfmul_inv_u2(.d(S2c), .x2(), .x3(), .x9(S2cx9), .xb(S2cxb), .xd(S2cxd), .xe(S2cxe));
68
        gfmul_inv gfmul_inv_u3(.d(S3c), .x2(), .x3(), .x9(S3cx9), .xb(S3cxb), .xd(S3cxd), .xe(S3cxe));
69
 
70
        // Compute InvMixColumns according to section 5.3.3 of FIPS-197 spec.
71
        // Feed input through directly when bypass=1.
72
        assign sum0 = bypass ? S0c : S0cxe ^ S1cxb ^ S2cxd ^ S3cx9;
73
        assign sum1 = bypass ? S1c : S0cx9 ^ S1cxe ^ S2cxb ^ S3cxd;
74
        assign sum2 = bypass ? S2c : S0cxd ^ S1cx9 ^ S2cxe ^ S3cxb;
75
        assign sum3 = bypass ? S3c : S0cxb ^ S1cxd ^ S2cx9 ^ S3cxe;
76
 
77
        assign new_S = {sum0, sum1, sum2, sum3};
78
endmodule

powered by: WebSVN 2.1.0

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