-- ============================================================================
--
-- Design unit      :   engine_iface (interfaces of en-/decryption engines)
--
-- File Name        :   engine_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)    :   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            :   -
--
--
-- 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-15  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.tech_iface.all;


package engine_iface is


--
-- encryption engine interface definition
--


	-- data/control input signals
	type encryption_engine_in_type is record
		start	:	std_logic;			-- start encryption
		plain	:	part_data_t;		-- data to be encrypted (plaintext)
		key_id	:	key_id_t;			-- key id to use
	end record;

	-- data/status outputs signals
	type encryption_engine_out_type is record
		cipher	:	part_data_t;		-- encrypted data (ciphertext)
		busy 	:	std_logic;			-- busy, encrypion in progress
		valid	:	std_logic;			-- ciphertext is valid (encryption finished)
	end record;


--
-- decryption engine interface definition
--


	-- data/control input signals
	type decryption_engine_in_type is record
		start	:	std_logic;			-- start decryption
		cipher	:	part_data_t;		-- data to be decrypted (ciphertext)
		key_id	:	key_id_t;			-- key id to use
	end record;

	-- data/status outputs signals
	type decryption_engine_out_type is record
		plain	:	part_data_t;		-- decrypted data (plaintext)
		busy 	:	std_logic;			-- busy, decrypion in progress
		valid	:	std_logic;			-- plaintext is valid (decryption finished)
	end record;


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


	-- AES encryption engine
	component encryption_engine is
		port (
			rst		: 	in	std_logic;						-- reset
			clk		:	in	std_logic;						-- clock
			enc_i	:	in	encryption_engine_in_type;		-- see package engine_iface
			enc_o	:	out	encryption_engine_out_type;		-- see package engine_iface
			skm_i	:	in	subkey_memory_ed_out_type;		-- see package tech_iface
			skm_o	:	out	subkey_memory_ed_in_type;		-- see package tech_iface
			sbox_i	:	in	sbox_stage_out_type;			-- see package tech_iface
			sbox_o	:	out	sbox_stage_in_type				-- see package tech_iface
		);
	end component;



	-- AES decryption engine
	component decryption_engine is
		port (
			rst		: 	in	std_logic;						-- reset
			clk		:	in	std_logic;						-- clock
			dec_i	:	in	decryption_engine_in_type;		-- see package engine_iface
			dec_o	:	out	decryption_engine_out_type;		-- see package engine_iface
			skm_i	:	in	subkey_memory_ed_out_type;		-- see package tech_iface
			skm_o	:	out	subkey_memory_ed_in_type;		-- see package tech_iface
			sbox_i	:	in	sbox_stage_out_type;			-- see package tech_iface
			sbox_o	:	out	sbox_stage_in_type				-- see package tech_iface
		);
	end component;


end engine_iface;
