OpenCores
URL https://opencores.org/ocsvn/aes_decry_ip_128bit/aes_decry_ip_128bit/trunk

Subversion Repositories aes_decry_ip_128bit

[/] [aes_decry_ip_128bit/] [trunk/] [rtl/] [key_schd/] [one_round_key.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 ghegde
--************************************************************
2
--Copyright 2015, Ganesh Hegde < ghegde@opencores.org >      
3
--                                                           
4
--This source file may be used and distributed without  
5
--restriction provided that this copyright statement is not 
6
--removed from the file and that any derivative work contains
7
--the original copyright notice and the associated disclaimer.
8
--
9
--This source is distributed in the hope that it will be
10
--useful, but WITHOUT ANY WARRANTY; without even the implied
11
--warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
--PURPOSE.  See the GNU Lesser General Public License for more
13
--details.
14
--
15
--You should have received a copy of the GNU Lesser General
16
--Public License along with this source; if not, download it
17
--from http://www.opencores.org/lgpl.shtml
18
--
19
--*************************************************************
20
 
21
--*************************************************************
22
--This module generates one 128 bit key for next round given the current key as input.
23
--Logic type : Combinational
24
--*************************************************************
25
 
26
library ieee;
27
use ieee.std_logic_1164.all;
28
 
29
entity one_round_key is
30
port(
31
         in_key: in std_logic_vector(127 downto 0);
32
         out_key: out std_logic_vector(127 downto 0);
33
         rcon: in std_logic_vector(7 downto 0)
34
        );
35
end one_round_key;
36
 
37
architecture beh_one_round_key of one_round_key is
38
   component Sub_4bytes
39
   port(
40
     word_in: in std_logic_vector(31 downto 0);
41
         word_out: out std_logic_vector(31 downto 0)
42
     );
43
   end component;
44
 
45
   signal k0,k1,k2,k3: std_logic_vector(31 downto 0);
46
   signal k0out,k1out,k2out,k3out: std_logic_vector(31 downto 0);
47
   signal k3_rot_sub,k3_rot:std_logic_vector(31 downto 0);
48
 
49
begin
50
        k0 <= in_key(127 downto 96);
51
        k1 <= in_key(95 downto 64);
52
        k2 <= in_key(63 downto 32);
53
        k3 <= in_key(31 downto 0);
54
 
55
        k3_rot <= k3(23 downto 0) & k3(31 downto 24);
56
 
57
        Sub_4bytes_inst:Sub_4bytes
58
        port map(word_in=>k3_rot,word_out=>k3_rot_sub);
59
 
60
        k0out <= k3_rot_sub xor k0 xor (rcon & x"000000");
61
        k1out <= k0out xor k1;
62
        k2out <= k1out xor k2;
63
        k3out <= k2out  xor k3;
64
 
65
        out_key <= k0out & k1out & k2out & k3out;
66
 
67
end beh_one_round_key;

powered by: WebSVN 2.1.0

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