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 |
|
|
-- Last Modified: 20/03/10
|
48 |
|
|
-- Email: subhasis256@gmail.com
|
49 |
|
|
------------------------------------------------------
|
50 |
|
|
--
|
51 |
|
|
-- Description: The MixColumns step
|
52 |
|
|
-- Ports:
|
53 |
|
|
-- clk: System Clock
|
54 |
|
|
-- datain: Input State block
|
55 |
|
|
-- inrkey: Input round key for passing on
|
56 |
|
|
-- to the next stage, i.e. Addkey
|
57 |
|
|
-- outrkey: Output round key to next stage
|
58 |
|
|
-- dataout: Output state block
|
59 |
|
|
------------------------------------------------------
|
60 |
|
|
|
61 |
|
|
library IEEE;
|
62 |
|
|
use IEEE.std_logic_1164.all;
|
63 |
|
|
use IEEE.std_logic_arith.all;
|
64 |
|
|
use IEEE.std_logic_unsigned.all;
|
65 |
|
|
|
66 |
|
|
library work;
|
67 |
|
|
use work.aes_pkg.all;
|
68 |
|
|
|
69 |
|
|
entity colmix is
|
70 |
|
|
port(
|
71 |
|
|
clk: in std_logic;
|
72 |
|
|
datain: in datablock;
|
73 |
|
|
inrkey: in datablock;
|
74 |
|
|
outrkey: out datablock;
|
75 |
|
|
dataout: out datablock
|
76 |
|
|
);
|
77 |
|
|
end colmix;
|
78 |
|
|
|
79 |
|
|
architecture rtl of colmix is
|
80 |
|
|
component mixcol is
|
81 |
|
|
port(
|
82 |
|
|
clk: in std_logic;
|
83 |
|
|
in0: in std_logic_vector(7 downto 0);
|
84 |
|
|
in1: in std_logic_vector(7 downto 0);
|
85 |
|
|
in2: in std_logic_vector(7 downto 0);
|
86 |
|
|
in3: in std_logic_vector(7 downto 0);
|
87 |
|
|
out0: out std_logic_vector(7 downto 0);
|
88 |
|
|
out1: out std_logic_vector(7 downto 0);
|
89 |
|
|
out2: out std_logic_vector(7 downto 0);
|
90 |
|
|
out3: out std_logic_vector(7 downto 0)
|
91 |
|
|
);
|
92 |
|
|
end component;
|
93 |
|
|
|
94 |
|
|
begin
|
95 |
|
|
-- Do the mixcol operation on all the 4 columns
|
96 |
|
|
g0: for i in 3 downto 0 generate
|
97 |
|
|
mix: mixcol port map(
|
98 |
|
|
clk => clk,
|
99 |
|
|
in0 => datain(0, i),
|
100 |
|
|
in1 => datain(1, i),
|
101 |
|
|
in2 => datain(2, i),
|
102 |
|
|
in3 => datain(3, i),
|
103 |
|
|
out0 => dataout(0, i),
|
104 |
|
|
out1 => dataout(1, i),
|
105 |
|
|
out2 => dataout(2, i),
|
106 |
|
|
out3 => dataout(3, i)
|
107 |
|
|
);
|
108 |
|
|
end generate;
|
109 |
|
|
process(clk)
|
110 |
|
|
begin
|
111 |
|
|
if(rising_edge(clk)) then
|
112 |
|
|
outrkey <= inrkey;
|
113 |
|
|
end if;
|
114 |
|
|
end process;
|
115 |
|
|
end rtl;
|