-- ============================================================================
--
-- Design unit      :   key_schedule_iface (interfaces of 128-bit and 256-bit
--                      key schedule)
--
-- File Name        :   key_schedule_iface.vhd
--
-- Purpose          :   The package collects type declarations for all non-
--                      trivial interfaces of used entities. Record types
--                      are used extensively to group related signals (e.g.
--                      data / control & status, physical attachment etc.).
--
--
-- Depends on       :
--
--  - Package(s)    :   aes_definitions, tech_iface
--
--  - 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            :   Version for implementation using 32-bit datapath
--
--
-- Author(s)        :   A. Freund (af) <a.freund@dsi-it.de>
--                      Digitale Signalverabeitung & Informationstechnik GmbH,
--                      Bremen, Germany
--
--
-- ============================================================================
--
-- Revision List:
-- Version      Author(s)       Date        Changes
--
-- v0.00        af              2006-11-14  initial version
--
-- 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.tech_iface.all;


package key_schedule_iface is


--
-- 256-bit key schedule interface definition
--


	-- key/control input signals
	type key_schedule_256_in_type is record
		load_key	:	std_logic;						-- load key / start expansion
		key			:	part_data_t;					-- encryption/decryption key
		key_id		:	key_id_t;						-- key id to use
	end record;


	-- status output signals
	type key_schedule_256_out_type is record
		busy	:	std_logic;							-- busy, key expansion in progress
	end record;


--
-- 128-bit key schedule interface definition
--


	-- key/control input signals
	type key_schedule_128_in_type is record
		load_key	:	std_logic;						-- load key / start expansion
		key			:	part_data_t;					-- encryption/decryption key
		key_id		:	key_id_t;						-- key id to use
	end record;


	-- status output signals
	type key_schedule_128_out_type is record
		busy	:	std_logic;							-- busy, key expansion in progress
	end record;


--
--
-- Component declarations
--
--


	-- 256-bit key schedule
	component key_schedule_256 is
		port (
			rst			: 	in	std_logic;					-- reset
			clk			:	in	std_logic;					-- clock
			key_i		:	in	key_schedule_256_in_type;	-- see package key_schedule_iface
			key_o		:	out	key_schedule_256_out_type;	-- see package key_schedule_iface
			sbox_i		:	in	sbox_stage_out_type;		-- see package tech_iface
			sbox_o		:	out	sbox_stage_in_type;			-- see package tech_iface
			skm_enc_o	:	out	subkey_memory_ks_in_type;	-- see package tech_iface
			skm_dec_o	:	out	subkey_memory_ks_in_type	-- see package tech_iface
		);
	end component;


	-- 128-bit key schedule
	component key_schedule_128 is
		port (
			rst			: 	in	std_logic;					-- reset
			clk			:	in	std_logic;					-- clock
			key_i		:	in	key_schedule_128_in_type;	-- see package key_schedule_iface
			key_o		:	out	key_schedule_128_out_type;	-- see package key_schedule_iface
			sbox_i		:	in	sbox_stage_out_type;		-- see package tech_iface
			sbox_o		:	out	sbox_stage_in_type;			-- see package tech_iface
			skm_enc_o	:	out	subkey_memory_ks_in_type;	-- see package tech_iface
			skm_dec_o	:	out	subkey_memory_ks_in_type	-- see package tech_iface
		);
	end component;


end key_schedule_iface;
