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

Subversion Repositories aes_pipe

[/] [aes_pipe/] [trunk/] [rtl/] [vhdl/] [addkey.vhdl] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 subhasis25
----------------------------------------------------------------------
2
----                                                              ----
3 5 subhasis25
---- Pipelined Aes IP Core                                        ----
4
----                                                              ----
5
---- This file is part of the Pipelined AES project               ----
6
---- http://www.opencores.org/cores/aes_pipe/                     ----
7
----                                                              ----
8
---- Description                                                  ----
9
---- Implementation of AES IP core according to                   ----
10
---- FIPS PUB 197 specification document.                         ----
11
----                                                              ----
12
---- To Do:                                                       ----
13
----   -                                                          ----
14
----                                                              ----
15
---- Author:                                                      ----
16
----      - Subhasis Das, subhasis256@gmail.com                   ----
17
----                                                              ----
18
----------------------------------------------------------------------
19
----                                                              ----
20
---- Copyright (C) 2009 Authors and OPENCORES.ORG                 ----
21
----                                                              ----
22 2 subhasis25
---- This source file may be used and distributed without         ----
23
---- restriction provided that this copyright statement is not    ----
24 5 subhasis25
---- removed from the file and that any derivative work contains ----
25 2 subhasis25
---- the original copyright notice and the associated disclaimer. ----
26
----                                                              ----
27
---- This source file is free software; you can redistribute it   ----
28
---- and/or modify it under the terms of the GNU Lesser General   ----
29
---- Public License as published by the Free Software Foundation; ----
30
---- either version 2.1 of the License, or (at your option) any   ----
31
---- later version.                                               ----
32
----                                                              ----
33
---- This source is distributed in the hope that it will be       ----
34
---- useful, but WITHOUT ANY WARRANTY; without even the implied   ----
35
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ----
36 5 subhasis25
---- PURPOSE. See the GNU Lesser General Public License for more ----
37 2 subhasis25
---- details.                                                     ----
38
----                                                              ----
39
---- You should have received a copy of the GNU Lesser General    ----
40
---- Public License along with this source; if not, download it   ----
41 5 subhasis25
---- from http://www.opencores.org/lgpl.shtml                     ----
42 2 subhasis25
----                                                              ----
43
----------------------------------------------------------------------
44
------------------------------------------------------
45
-- Project: AESFast
46
-- Author: Subhasis
47 9 subhasis25
-- Last Modified: 25/03/10
48 2 subhasis25
-- Email: subhasis256@gmail.com
49
------------------------------------------------------
50
--
51
-- Description: The AddKey step
52
-- Ports:
53
--                      clk: System Clock
54
--                      roundkey: The RoundKey block for this round
55
--                      datain: Input State block
56
--                      rcon: The rcon byte corresponding to the current stage
57
--                      dataout: datain xor roundkey
58
--                      fc3: See keysched1 for explanation
59
--                      c0: See keysched1 for explanation
60
--                      c1: See keysched1 for explanation
61
--                      c2: See keysched1 for explanation
62
--                      c3: See keysched1 for explanation
63
------------------------------------------------------
64
 
65
library IEEE;
66
use IEEE.std_logic_1164.all;
67
use IEEE.std_logic_arith.all;
68
use IEEE.std_logic_unsigned.all;
69
 
70
library work;
71
use work.aes_pkg.all;
72
 
73
entity addkey is
74
port(
75
        clk: in std_logic;
76 9 subhasis25
        rst: in std_logic;
77 2 subhasis25
        roundkey: in datablock;
78
        datain: in datablock;
79
        rcon: in std_logic_vector(7 downto 0);
80
        dataout: out datablock;
81
        fc3: out blockcol;
82
        c0: out blockcol;
83
        c1: out blockcol;
84
        c2: out blockcol;
85
        c3: out blockcol
86
        );
87
end addkey;
88
 
89
architecture rtl of addkey is
90
component keysched1 is
91
port(
92
        clk: in std_logic;
93 9 subhasis25
        rst: in std_logic;
94 2 subhasis25
        roundkey: in datablock;
95
        rcon: in std_logic_vector(7 downto 0);
96
        fc3: out blockcol;
97
        c0: out blockcol;
98
        c1: out blockcol;
99
        c2: out blockcol;
100
        c3: out blockcol
101
        );
102
end component;
103
signal added: datablock;
104
begin
105
        step1: keysched1 port map(
106
                                                         clk => clk,
107 9 subhasis25
                                                         rst => rst,
108 2 subhasis25
                                                         roundkey => roundkey,
109
                                                         rcon => rcon,
110
                                                         fc3 => fc3,
111
                                                         c0 => c0,
112
                                                         c1 => c1,
113
                                                         c2 => c2,
114
                                                         c3 => c3
115
                                                         );
116
        g0: for i in 3 downto 0 generate
117
                g1: for j in 3 downto 0 generate
118
                        added(i,j) <= datain(i,j) xor roundkey(i,j);
119
                end generate;
120
        end generate;
121
 
122 9 subhasis25
        process(clk,rst)
123 2 subhasis25
        begin
124 9 subhasis25
                if(rst = '1') then
125
                        dataout <= zero_data;
126
                elsif(rising_edge(clk)) then
127 2 subhasis25
                        dataout <= added;
128
                end if;
129
        end process;
130
end rtl;

powered by: WebSVN 2.1.0

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