Line 42... |
Line 42... |
---- ----
|
---- ----
|
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
------------------------------------------------------
|
------------------------------------------------------
|
-- Project: AESFast
|
-- Project: AESFast
|
-- Author: Subhasis
|
-- Author: Subhasis
|
-- Last Modified: 20/03/10
|
-- Last Modified: 25/03/10
|
-- Email: subhasis256@gmail.com
|
-- Email: subhasis256@gmail.com
|
------------------------------------------------------
|
------------------------------------------------------
|
--
|
--
|
-- Description: The MixColumns step
|
-- Description: The MixColumns step
|
-- Ports:
|
-- Ports:
|
Line 67... |
Line 67... |
use work.aes_pkg.all;
|
use work.aes_pkg.all;
|
|
|
entity colmix is
|
entity colmix is
|
port(
|
port(
|
clk: in std_logic;
|
clk: in std_logic;
|
|
rst: in std_logic;
|
datain: in datablock;
|
datain: in datablock;
|
inrkey: in datablock;
|
inrkey: in datablock;
|
outrkey: out datablock;
|
outrkey: out datablock;
|
dataout: out datablock
|
dataout: out datablock
|
);
|
);
|
Line 78... |
Line 79... |
|
|
architecture rtl of colmix is
|
architecture rtl of colmix is
|
component mixcol is
|
component mixcol is
|
port(
|
port(
|
clk: in std_logic;
|
clk: in std_logic;
|
|
rst: in std_logic;
|
in0: in std_logic_vector(7 downto 0);
|
in0: in std_logic_vector(7 downto 0);
|
in1: in std_logic_vector(7 downto 0);
|
in1: in std_logic_vector(7 downto 0);
|
in2: in std_logic_vector(7 downto 0);
|
in2: in std_logic_vector(7 downto 0);
|
in3: in std_logic_vector(7 downto 0);
|
in3: in std_logic_vector(7 downto 0);
|
out0: out std_logic_vector(7 downto 0);
|
out0: out std_logic_vector(7 downto 0);
|
Line 94... |
Line 96... |
begin
|
begin
|
-- Do the mixcol operation on all the 4 columns
|
-- Do the mixcol operation on all the 4 columns
|
g0: for i in 3 downto 0 generate
|
g0: for i in 3 downto 0 generate
|
mix: mixcol port map(
|
mix: mixcol port map(
|
clk => clk,
|
clk => clk,
|
|
rst => rst,
|
in0 => datain(0, i),
|
in0 => datain(0, i),
|
in1 => datain(1, i),
|
in1 => datain(1, i),
|
in2 => datain(2, i),
|
in2 => datain(2, i),
|
in3 => datain(3, i),
|
in3 => datain(3, i),
|
out0 => dataout(0, i),
|
out0 => dataout(0, i),
|
out1 => dataout(1, i),
|
out1 => dataout(1, i),
|
out2 => dataout(2, i),
|
out2 => dataout(2, i),
|
out3 => dataout(3, i)
|
out3 => dataout(3, i)
|
);
|
);
|
end generate;
|
end generate;
|
process(clk)
|
process(clk,rst)
|
begin
|
begin
|
if(rising_edge(clk)) then
|
if(rst = '1') then
|
|
outrkey <= zero_data;
|
|
elsif(rising_edge(clk)) then
|
outrkey <= inrkey;
|
outrkey <= inrkey;
|
end if;
|
end if;
|
end process;
|
end process;
|
end rtl;
|
end rtl;
|
|
|
No newline at end of file
|
No newline at end of file
|