1 |
4 |
gajos |
-----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- Present - a lightweight block cipher project ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the Present - a lightweight block ----
|
6 |
|
|
---- cipher project ----
|
7 |
|
|
---- http://www.http://opencores.org/project,present ----
|
8 |
|
|
---- ----
|
9 |
|
|
---- Description: ----
|
10 |
|
|
---- Permutation layer of Present cipher. Simple signal mixing.----
|
11 |
|
|
---- For more information see ----
|
12 |
|
|
---- http://homes.esat.kuleuven.be/~abogdano/papers/ ----
|
13 |
|
|
---- present_ches07.pdf ----
|
14 |
|
|
---- To Do: ----
|
15 |
|
|
---- ----
|
16 |
|
|
---- Author(s): ----
|
17 |
|
|
---- - Krzysztof Gajewski, gajos@opencores.org ----
|
18 |
|
|
---- k.gajewski@gmail.com ----
|
19 |
|
|
---- ----
|
20 |
|
|
-----------------------------------------------------------------------
|
21 |
|
|
---- ----
|
22 |
|
|
---- Copyright (C) 2013 Authors and OPENCORES.ORG ----
|
23 |
|
|
---- ----
|
24 |
|
|
---- This source file may be used and distributed without ----
|
25 |
|
|
---- restriction provided that this copyright statement is not ----
|
26 |
|
|
---- removed from the file and that any derivative work contains ----
|
27 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
28 |
|
|
---- ----
|
29 |
|
|
---- This source file is free software; you can redistribute it ----
|
30 |
|
|
---- and-or modify it under the terms of the GNU Lesser General ----
|
31 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
32 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
33 |
|
|
---- later version. ----
|
34 |
|
|
---- ----
|
35 |
|
|
---- This source is distributed in the hope that it will be ----
|
36 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
37 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
38 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
39 |
|
|
---- details. ----
|
40 |
|
|
---- ----
|
41 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
42 |
|
|
---- Public License along with this source; if not, download it ----
|
43 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
44 |
|
|
---- ----
|
45 |
|
|
-----------------------------------------------------------------------
|
46 |
3 |
gajos |
library IEEE;
|
47 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
48 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
49 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
50 |
|
|
|
51 |
|
|
entity pLayer is
|
52 |
|
|
generic(w_64 : integer := 64);
|
53 |
|
|
port (
|
54 |
|
|
input : in std_logic_vector(w_64-1 downto 0);
|
55 |
|
|
output : out std_logic_vector(w_64-1 downto 0)
|
56 |
|
|
);
|
57 |
|
|
end pLayer;
|
58 |
|
|
|
59 |
|
|
architecture Behavioral of pLayer is
|
60 |
|
|
begin
|
61 |
|
|
output(0) <= input(0);
|
62 |
|
|
output(16) <= input(1);
|
63 |
|
|
output(32) <= input(2);
|
64 |
|
|
output(48) <= input(3);
|
65 |
|
|
output(1) <= input(4);
|
66 |
|
|
output(17) <= input(5);
|
67 |
|
|
output(33) <= input(6);
|
68 |
|
|
output(49) <= input(7);
|
69 |
|
|
output(2) <= input(8);
|
70 |
|
|
output(18) <= input(9);
|
71 |
|
|
output(34) <= input(10);
|
72 |
|
|
output(50) <= input(11);
|
73 |
|
|
output(3) <= input(12);
|
74 |
|
|
output(19) <= input(13);
|
75 |
|
|
output(35) <= input(14);
|
76 |
|
|
output(51) <= input(15);
|
77 |
|
|
output(4) <= input(16);
|
78 |
|
|
output(20) <= input(17);
|
79 |
|
|
output(36) <= input(18);
|
80 |
|
|
output(52) <= input(19);
|
81 |
|
|
output(5) <= input(20);
|
82 |
|
|
output(21) <= input(21);
|
83 |
|
|
output(37) <= input(22);
|
84 |
|
|
output(53) <= input(23);
|
85 |
|
|
output(6) <= input(24);
|
86 |
|
|
output(22) <= input(25);
|
87 |
|
|
output(38) <= input(26);
|
88 |
|
|
output(54) <= input(27);
|
89 |
|
|
output(7) <= input(28);
|
90 |
|
|
output(23) <= input(29);
|
91 |
|
|
output(39) <= input(30);
|
92 |
|
|
output(55) <= input(31);
|
93 |
|
|
output(8) <= input(32);
|
94 |
|
|
output(24) <= input(33);
|
95 |
|
|
output(40) <= input(34);
|
96 |
|
|
output(56) <= input(35);
|
97 |
|
|
output(9) <= input(36);
|
98 |
|
|
output(25) <= input(37);
|
99 |
|
|
output(41) <= input(38);
|
100 |
|
|
output(57) <= input(39);
|
101 |
|
|
output(10) <= input(40);
|
102 |
|
|
output(26) <= input(41);
|
103 |
|
|
output(42) <= input(42);
|
104 |
|
|
output(58) <= input(43);
|
105 |
|
|
output(11) <= input(44);
|
106 |
|
|
output(27) <= input(45);
|
107 |
|
|
output(43) <= input(46);
|
108 |
|
|
output(59) <= input(47);
|
109 |
|
|
output(12) <= input(48);
|
110 |
|
|
output(28) <= input(49);
|
111 |
|
|
output(44) <= input(50);
|
112 |
|
|
output(60) <= input(51);
|
113 |
|
|
output(13) <= input(52);
|
114 |
|
|
output(29) <= input(53);
|
115 |
|
|
output(45) <= input(54);
|
116 |
|
|
output(61) <= input(55);
|
117 |
|
|
output(14) <= input(56);
|
118 |
|
|
output(30) <= input(57);
|
119 |
|
|
output(46) <= input(58);
|
120 |
|
|
output(62) <= input(59);
|
121 |
|
|
output(15) <= input(60);
|
122 |
|
|
output(31) <= input(61);
|
123 |
|
|
output(47) <= input(62);
|
124 |
|
|
output(63) <= input(63);
|
125 |
|
|
end Behavioral;
|