update on aes_instructions

This commit is contained in:
James E. Stine 2024-02-21 17:12:50 -06:00
parent 7097b17785
commit 7cb170c19b
2 changed files with 25 additions and 12 deletions

View File

@ -40,16 +40,22 @@ module aes32esi(input logic [1:0] bs,
// Shift bs by 3 to get shamt
assign shamt = {bs, 3'b0};
// Shift rs2 right by shamt to get sbox input
assign sbox_in_32 = (rs2 >> shamt);
// Take the bottom byte as an input to the substitution box
assign sbox_in = sbox_in_32[7:0];
// Substitute
aes_sbox subbox(.in(sbox_in),.out(sbox_out));
// Pad sbox output
assign so = {24'h000000,sbox_out};
// Rotate so left by shamt
rotate_left rol32(.input_data(so),.shamt(shamt),.rot_data(so_rotate));
// Set result X(rs1)[31..0] ^ rol32(so, unsigned(shamt));
assign data_out = rs1 ^ so_rotate;

View File

@ -41,18 +41,25 @@ module aes32esmi(input logic [1:0] bs,
// Shift bs by 3 to get shamt
assign shamt = {bs, 3'b0};
// Shift rs2 right by shamt to get sbox input
assign sbox_in_32 = (rs2 >> shamt);
// Take the bottom byte as an input to the substitution box
assign sbox_in = sbox_in_32[7:0];
// Substitute
aes_sbox sbox(.in(sbox_in),.out(sbox_out));
// Pad sbox output
assign so = {24'h000000,sbox_out};
// Mix Word using aes_mixword component
mixword mwd(.word(so),.mixed_word(mixed));
// Rotate so left by shamt
rotate_left rol32(.input_data(mixed),.shamt(shamt),.rot_data(mixed_rotate));
// Set result X(rs1)[31..0] ^ rol32(mixed, unsigned(shamt));
assign data_out = rs1 ^ mixed_rotate;