mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
update removal of underscores from aes_common
This commit is contained in:
parent
00b61390d9
commit
8821386fe5
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_inv_mixcolumns.sv
|
// aesinvmixcolumns.sv
|
||||||
//
|
//
|
||||||
// Written: kelvin.tran@okstate.edu, james.stine@okstate.edu
|
// Written: kelvin.tran@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 05 March 2024
|
// Created: 05 March 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_inv_mixcolumns(input logic [31:0] in, output logic [31:0] out);
|
module aesinvmixcolumns(input logic [31:0] in, output logic [31:0] out);
|
||||||
|
|
||||||
logic [7:0] in0, in1, in2, in3, temp;
|
logic [7:0] in0, in1, in2, in3, temp;
|
||||||
logic [10:0] xor0, xor1, xor2, xor3;
|
logic [10:0] xor0, xor1, xor2, xor3;
|
||||||
@ -38,9 +38,9 @@ module aes_inv_mixcolumns(input logic [31:0] in, output logic [31:0] out);
|
|||||||
assign xor2 = {temp, 3'b0} ^ {1'b0, in1^in3, 2'b0} ^ {2'b0, in1^in0, 1'b0} ^ {3'b0, temp} ^ {3'b0, in1};
|
assign xor2 = {temp, 3'b0} ^ {1'b0, in1^in3, 2'b0} ^ {2'b0, in1^in0, 1'b0} ^ {3'b0, temp} ^ {3'b0, in1};
|
||||||
assign xor3 = {temp, 3'b0} ^ {1'b0, in0^in2, 2'b0} ^ {2'b0, in0^in3, 1'b0} ^ {3'b0, temp} ^ {3'b0, in0};
|
assign xor3 = {temp, 3'b0} ^ {1'b0, in0^in2, 2'b0} ^ {2'b0, in0^in3, 1'b0} ^ {3'b0, temp} ^ {3'b0, in0};
|
||||||
|
|
||||||
galoismult_inverse gm0 (xor0, out[7:0]);
|
galoismultinverse gm0 (xor0, out[7:0]);
|
||||||
galoismult_inverse gm1 (xor1, out[15:8]);
|
galoismultinverse gm1 (xor1, out[15:8]);
|
||||||
galoismult_inverse gm2 (xor2, out[23:16]);
|
galoismultinverse gm2 (xor2, out[23:16]);
|
||||||
galoismult_inverse gm3 (xor3, out[31:24]);
|
galoismultinverse gm3 (xor3, out[31:24]);
|
||||||
|
|
||||||
endmodule
|
endmodule
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_inv_sbox.sv
|
// aesinvsbox.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_inv_sbox(input logic [7:0] in, output logic [7:0] out);
|
module aesinvsbox(input logic [7:0] in, output logic [7:0] out);
|
||||||
|
|
||||||
always_comb
|
always_comb
|
||||||
begin
|
begin
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_inv_sbox_word.sv
|
// aesinvsboxword.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,15 +25,15 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_inv_sbox_word(input logic [31:0] in, output logic [31:0] out);
|
module aesinvsboxword(input logic [31:0] in, output logic [31:0] out);
|
||||||
|
|
||||||
// Declare the SBOX for (least significant) byte 0 of the input
|
// Declare the SBOX for (least significant) byte 0 of the input
|
||||||
aes_inv_sbox sbox_b0(.in(in[7:0]), .out(out[7:0]));
|
aesinvsbox sbox_b0(.in(in[7:0]), .out(out[7:0]));
|
||||||
// Declare the SBOX for byte 1 of the input
|
// Declare the SBOX for byte 1 of the input
|
||||||
aes_inv_sbox sbox_b1(.in(in[15:8]), .out(out[15:8]));
|
aesinvsbox sbox_b1(.in(in[15:8]), .out(out[15:8]));
|
||||||
// Declare the SBOX for byte 2 of the input
|
// Declare the SBOX for byte 2 of the input
|
||||||
aes_inv_sbox sbox_b2(.in(in[23:16]), .out(out[23:16]));
|
aesinvsbox sbox_b2(.in(in[23:16]), .out(out[23:16]));
|
||||||
// Declare the SBOX for byte 3 of the input
|
// Declare the SBOX for byte 3 of the input
|
||||||
aes_inv_sbox sbox_b3(.in(in[31:24]), .out(out[31:24]));
|
aesinvsbox sbox_b3(.in(in[31:24]), .out(out[31:24]));
|
||||||
|
|
||||||
endmodule
|
endmodule
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_inv_shiftrow.sv
|
// aesinvshiftrow.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_inv_shiftrow(input logic [127:0] DataIn, output logic [127:0] DataOut);
|
module aesinvshiftrow(input logic [127:0] DataIn, output logic [127:0] DataOut);
|
||||||
|
|
||||||
assign DataOut = {DataIn[31:24], DataIn[55:48], DataIn[79:72], DataIn[103:96],
|
assign DataOut = {DataIn[31:24], DataIn[55:48], DataIn[79:72], DataIn[103:96],
|
||||||
DataIn[127:120], DataIn[23:16], DataIn[47:40], DataIn[71:64],
|
DataIn[127:120], DataIn[23:16], DataIn[47:40], DataIn[71:64],
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_mixcolumns.sv
|
// aesmixcolumns.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu, David_Harris@hmc.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu, David_Harris@hmc.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -26,17 +26,17 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
module aes_mixcolumns(input logic [31:0] in, output logic [31:0] out);
|
module aesmixcolumns(input logic [31:0] in, output logic [31:0] out);
|
||||||
|
|
||||||
logic [7:0] in0, in1, in2, in3, out0, out1, out2, out3, t0, t1, t2, t3, temp;
|
logic [7:0] in0, in1, in2, in3, out0, out1, out2, out3, t0, t1, t2, t3, temp;
|
||||||
|
|
||||||
assign {in0, in1, in2, in3} = in;
|
assign {in0, in1, in2, in3} = in;
|
||||||
assign temp = in0 ^ in1 ^ in2 ^ in3;
|
assign temp = in0 ^ in1 ^ in2 ^ in3;
|
||||||
|
|
||||||
galoismult_forward gm0 (in0^in1, t0);
|
galoismultforward gm0 (in0^in1, t0);
|
||||||
galoismult_forward gm1 (in1^in2, t1);
|
galoismultforward gm1 (in1^in2, t1);
|
||||||
galoismult_forward gm2 (in2^in3, t2);
|
galoismultforward gm2 (in2^in3, t2);
|
||||||
galoismult_forward gm3 (in3^in0, t3);
|
galoismultforward gm3 (in3^in0, t3);
|
||||||
|
|
||||||
assign out0 = in0 ^ temp ^ t3;
|
assign out0 = in0 ^ temp ^ t3;
|
||||||
assign out1 = in1 ^ temp ^ t0;
|
assign out1 = in1 ^ temp ^ t0;
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_sbox.sv
|
// aessbox.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_sbox(input logic [7:0] in, output logic [7:0] out);
|
module aessbox(input logic [7:0] in, output logic [7:0] out);
|
||||||
|
|
||||||
// case statement to lookup the value in the rijndael table
|
// case statement to lookup the value in the rijndael table
|
||||||
always_comb
|
always_comb
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_sbox_word.sv
|
// aessboxword.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,15 +25,15 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_sbox_word(input logic [31:0] in, output logic [31:0] out);
|
module aessboxword(input logic [31:0] in, output logic [31:0] out);
|
||||||
|
|
||||||
// Declare the SBOX for (least significant) byte 0 of the input
|
// Declare the SBOX for (least significant) byte 0 of the input
|
||||||
aes_sbox sbox_b0(.in(in[7:0]), .out(out[7:0]));
|
aessbox sbox_b0(.in(in[7:0]), .out(out[7:0]));
|
||||||
// Declare the SBOX for byte 1 of the input
|
// Declare the SBOX for byte 1 of the input
|
||||||
aes_sbox sbox_b1(.in(in[15:8]), .out(out[15:8]));
|
aessbox sbox_b1(.in(in[15:8]), .out(out[15:8]));
|
||||||
// Declare the SBOX for byte 2 of the input
|
// Declare the SBOX for byte 2 of the input
|
||||||
aes_sbox sbox_b2(.in(in[23:16]), .out(out[23:16]));
|
aessbox sbox_b2(.in(in[23:16]), .out(out[23:16]));
|
||||||
// Declare the SBOX for byte 3 of the input
|
// Declare the SBOX for byte 3 of the input
|
||||||
aes_sbox sbox_b3(.in(in[31:24]), .out(out[31:24]));
|
aessbox sbox_b3(.in(in[31:24]), .out(out[31:24]));
|
||||||
|
|
||||||
endmodule
|
endmodule
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// aes_shiftrow.sv
|
// aesshiftrow.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module aes_shiftrow(input logic [127:0] DataIn, output logic [127:0] DataOut);
|
module aesshiftrow(input logic [127:0] DataIn, output logic [127:0] DataOut);
|
||||||
|
|
||||||
assign DataOut = {DataIn[95:88], DataIn[55:48], DataIn[15:8], DataIn[103:96],
|
assign DataOut = {DataIn[95:88], DataIn[55:48], DataIn[15:8], DataIn[103:96],
|
||||||
DataIn[63:56], DataIn[23:16], DataIn[111:104], DataIn[71:64],
|
DataIn[63:56], DataIn[23:16], DataIn[111:104], DataIn[71:64],
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// galoismult_forward.sv
|
// galoismultforward.sv
|
||||||
//
|
//
|
||||||
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu, David_Harris@hmc.edu
|
// Written: ryan.swann@okstate.edu, james.stine@okstate.edu, David_Harris@hmc.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module galoismult_forward(input logic [7:0] in, output logic [7:0] out);
|
module galoismultforward(input logic [7:0] in, output logic [7:0] out);
|
||||||
|
|
||||||
logic [7:0] leftshift;
|
logic [7:0] leftshift;
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
// galoismult_inverse.sv
|
// galoismultinverse.sv
|
||||||
//
|
//
|
||||||
// Written: kelvin.tran@okstate.edu, james.stine@okstate.edu
|
// Written: kelvin.tran@okstate.edu, james.stine@okstate.edu
|
||||||
// Created: 20 February 2024
|
// Created: 20 February 2024
|
||||||
@ -25,7 +25,7 @@
|
|||||||
// and limitations under the License.
|
// and limitations under the License.
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
module galoismult_inverse(input logic [10:0] in, output logic [7:0] out);
|
module galoismultinverse(input logic [10:0] in, output logic [7:0] out);
|
||||||
|
|
||||||
logic [7:0] temp0, temp1;
|
logic [7:0] temp0, temp1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user