OpenCores
URL https://opencores.org/ocsvn/mini_aes/mini_aes/trunk

Subversion Repositories mini_aes

[/] [mini_aes/] [trunk/] [bench/] [output.vhdl] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 arif_endro
-- $Id: output.vhdl,v 1.2 2005-12-23 04:27:00 arif_endro Exp $
2 2 arif_endro
-------------------------------------------------------------------------------
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 7 arif_endro
    clear          : in std_logic;
52
    load           : in std_logic;
53 2 arif_endro
    enc            : in std_logic;
54
    done           : in std_logic;
55
    test_iteration : in integer;
56 7 arif_endro
    verifier       : in std_logic_vector (007 downto 000);
57
    data_o         : in std_logic_vector (007 downto 000)
58 2 arif_endro
    );
59
end output;
60
 
61
architecture test_bench of output is
62
 
63
  file out_enc_file_ptr : text open write_mode is "ecb_tbl_result_enc.txt";
64
  file out_dec_file_ptr : text open write_mode is "ecb_tbl_result_dec.txt";
65
  signal failed         : integer := 0;
66
  signal passed         : integer := 0;
67
 
68 7 arif_endro
  type fifo16x8 is array (0 to 15) of std_logic_vector (7 downto 0);
69
 
70
  signal fifo_verifier : fifo16x8 :=
71
  (
72
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
73
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
74
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
75
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000"
76
  );
77
 
78
  signal counter : integer range 0 to 15 := 0;
79
  signal current_verifier : std_logic_vector (7 downto 0);
80
 
81 2 arif_endro
begin
82
 
83 7 arif_endro
  process(clock, clear)
84
  begin
85
  if (clear = '1') then
86
     counter <= 0;
87
  elsif (clock = '1' and clock'event) then
88
     if (done = '0') then
89
        counter <= 0;
90
     elsif (counter < 15 ) then
91
        counter <= counter + 1;
92
     else
93
        counter <= 0;
94
     end if;
95
  end if;
96
  end process;
97
 
98
  current_verifier <= fifo_verifier(counter);
99
 
100
  process(clock, clear)
101
  begin
102
  if (clear = '1') then
103
  fifo_verifier <= (others => ( others => '0'));
104
  elsif(clock = '1' and clock'event) then
105
     if (load = '1') then
106
     fifo_verifier <= (fifo_verifier (1 to 15) & verifier);
107
     end if;
108
  end if;
109
  end process;
110
 
111 2 arif_endro
  process (clock)
112
    variable out_line                     : line;
113
  begin
114
    if (clock = '1' and clock'event) then
115
      if (done = '1') then
116
        write(out_line, string'("Test ====> "));
117
        write(out_line, test_iteration);
118 7 arif_endro
        write(out_line, string'(" byte "));
119
        write(out_line, counter);
120 2 arif_endro
        if ( enc = '0') then
121
          writeline(out_enc_file_ptr, out_line);
122
        else
123
          writeline(out_dec_file_ptr, out_line);
124
        end if;
125
        write(out_line, string'("Expected : "));
126 7 arif_endro
        write(out_line, current_verifier);
127 2 arif_endro
        if ( enc = '0') then
128
          writeline(out_enc_file_ptr, out_line);
129
        else
130
          writeline(out_dec_file_ptr, out_line);
131
        end if;
132
        write(out_line, string'("Got      : "));
133
        write(out_line, data_o);
134
        if ( enc = '0') then
135
          writeline(out_enc_file_ptr, out_line);
136
        else
137
          writeline(out_dec_file_ptr, out_line);
138
        end if;
139
        write(out_line, string'("Status   : "));
140 7 arif_endro
        if (current_verifier = data_o ) then
141 2 arif_endro
          write (out_line, string'("OK"));
142
          passed <= passed + 1;
143
        else
144
          write (out_line, string'("FAILED"));
145
          failed <= failed + 1;
146
        end if;
147
        if ( enc = '0') then
148
          writeline(out_enc_file_ptr, out_line);
149
        else
150
          writeline(out_dec_file_ptr, out_line);
151
        end if;
152
 
153
      end if;
154
 
155
    end if;
156
 
157
  end process;
158
 
159
end test_bench;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.