mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-03 02:05:21 +00:00
slight tweak of names
This commit is contained in:
parent
171da97fe3
commit
c8468e99c0
@ -46,15 +46,14 @@ module aes32dsi(input logic [1:0] bs,
|
||||
assign sbox_in = sbox_in_32[7:0];
|
||||
|
||||
// Apply inverse sbox to si
|
||||
aes_inv_sbox inv_sbox(.in(sbox_in),.out(sbox_out));
|
||||
aes_inv_sbox inv_sbox(.in(sbox_in), .out(sbox_out));
|
||||
|
||||
// Pad output of inverse substitution box
|
||||
assign so = {24'h000000,sbox_out};
|
||||
assign so = {24'h0, sbox_out};
|
||||
|
||||
// Rotate the substitution box output left by shamt (bs * 8)
|
||||
rotate_left rol32(.input_data(so),.shamt(shamt),.rot_data(so_rotate));
|
||||
rotate_left rol32(.input_data(so), .shamt(shamt), .rot_data(so_rotate));
|
||||
|
||||
// Set result to "X(rs1)[31..0] ^ rol32(so, unsigned(shamt));"
|
||||
assign data_out = rs1 ^ so_rotate;
|
||||
|
||||
endmodule
|
||||
|
@ -47,18 +47,17 @@ module aes32dsmi(input logic [1:0] bs,
|
||||
assign sbox_in = sbox_in_32[7:0];
|
||||
|
||||
// Apply inverse sbox to si
|
||||
aes_inv_sbox inv_sbox(.in(sbox_in),.out(sbox_out));
|
||||
aes_inv_sbox inv_sbox(.in(sbox_in), .out(sbox_out));
|
||||
|
||||
// Pad output of inverse substitution box
|
||||
assign so = {24'h000000,sbox_out};
|
||||
assign so = {24'h0, sbox_out};
|
||||
|
||||
// Run so through the mixword AES function
|
||||
inv_mixword mix(.word(so),.mixed_word(mixed));
|
||||
inv_mixword mix(.word(so), .mixed_word(mixed));
|
||||
|
||||
// Rotate the substitution box output left by shamt (bs * 8)
|
||||
rotate_left rol32(.input_data(mixed),.shamt(shamt),.rot_data(mixed_rotate));
|
||||
rotate_left rol32(.input_data(mixed), .shamt(shamt), .rot_data(mixed_rotate));
|
||||
|
||||
// Set result to "X(rs1)[31..0] ^ rol32(so, unsigned(shamt));"
|
||||
assign data_out = rs1 ^ mixed_rotate;
|
||||
|
||||
endmodule
|
||||
|
@ -48,15 +48,14 @@ module aes32esi(input logic [1:0] bs,
|
||||
assign sbox_in = sbox_in_32[7:0];
|
||||
|
||||
// Substitute
|
||||
aes_sbox subbox(.in(sbox_in),.out(sbox_out));
|
||||
aes_sbox subbox(.in(sbox_in), .out(sbox_out));
|
||||
|
||||
// Pad sbox output
|
||||
assign so = {24'h000000,sbox_out};
|
||||
assign so = {24'h0, sbox_out};
|
||||
|
||||
// Rotate so left by shamt
|
||||
rotate_left rol32(.input_data(so),.shamt(shamt),.rot_data(so_rotate));
|
||||
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;
|
||||
|
||||
endmodule
|
||||
|
@ -49,18 +49,17 @@ module aes32esmi(input logic [1:0] bs,
|
||||
assign sbox_in = sbox_in_32[7:0];
|
||||
|
||||
// Substitute
|
||||
aes_sbox sbox(.in(sbox_in),.out(sbox_out));
|
||||
aes_sbox sbox(.in(sbox_in), .out(sbox_out));
|
||||
|
||||
// Pad sbox output
|
||||
assign so = {24'h000000,sbox_out};
|
||||
assign so = {24'h0, sbox_out};
|
||||
|
||||
// Mix Word using aes_mixword component
|
||||
mixword mwd(.word(so),.mixed_word(mixed));
|
||||
mixword mwd(.word(so), .mixed_word(mixed));
|
||||
|
||||
// Rotate so left by shamt
|
||||
rotate_left rol32(.input_data(mixed),.shamt(shamt),.rot_data(mixed_rotate));
|
||||
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;
|
||||
|
||||
endmodule
|
||||
|
@ -35,13 +35,12 @@ module aes64ds(input logic [63:0] rs1,
|
||||
logic [31:0] sbox_out_1;
|
||||
|
||||
// Apply inverse shiftrows to rs2 and rs1
|
||||
aes_inv_shiftrow srow(.dataIn({rs2,rs1}),.dataOut(shiftRow_out));
|
||||
aes_inv_shiftrow srow(.dataIn({rs2,rs1}), .dataOut(shiftRow_out));
|
||||
|
||||
// Apply full word inverse substitution to lower 2 words of shiftrow out
|
||||
aes_inv_sbox_word inv_sbox_0(.in(shiftRow_out[31:0]),.out(sbox_out_0));
|
||||
aes_inv_sbox_word inv_sbox_1(.in(shiftRow_out[63:32]),.out(sbox_out_1));
|
||||
aes_inv_sbox_word inv_sbox_0(.in(shiftRow_out[31:0]), .out(sbox_out_0));
|
||||
aes_inv_sbox_word inv_sbox_1(.in(shiftRow_out[63:32]), .out(sbox_out_1));
|
||||
|
||||
// Concatenate the two substitution outputs to get result
|
||||
assign data_out = {sbox_out_1, sbox_out_0};
|
||||
|
||||
endmodule
|
||||
|
@ -37,17 +37,16 @@ module aes64dsm(input logic [63:0] rs1,
|
||||
logic [31:0] mixcol_out_1;
|
||||
|
||||
// Apply inverse shiftrows to rs2 and rs1
|
||||
aes_inv_shiftrow srow(.dataIn({rs2,rs1}),.dataOut(shiftRow_out));
|
||||
aes_inv_shiftrow srow(.dataIn({rs2,rs1}), .dataOut(shiftRow_out));
|
||||
|
||||
// Apply full word inverse substitution to lower 2 words of shiftrow out
|
||||
aes_inv_sbox_word inv_sbox_0(.in(shiftRow_out[31:0]),.out(sbox_out_0));
|
||||
aes_inv_sbox_word inv_sbox_1(.in(shiftRow_out[63:32]),.out(sbox_out_1));
|
||||
aes_inv_sbox_word inv_sbox_0(.in(shiftRow_out[31:0]), .out(sbox_out_0));
|
||||
aes_inv_sbox_word inv_sbox_1(.in(shiftRow_out[63:32]), .out(sbox_out_1));
|
||||
|
||||
// Apply inverse mixword to sbox outputs
|
||||
inv_mixword inv_mw_0(.word(sbox_out_0),.mixed_word(mixcol_out_0));
|
||||
inv_mixword inv_mw_1(.word(sbox_out_1),.mixed_word(mixcol_out_1));
|
||||
inv_mixword inv_mw_0(.word(sbox_out_0), .mixed_word(mixcol_out_0));
|
||||
inv_mixword inv_mw_1(.word(sbox_out_1), .mixed_word(mixcol_out_1));
|
||||
|
||||
// Concatenate mixed words for output
|
||||
assign data_out = {mixcol_out_1,mixcol_out_0};
|
||||
|
||||
assign data_out = {mixcol_out_1, mixcol_out_0};
|
||||
endmodule
|
||||
|
@ -33,10 +33,9 @@ module aes64es(input logic [63:0] rs1,
|
||||
logic [127:0] shiftRow_out;
|
||||
|
||||
// AES shiftrow unit
|
||||
aes_shiftrow srow(.dataIn({rs2,rs1}),.dataOut(shiftRow_out));
|
||||
aes_shiftrow srow(.dataIn({rs2,rs1}), .dataOut(shiftRow_out));
|
||||
|
||||
// Apply substitution box to 2 lower words
|
||||
aes_sbox_word sbox_0(.in(shiftRow_out[31:0]),.out(data_out[31:0]));
|
||||
aes_sbox_word sbox_1(.in(shiftRow_out[63:32]),.out(data_out[63:32]));
|
||||
|
||||
aes_sbox_word sbox_0(.in(shiftRow_out[31:0]), .out(data_out[31:0]));
|
||||
aes_sbox_word sbox_1(.in(shiftRow_out[63:32]), .out(data_out[63:32]));
|
||||
endmodule
|
||||
|
@ -34,14 +34,13 @@ module aes64esm(input logic [63:0] rs1,
|
||||
logic [63:0] sbox_out;
|
||||
|
||||
// AES shiftrow unit
|
||||
aes_shiftrow srow(.dataIn({rs2,rs1}),.dataOut(shiftRow_out));
|
||||
aes_shiftrow srow(.dataIn({rs2,rs1}), .dataOut(shiftRow_out));
|
||||
|
||||
// Apply substitution box to 2 lower words
|
||||
aes_sbox_word sbox_0(.in(shiftRow_out[31:0]),.out(sbox_out[31:0]));
|
||||
aes_sbox_word sbox_1(.in(shiftRow_out[63:32]),.out(sbox_out[63:32]));
|
||||
aes_sbox_word sbox_0(.in(shiftRow_out[31:0]), .out(sbox_out[31:0]));
|
||||
aes_sbox_word sbox_1(.in(shiftRow_out[63:32]), .out(sbox_out[63:32]));
|
||||
|
||||
// Apply mix columns operations
|
||||
mixword mw0(.word(sbox_out[31:0]),.mixed_word(data_out[31:0]));
|
||||
mixword mw1(.word(sbox_out[63:32]),.mixed_word(data_out[63:32]));
|
||||
|
||||
mixword mw0(.word(sbox_out[31:0]), .mixed_word(data_out[31:0]));
|
||||
mixword mw1(.word(sbox_out[63:32]), .mixed_word(data_out[63:32]));
|
||||
endmodule
|
||||
|
@ -28,7 +28,6 @@
|
||||
module aes64im(input logic [63:0] rs1,
|
||||
output logic [63:0] data_out);
|
||||
|
||||
inv_mixword inv_mw_0(.word(rs1[31:0]),.mixed_word(data_out[31:0]));
|
||||
inv_mixword inv_mw_1(.word(rs1[63:32]),.mixed_word(data_out[63:32]));
|
||||
|
||||
inv_mixword inv_mw_0(.word(rs1[31:0]), .mixed_word(data_out[31:0]));
|
||||
inv_mixword inv_mw_1(.word(rs1[63:32]), .mixed_word(data_out[63:32]));
|
||||
endmodule
|
||||
|
@ -36,5 +36,4 @@ module aes64ks2(input logic [63:0] rs2,
|
||||
assign w0 = rs1[63:32] ^ rs2[31:0];
|
||||
assign w1 = rs1[63:32] ^ rs2[31:0] ^ rs2[63:32];
|
||||
assign rd = {w1, w0};
|
||||
|
||||
endmodule
|
||||
|
Loading…
Reference in New Issue
Block a user