| 1 |
2 |
arif_endro |
-- $Id: output.vhdl,v 1.1.1.1 2005-12-06 02:47:47 arif_endro Exp $
|
| 2 |
|
|
-------------------------------------------------------------------------------
|
| 3 |
|
|
-- Title : Output
|
| 4 |
|
|
-- Project : Mini AES 128
|
| 5 |
|
|
-------------------------------------------------------------------------------
|
| 6 |
|
|
-- File : output.vhdl
|
| 7 |
|
|
-- Author : "Arif E. Nugroho" <arif_endro@yahoo.com>
|
| 8 |
|
|
-- Created : 2005/12/03
|
| 9 |
|
|
-- Last update :
|
| 10 |
|
|
-- Simulators : ModelSim SE PLUS 6.0
|
| 11 |
|
|
-- Synthesizers: ISE Xilinx 6.3i
|
| 12 |
|
|
-- Target :
|
| 13 |
|
|
-------------------------------------------------------------------------------
|
| 14 |
|
|
-- Description : Output file to analize and record output of test bench.
|
| 15 |
|
|
-------------------------------------------------------------------------------
|
| 16 |
|
|
-- Copyright (C) 2005 Arif E. Nugroho
|
| 17 |
|
|
-- This VHDL design file is an open design; you can redistribute it and/or
|
| 18 |
|
|
-- modify it and/or implement it after contacting the author
|
| 19 |
|
|
-------------------------------------------------------------------------------
|
| 20 |
|
|
-------------------------------------------------------------------------------
|
| 21 |
|
|
--
|
| 22 |
|
|
-- THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
|
| 23 |
|
|
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
|
| 24 |
|
|
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
|
| 25 |
|
|
-- ASSOCIATED DISCLAIMER.
|
| 26 |
|
|
--
|
| 27 |
|
|
-------------------------------------------------------------------------------
|
| 28 |
|
|
--
|
| 29 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
| 30 |
|
|
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
| 31 |
|
|
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
| 32 |
|
|
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 33 |
|
|
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
| 34 |
|
|
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
| 35 |
|
|
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
| 36 |
|
|
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
| 37 |
|
|
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
| 38 |
|
|
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 39 |
|
|
--
|
| 40 |
|
|
-------------------------------------------------------------------------------
|
| 41 |
|
|
|
| 42 |
|
|
library ieee;
|
| 43 |
|
|
use ieee.std_logic_1164.all;
|
| 44 |
|
|
use ieee.std_logic_arith.all;
|
| 45 |
|
|
use ieee.std_logic_textio.all;
|
| 46 |
|
|
use std.textio.all;
|
| 47 |
|
|
|
| 48 |
|
|
entity output is
|
| 49 |
|
|
port (
|
| 50 |
|
|
clock : in std_logic;
|
| 51 |
|
|
enc : in std_logic;
|
| 52 |
|
|
done : in std_logic;
|
| 53 |
|
|
test_iteration : in integer;
|
| 54 |
|
|
verifier : in std_logic_vector (127 downto 000);
|
| 55 |
|
|
data_o : in std_logic_vector (127 downto 000)
|
| 56 |
|
|
);
|
| 57 |
|
|
end output;
|
| 58 |
|
|
|
| 59 |
|
|
architecture test_bench of output is
|
| 60 |
|
|
|
| 61 |
|
|
file out_enc_file_ptr : text open write_mode is "ecb_tbl_result_enc.txt";
|
| 62 |
|
|
file out_dec_file_ptr : text open write_mode is "ecb_tbl_result_dec.txt";
|
| 63 |
|
|
signal failed : integer := 0;
|
| 64 |
|
|
signal passed : integer := 0;
|
| 65 |
|
|
|
| 66 |
|
|
begin
|
| 67 |
|
|
|
| 68 |
|
|
process (clock)
|
| 69 |
|
|
variable out_line : line;
|
| 70 |
|
|
begin
|
| 71 |
|
|
if (clock = '1' and clock'event) then
|
| 72 |
|
|
if (done = '1') then
|
| 73 |
|
|
write(out_line, string'("Test ====> "));
|
| 74 |
|
|
write(out_line, test_iteration);
|
| 75 |
|
|
if ( enc = '0') then
|
| 76 |
|
|
writeline(out_enc_file_ptr, out_line);
|
| 77 |
|
|
else
|
| 78 |
|
|
writeline(out_dec_file_ptr, out_line);
|
| 79 |
|
|
end if;
|
| 80 |
|
|
write(out_line, string'("Expected : "));
|
| 81 |
|
|
write(out_line, verifier);
|
| 82 |
|
|
if ( enc = '0') then
|
| 83 |
|
|
writeline(out_enc_file_ptr, out_line);
|
| 84 |
|
|
else
|
| 85 |
|
|
writeline(out_dec_file_ptr, out_line);
|
| 86 |
|
|
end if;
|
| 87 |
|
|
write(out_line, string'("Got : "));
|
| 88 |
|
|
write(out_line, data_o);
|
| 89 |
|
|
if ( enc = '0') then
|
| 90 |
|
|
writeline(out_enc_file_ptr, out_line);
|
| 91 |
|
|
else
|
| 92 |
|
|
writeline(out_dec_file_ptr, out_line);
|
| 93 |
|
|
end if;
|
| 94 |
|
|
write(out_line, string'("Status : "));
|
| 95 |
|
|
if (verifier = data_o ) then
|
| 96 |
|
|
write (out_line, string'("OK"));
|
| 97 |
|
|
passed <= passed + 1;
|
| 98 |
|
|
else
|
| 99 |
|
|
write (out_line, string'("FAILED"));
|
| 100 |
|
|
failed <= failed + 1;
|
| 101 |
|
|
end if;
|
| 102 |
|
|
if ( enc = '0') then
|
| 103 |
|
|
writeline(out_enc_file_ptr, out_line);
|
| 104 |
|
|
else
|
| 105 |
|
|
writeline(out_dec_file_ptr, out_line);
|
| 106 |
|
|
end if;
|
| 107 |
|
|
|
| 108 |
|
|
end if;
|
| 109 |
|
|
|
| 110 |
|
|
end if;
|
| 111 |
|
|
|
| 112 |
|
|
end process;
|
| 113 |
|
|
|
| 114 |
|
|
end test_bench;
|