OpenCores
URL https://opencores.org/ocsvn/3des_vhdl/3des_vhdl/trunk

Subversion Repositories 3des_vhdl

[/] [3des_vhdl/] [trunk/] [VHDL/] [s_box.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
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       : s_box
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 s_box is
69
port(
70
                block0_in: in std_logic_vector(5 downto 0);
71
                        block1_in: in std_logic_vector(5 downto 0);
72
                        block2_in: in std_logic_vector(5 downto 0);
73
                        block3_in: in std_logic_vector(5 downto 0);
74
                        block4_in: in std_logic_vector(5 downto 0);
75
                        block5_in: in std_logic_vector(5 downto 0);
76
                        block6_in: in std_logic_vector(5 downto 0);
77
                        block7_in: in std_logic_vector(5 downto 0);
78
                        x0_out: out std_logic_vector(3 downto 0);
79
                        x1_out: out std_logic_vector(3 downto 0);
80
                        x2_out: out std_logic_vector(3 downto 0);
81
                        x3_out: out std_logic_vector(3 downto 0);
82
                        x4_out: out std_logic_vector(3 downto 0);
83
                        x5_out: out std_logic_vector(3 downto 0);
84
                        x6_out: out std_logic_vector(3 downto 0);
85
                        x7_out: out std_logic_vector(3 downto 0)
86
        );
87
end s_box;
88
 
89
architecture Behavioral of s_box is
90
 
91
component s1_box
92
        port(
93
        a: in  std_logic_VECTOR(5 downto 0);
94
        spo: out std_logic_VECTOR(3 downto 0)
95
        );
96
end component;
97
 
98
component s2_box
99
        port(
100
        a: in  std_logic_VECTOR(5 downto 0);
101
        spo: out std_logic_VECTOR(3 downto 0)
102
        );
103
end component;
104
 
105
component s3_box
106
        port(
107
        a: in  std_logic_VECTOR(5 downto 0);
108
        spo: out std_logic_VECTOR(3 downto 0)
109
        );
110
end component;
111
 
112
component s4_box
113
        port(
114
        a: in  std_logic_VECTOR(5 downto 0);
115
        spo: out std_logic_VECTOR(3 downto 0)
116
        );
117
end component;
118
 
119
component s5_box
120
        port(
121
        a: in  std_logic_VECTOR(5 downto 0);
122
        spo: out std_logic_VECTOR(3 downto 0)
123
        );
124
end component;
125
 
126
component s6_box
127
        port(
128
        a: in  std_logic_VECTOR(5 downto 0);
129
        spo: out std_logic_VECTOR(3 downto 0)
130
        );
131
end component;
132
 
133
component s7_box
134
        port(
135
        a: in  std_logic_VECTOR(5 downto 0);
136
        spo: out std_logic_VECTOR(3 downto 0)
137
        );
138
end component;
139
 
140
component s8_box
141
        port(
142
        a: in  std_logic_VECTOR(5 downto 0);
143
        spo: out std_logic_VECTOR(3 downto 0)
144
        );
145
end component;
146
 
147
begin
148
 
149
S1 : s1_box
150
        port map (
151
                a => block0_in,
152
                spo => x0_out
153
);
154
 
155
S2 : s2_box
156
        port map (
157
                a => block1_in,
158
                spo => x1_out
159
);
160
 
161
S3 : s3_box
162
        port map (
163
                a => block2_in,
164
                spo => x2_out
165
);
166
 
167
S4 : s4_box
168
        port map (
169
                a => block3_in,
170
                spo => x3_out
171
);
172
 
173
S5 : s5_box
174
        port map (
175
                a => block4_in,
176
                spo => x4_out
177
);
178
 
179
S6 : s6_box
180
        port map (
181
                a => block5_in,
182
                spo => x5_out
183
);
184
 
185
S7 : s7_box
186
        port map (
187
                a => block6_in,
188
                spo => x6_out
189
);
190
 
191
S8 : s8_box
192
        port map (
193
                a => block7_in,
194
                spo => x7_out
195
);
196
 
197
end Behavioral;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.