--- ============================================================================
--
-- Design unit      :   aes
--
-- File Name        :   aes_row_ops.vhd
--
-- Purpose          :   Row shift operations for ciper and inverse ciphers
--
--
-- 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>
--                      J. Ahrensfeld (ja) <ja@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 ieee.numeric_bit.all;

use work.aes_gf_2exp8_arith.all;


package aes_row_ops is


	type row_t is array (0 to 3) of gf_2exp8_t;


	function shift_row(row : in row_t; steps : natural) return row_t;

	function inv_shift_row(row : in row_t; steps : natural) return row_t;


end aes_row_ops;


package body aes_row_ops is


	function shift_row(row : in row_t; steps : natural) return row_t is
		variable a_row : row_t;
	begin
		for i in a_row'range loop
			a_row(i) := row((i + steps) mod row'length);
		end loop;

		return a_row;
	end shift_row;


	function inv_shift_row(row : in row_t; steps : natural) return row_t is
		variable a_row : row_t;
	begin
		for i in a_row'range loop
			a_row(i) := row((i - steps + row'length) mod row'length);
		end loop;

		return a_row;
	end inv_shift_row;


end aes_row_ops;
