../src/lowrisc_ip_aes_0.6/rtl/aes_shift_rows.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 ShiftRows
6:
7: module aes_shift_rows (
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: // Row 0 is left untouched
16: assign data_o[0] = data_i[0];
17:
18: // Row 2 does not depend on op_i
19: assign data_o[2] = aes_circ_byte_shift(data_i[2], 2'h2);
20:
21: // Row 1
22: assign data_o[1] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[1], 2'h3)
23: : aes_circ_byte_shift(data_i[1], 2'h1);
24:
25: // Row 3
26: assign data_o[3] = (op_i == CIPH_FWD) ? aes_circ_byte_shift(data_i[3], 2'h1)
27: : aes_circ_byte_shift(data_i[3], 2'h3);
28:
29: endmodule
30: