1 |
2 |
dsocek |
---------------------------------------------------------------------
|
2 |
|
|
-- (c) Copyright 2006, CoreTex Systems, LLC --
|
3 |
|
|
-- www.coretexsys.com --
|
4 |
|
|
-- --
|
5 |
|
|
-- This source file may be used and distributed without --
|
6 |
|
|
-- restriction provided that this copyright statement is not --
|
7 |
|
|
-- removed from the file and that any derivative work contains --
|
8 |
|
|
-- the original copyright notice and the associated disclaimer. --
|
9 |
|
|
-- --
|
10 |
|
|
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY --
|
11 |
|
|
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED --
|
12 |
|
|
-- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS --
|
13 |
|
|
-- FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR --
|
14 |
|
|
-- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, --
|
15 |
|
|
-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES --
|
16 |
|
|
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE --
|
17 |
|
|
-- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR --
|
18 |
|
|
-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
|
19 |
|
|
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
|
20 |
|
|
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT --
|
21 |
|
|
-- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE --
|
22 |
|
|
-- POSSIBILITY OF SUCH DAMAGE. --
|
23 |
|
|
-- --
|
24 |
|
|
---------------------------------------------------------------------
|
25 |
|
|
|
26 |
|
|
----------------------------------------------------------------------
|
27 |
|
|
|
28 |
|
|
-- Poject structure:
|
29 |
|
|
|
30 |
|
|
-- |- tdes_top.vhd
|
31 |
|
|
-- |
|
32 |
|
|
-- |- des_cipher_top.vhd
|
33 |
|
|
-- |- des_top.vhd
|
34 |
|
|
-- |- block_top.vhd
|
35 |
|
|
-- |- add_key.vhd
|
36 |
|
|
-- |
|
37 |
|
|
-- |- add_left.vhd
|
38 |
|
|
-- |
|
39 |
|
|
-- |- e_expansion_function.vhd
|
40 |
|
|
-- |
|
41 |
|
|
-- |- p_box.vhd
|
42 |
|
|
-- |
|
43 |
|
|
-- |- s_box.vhd
|
44 |
|
|
-- |- s1_box.vhd
|
45 |
|
|
-- |- s2_box.vhd
|
46 |
|
|
-- |- s3_box.vhd
|
47 |
|
|
-- |- s4_box.vhd
|
48 |
|
|
-- |- s5_box.vhd
|
49 |
|
|
-- |- s6_box.vhd
|
50 |
|
|
-- |- s7_box.vhd
|
51 |
|
|
-- |- s8_box.vhd
|
52 |
|
|
-- |- key_schedule.vhd
|
53 |
|
|
|
54 |
|
|
----------------------------------------------------------------------
|
55 |
|
|
|
56 |
|
|
---------------------------------------------------------------------------------------------------
|
57 |
|
|
--
|
58 |
|
|
-- Title : e_expansion_function
|
59 |
|
|
-- Company : CoreTex Systems, LLC
|
60 |
|
|
--
|
61 |
|
|
---------------------------------------------------------------------------------------------------
|
62 |
|
|
|
63 |
|
|
library IEEE;
|
64 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
65 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
66 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
67 |
|
|
|
68 |
|
|
entity e_expansion_function is
|
69 |
|
|
port(
|
70 |
|
|
x_in: in std_logic_vector(0 to 31);
|
71 |
|
|
block0_out: out std_logic_vector(0 to 5);
|
72 |
|
|
block1_out: out std_logic_vector(0 to 5);
|
73 |
|
|
block2_out: out std_logic_vector(0 to 5);
|
74 |
|
|
block3_out: out std_logic_vector(0 to 5);
|
75 |
|
|
block4_out: out std_logic_vector(0 to 5);
|
76 |
|
|
block5_out: out std_logic_vector(0 to 5);
|
77 |
|
|
block6_out: out std_logic_vector(0 to 5);
|
78 |
|
|
block7_out: out std_logic_vector(0 to 5)
|
79 |
|
|
);
|
80 |
|
|
end e_expansion_function;
|
81 |
|
|
|
82 |
|
|
architecture Behavioral of e_expansion_function is
|
83 |
|
|
|
84 |
|
|
begin
|
85 |
|
|
|
86 |
|
|
block0_out <= x_in(31) & x_in(0) & x_in(1) & x_in(2) & x_in(3) & x_in(4);
|
87 |
|
|
block1_out <= x_in(3) & x_in(4) & x_in(5) & x_in(6) & x_in(7) & x_in(8);
|
88 |
|
|
block2_out <= x_in(7) & x_in(8) & x_in(9) & x_in(10) & x_in(11) & x_in(12);
|
89 |
|
|
block3_out <= x_in(11) & x_in(12) & x_in(13) & x_in(14) & x_in(15) & x_in(16);
|
90 |
|
|
block4_out <= x_in(15) & x_in(16) & x_in(17) & x_in(18) & x_in(19) & x_in(20);
|
91 |
|
|
block5_out <= x_in(19) & x_in(20) & x_in(21) & x_in(22) & x_in(23) & x_in(24);
|
92 |
|
|
block6_out <= x_in(23) & x_in(24) & x_in(25) & x_in(26) & x_in(27) & x_in(28);
|
93 |
|
|
block7_out <= x_in(27) & x_in(28) & x_in(29) & x_in(30) & x_in(31) & x_in(0);
|
94 |
|
|
|
95 |
|
|
end Behavioral;
|