../src/lowrisc_ip_aes_0.6/rtl/aes_mix_columns.sv Cov: 100%

   1: // Copyright lowRISC contributors.
   2: // Licensed under the Apache License, Version 2.0, see LICENSE for details.
   3: // SPDX-License-Identifier: Apache-2.0
   4: //
   5: // AES MixColumns
   6: 
   7: module aes_mix_columns (
   8:   input  aes_pkg::ciph_op_e    op_i,
   9:   input  logic [3:0][3:0][7:0] data_i,
  10:   output logic [3:0][3:0][7:0] data_o
  11: );
  12: 
  13:   import aes_pkg::*;
  14: 
  15:   // Transpose to operate on columns
  16:   logic [3:0][3:0][7:0] data_i_transposed;
  17:   logic [3:0][3:0][7:0] data_o_transposed;
  18: 
  19:   assign data_i_transposed = aes_transpose(data_i);
  20: 
  21:   // Individually mix columns
  22:   for (genvar i = 0; i < 4; i++) begin : gen_mix_column
  23:     aes_mix_single_column aes_mix_column_i (
  24:       .op_i   ( op_i                 ),
  25:       .data_i ( data_i_transposed[i] ),
  26:       .data_o ( data_o_transposed[i] )
  27:     );
  28:   end
  29: 
  30:   assign data_o = aes_transpose(data_o_transposed);
  31: 
  32: endmodule
  33: