forked from Cryptography-FPGA/SEED-FPGA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF_function.v
More file actions
47 lines (39 loc) · 1.59 KB
/
F_function.v
File metadata and controls
47 lines (39 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
////////////////////////////////////////////////////////////////////////////////////////////////
// This source is dedicated to the research paper enttled //
// "An 8-bit Serialized Architecture of SEED Block Cipher for Constrained Devices" //
// on IET Circuits, Devices & Systems journal //
// Authors : Lampros Pyrgas, Filippos Pirpilidis and Paris Kitsos //
// Institute: University of the Peloponnese //
// Department: Electrical and Computer Engineering //
// //
// This source is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. //
////////////////////////////////////////////////////////////////////////////////////////////////
module F_function(
input clk,
input reset_n,
input [7:0] C,
input [7:0] D,
input [7:0] SK0,
input [7:0] SK1,
input [4:0] main_counter,
output [7:0] Cn,
output [7:0] Dn
);
wire [7:0] CK0 = C^SK0 ;
wire [7:0] DK1 = D^SK1^CK0 ;
wire [7:0] C_out0;
wire [7:0] D_out0;
wire [7:0] C_IN = (main_counter < 8) ? CK0 : D_out0;
wire [7:0] D_IN = (main_counter < 8) ? DK1 : C_out0;
SF_Function sub_f_round0(
.clk (clk),
.reset_n (reset_n),
.C (C_IN),
.D (D_IN),
.main_counter (main_counter),
.Cn (C_out0),
.Dn (D_out0)
);
assign Cn = C_out0;
assign Dn = D_out0;
endmodule