Files
vhdl/projects/messe_demo/src/AES_32bit_datapath/aes_encryption.vhd
T
jens 73cfd45401 - added
git-svn-id: http://moon:8086/svn/vhdl/trunk@1423 cc03376c-175c-47c8-b038-4cd826a8556b
2021-03-21 11:31:55 +00:00

111 lines
2.5 KiB
VHDL

--- ============================================================================
--
-- Design unit : aes_encryption
--
-- File Name : aes_encryption.vhd
--
-- Purpose : Design file
--
--
-- Depends on :
--
-- - Package(s) : -
--
-- - Module(s) : -
--
--
-- Dev. Platform : Xilinx ISE 8.1i SP3 / Win32 (W2k SP4)
--
-- - Simulator(s) : Modelsim XE III 6.0d
--
-- - Synthesis : Xilinx XST
--
-- - Place & Route : Xilinx PAR
--
--
-- Errors : None known
--
--
-- Limitations : None known
--
--
-- Notes : -
--
--
-- Author(s) : A. Freund (af) <a.freund@dsi-it.de>,
-- M.v.d.Wall (mvdw) <vdwall@dsi-it.de>
-- Digitale Signalverabeitung & Informationstechnik GmbH,
-- Bremen, Germany
--
-- ============================================================================
--
-- Revision List:
--
-- see SVN logs
--
-- ============================================================================
--
-- Naming conventions:
--
-- - coding style: record-signals for related purposes (Gaisler-style)
-- - active-low signals are indicated by appending "_n"
-- - constants are in UPPERCASE
-- - name parts are separated by "_"
--
-- ============================================================================
library ieee;
use ieee.std_logic_1164.all;
use work.aes_definitions.all;
use work.aes_common.all;
use work.aes_column_ops.all;
use work.aes_row_ops.all;
package aes_encryption is
function mix_columns(st : in aes_state_t) return aes_state_t;
function shift_rows(st : in aes_state_t) return aes_state_t;
end aes_encryption;
package body aes_encryption is
function mix_columns(st : in aes_state_t) return aes_state_t is
type columns_t is array(0 to 3) of column_t;
variable v_cols : columns_t;
variable v_st : aes_state_t;
begin
for i in v_cols'range loop
v_cols(i) := mix_column(select_column(st, i));
v_st := replace_column(v_st, v_cols(i), i);
end loop;
return v_st;
end mix_columns;
function shift_rows(st : in aes_state_t) return aes_state_t is
type rows_t is array(0 to 3) of row_t;
variable v_rows : rows_t;
variable v_st : aes_state_t;
begin
for i in v_rows'range loop
v_rows(i) := shift_row(select_row(st, i), i);
v_st := replace_row(v_st, v_rows(i), i);
end loop;
return v_st;
end shift_rows;
end aes_encryption;