1 |
21 |
rameli |
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
|
2 |
|
|
// Design Name: Substitution & Permutation for Present Cipher //
|
3 |
|
|
// Module Name: sub_per //
|
4 |
|
|
// Language: Verilog //
|
5 |
|
|
// Date Created: 1/16/2011 //
|
6 |
|
|
// Author: Reza Ameli //
|
7 |
|
|
// Digital Systems Lab //
|
8 |
|
|
// Ferdowsi University of Mashhad, Iran //
|
9 |
|
|
// http://commeng.um.ac.ir/dslab //
|
10 |
|
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
|
11 |
|
|
// //
|
12 |
|
|
// This source file may be used and distributed without //
|
13 |
|
|
// restriction provided that this copyright statement is not //
|
14 |
|
|
// removed from the file and that any derivative work contains //
|
15 |
|
|
// the original copyright notice and the associated disclaimer. //
|
16 |
|
|
// //
|
17 |
|
|
// This source file is free software; you can redistribute it //
|
18 |
|
|
// and/or modify it under the terms of the GNU Lesser General //
|
19 |
|
|
// Public License as published by the Free Software Foundation; //
|
20 |
|
|
// either version 2.1 of the License, or (at your option) any //
|
21 |
|
|
// later version. //
|
22 |
|
|
// //
|
23 |
|
|
// This source is distributed in the hope that it will be //
|
24 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied //
|
25 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
|
26 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more //
|
27 |
|
|
// details. //
|
28 |
|
|
// //
|
29 |
|
|
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@//
|
30 |
|
|
|
31 |
|
|
module sub_per(data_o,data_i); // this module cascades the substitution and permutation layers of the cipher and builds a
|
32 |
|
|
// single entity containing both of them
|
33 |
|
|
|
34 |
|
|
//- Module IOs ----------------------------------------------------------------
|
35 |
|
|
|
36 |
|
|
output wire[63:0] data_o;
|
37 |
|
|
input wire[63:0] data_i;
|
38 |
|
|
|
39 |
|
|
//- Variables, Registers and Parameters ---------------------------------------
|
40 |
|
|
|
41 |
|
|
wire [63:0] s; // intermediate signal
|
42 |
|
|
|
43 |
|
|
//- Instantiations ------------------------------------------------------------
|
44 |
|
|
|
45 |
|
|
substitution sub_per_substitution(.data_o(s) ,.data_i(data_i)); // input of the S-Box is data_i
|
46 |
|
|
permutation sub_per_permutation (.data_o(data_o),.data_i(s)); // output os Permutation layer is data_o
|
47 |
|
|
|
48 |
|
|
//-----------------------------------------------------------------------------
|
49 |
|
|
endmodule
|