head	1.3;
access;
symbols;
locks; strict;
comment	@# @;


1.3
date	2008.04.08.13.39.05;	author pfulgoni;	state Exp;
branches;
next	1.2;
commitid	1b5b47fb75784567;

1.2
date	2008.03.31.14.44.08;	author pfulgoni;	state Exp;
branches;
next	1.1;
commitid	6ca347f0f8b44567;

1.1
date	2008.03.25.17.24.42;	author pfulgoni;	state Exp;
branches;
next	;
commitid	33ab47e935534567;


desc
@@


1.3
log
@some bugs removed
@
text
@
--------------------------------------------------------------------------------
-- Designer:      Paolo Fulgoni <pfulgoni@@opencores.org>
--
-- Create Date:   02/19/2008
-- Last Update:   04/02/2008
-- Project Name:  camellia-vhdl
-- Description:   VHDL Test Bench for module camellia
--
-- Copyright (C) 2008  Paolo Fulgoni
-- This file is part of camellia-vhdl.
-- camellia-vhdl is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
-- camellia-vhdl is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
--
-- The Camellia cipher algorithm is 128 bit cipher developed by NTT and
-- Mitsubishi Electric researchers.
-- http://info.isl.ntt.co.jp/crypt/eng/camellia/
--------------------------------------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;

entity camellia_tb is

end camellia_tb;

architecture RTL of camellia_tb is

    component camellia is
        port    (
                clk        : in  STD_LOGIC;
                reset      : in  STD_LOGIC;
                data_in    : in  STD_LOGIC_VECTOR (0 to 127);
                enc_dec    : in  STD_LOGIC;
                data_rdy   : in  STD_LOGIC;
                data_acq   : out STD_LOGIC;
                key        : in  STD_LOGIC_VECTOR (0 to 255);
                k_len      : in  STD_LOGIC_VECTOR (0 to 1);
                key_rdy    : in  STD_LOGIC;
                key_acq    : out STD_LOGIC;
                data_out   : out STD_LOGIC_VECTOR (0 to 127);
                output_rdy : out STD_LOGIC
                );
    end component;

    signal    clk        :  STD_LOGIC;
    signal    reset      :  STD_LOGIC;
    signal    data_in    :  STD_LOGIC_VECTOR (0 to 127);
    signal    enc_dec    :  STD_LOGIC;
    signal    data_rdy   :  STD_LOGIC;
    signal    data_acq   :  STD_LOGIC;
    signal    key        :  STD_LOGIC_VECTOR (0 to 255);
    signal    k_len      :  STD_LOGIC_VECTOR (0 to 1);
    signal    key_rdy    :  STD_LOGIC;
    signal    key_acq    :  STD_LOGIC;
    signal    data_out   :  STD_LOGIC_VECTOR (0 to 127);
    signal    output_rdy :  STD_LOGIC;

    -- constants
    constant KLEN_128    : STD_LOGIC_VECTOR (0 to 1) := "00";
    constant KLEN_192    : STD_LOGIC_VECTOR (0 to 1) := "01";
    constant KLEN_256    : STD_LOGIC_VECTOR (0 to 1) := "10";
    constant ENC         : STD_LOGIC := '0';
    constant DEC         : STD_LOGIC := '1';
    constant CLK_PERIOD  : TIME := 100 ns;

begin

    uut   : camellia
        port map(clk, reset, data_in, enc_dec, data_rdy, data_acq,
                 key, k_len, key_rdy, key_acq, data_out, output_rdy);

    tb    : process
    begin
        reset <= '1';
        wait for 80 ns;
        reset <= '0';
        wait until clk = '1';
        
        data_in   <= X"0123456789abcdeffedcba9876543210";
        enc_dec   <= ENC;
        data_rdy  <= '1';
        key       <= X"0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff";
        k_len     <= KLEN_128;
        key_rdy   <= '1';
        
        wait until key_acq = '1';
        key_rdy   <= '0';
        
        wait until data_acq = '1';
        data_in   <= X"67673138549669730857065648eabe43";
        enc_dec   <= DEC;
        
        wait until data_acq = '1';
        data_in   <= X"0123456789abcdeffedcba9876543210";
        enc_dec   <= ENC;
        data_rdy  <= '1';
        key       <= X"0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff";
        k_len     <= KLEN_192;
        key_rdy   <= '1';
        
        wait until key_acq = '1';
        key_rdy   <= '0';
        
        wait until data_acq = '1';
        data_rdy  <= '0';
        
        
        wait;
    end process;

    clk_gen  : process
    begin
        clk <= '0';
        wait for CLK_PERIOD / 2;
        clk <= '1';
        wait for CLK_PERIOD / 2;
    end process;

end RTL;
@


1.2
log
@Modified the interface of the core, some bug correction, added a serial interface (16bit chunks)
@
text
@d6 1
a6 1
-- Last Update:   03/28/2008
d72 1
a72 1
    constant CLK_PERIOD  : TIME := 20 ns;
d83 1
a83 1
        wait for 15 ns;
d85 1
d101 15
@


1.1
log
@Added the looping version
@
text
@d6 1
a6 1
-- Last Update:   03/06/2008
d41 3
d46 4
a49 4
                new_key    : in  STD_LOGIC;
                enc_dec    : in  STD_LOGIC;
                input_rdy  : in  STD_LOGIC;
                data_out   : out STD_LOGIC_VECTOR (0 to 127)
d56 3
d61 2
a62 3
    signal    new_key    :  STD_LOGIC;
    signal    enc_dec    :  STD_LOGIC;
    signal    input_rdy  :  STD_LOGIC;
d64 1
d77 2
a78 2
        port map(clk, reset, data_in, key, k_len, new_key,
                 enc_dec, input_rdy, data_out);
d85 1
d87 2
d91 6
a96 4
        new_key   <= '1';
        enc_dec   <= '0';
        input_rdy <= '1';
        wait for 494 ns;
d98 2
a99 5
        key       <= X"0123456789abcdeffedcba987654321000112233445566778899aabbccddeeff";
        k_len     <= KLEN_128;
        new_key   <= '0';
        enc_dec   <= '1';
        input_rdy <= '1';
@

