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 21

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

Line No. Rev Author Line
1 21 arif_endro
-- ------------------------------------------------------------------------
2 16 arif_endro
-- Copyright (C) 2005 Arif Endro Nugroho
3 21 arif_endro
-- All rights reserved.
4 2 arif_endro
-- 
5 21 arif_endro
-- Redistribution and use in source and binary forms, with or without
6
-- modification, are permitted provided that the following conditions
7
-- are met:
8 2 arif_endro
-- 
9 21 arif_endro
-- 1. Redistributions of source code must retain the above copyright
10
--    notice, this list of conditions and the following disclaimer.
11
-- 2. Redistributions in binary form must reproduce the above copyright
12
--    notice, this list of conditions and the following disclaimer in the
13
--    documentation and/or other materials provided with the distribution.
14
-- 3. The name of Arif Endro Nugroho may not be used to endorse or promote
15
--    products derived from this software without specific prior written
16
--    permission.
17 2 arif_endro
-- 
18 21 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
19
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
22
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
-- POSSIBILITY OF SUCH DAMAGE.
29 2 arif_endro
-- 
30 21 arif_endro
-- End Of License.
31
-- ------------------------------------------------------------------------
32 2 arif_endro
 
33
library ieee;
34
use ieee.std_logic_1164.all;
35
use ieee.std_logic_arith.all;
36
use ieee.std_logic_textio.all;
37
use std.textio.all;
38
 
39
entity output is
40
  port (
41
    clock          : in std_logic;
42 7 arif_endro
    clear          : in std_logic;
43
    load           : in std_logic;
44 2 arif_endro
    enc            : in std_logic;
45
    done           : in std_logic;
46
    test_iteration : in integer;
47 7 arif_endro
    verifier       : in std_logic_vector (007 downto 000);
48
    data_o         : in std_logic_vector (007 downto 000)
49 2 arif_endro
    );
50
end output;
51
 
52
architecture test_bench of output is
53
 
54
  file out_enc_file_ptr : text open write_mode is "ecb_tbl_result_enc.txt";
55
  file out_dec_file_ptr : text open write_mode is "ecb_tbl_result_dec.txt";
56
  signal failed         : integer := 0;
57
  signal passed         : integer := 0;
58
 
59 7 arif_endro
  type fifo16x8 is array (0 to 15) of std_logic_vector (7 downto 0);
60
 
61
  signal fifo_verifier : fifo16x8 :=
62
  (
63
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
64
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
65
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
66
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000"
67
  );
68
 
69
  signal counter : integer range 0 to 15 := 0;
70
  signal current_verifier : std_logic_vector (7 downto 0);
71
 
72 2 arif_endro
begin
73
 
74 7 arif_endro
  process(clock, clear)
75
  begin
76
  if (clear = '1') then
77
     counter <= 0;
78
  elsif (clock = '1' and clock'event) then
79
     if (done = '0') then
80
        counter <= 0;
81
     elsif (counter < 15 ) then
82
        counter <= counter + 1;
83
     else
84
        counter <= 0;
85
     end if;
86
  end if;
87
  end process;
88
 
89
  current_verifier <= fifo_verifier(counter);
90
 
91
  process(clock, clear)
92
  begin
93
  if (clear = '1') then
94
  fifo_verifier <= (others => ( others => '0'));
95
  elsif(clock = '1' and clock'event) then
96
     if (load = '1') then
97
     fifo_verifier <= (fifo_verifier (1 to 15) & verifier);
98
     end if;
99
  end if;
100
  end process;
101
 
102 2 arif_endro
  process (clock)
103
    variable out_line                     : line;
104
  begin
105
    if (clock = '1' and clock'event) then
106
      if (done = '1') then
107
        write(out_line, string'("Test ====> "));
108
        write(out_line, test_iteration);
109 7 arif_endro
        write(out_line, string'(" byte "));
110
        write(out_line, counter);
111 2 arif_endro
        if ( enc = '0') then
112
          writeline(out_enc_file_ptr, out_line);
113
        else
114
          writeline(out_dec_file_ptr, out_line);
115
        end if;
116
        write(out_line, string'("Expected : "));
117 7 arif_endro
        write(out_line, current_verifier);
118 2 arif_endro
        if ( enc = '0') then
119
          writeline(out_enc_file_ptr, out_line);
120
        else
121
          writeline(out_dec_file_ptr, out_line);
122
        end if;
123
        write(out_line, string'("Got      : "));
124
        write(out_line, data_o);
125
        if ( enc = '0') then
126
          writeline(out_enc_file_ptr, out_line);
127
        else
128
          writeline(out_dec_file_ptr, out_line);
129
        end if;
130
        write(out_line, string'("Status   : "));
131 7 arif_endro
        if (current_verifier = data_o ) then
132 2 arif_endro
          write (out_line, string'("OK"));
133
          passed <= passed + 1;
134
        else
135
          write (out_line, string'("FAILED"));
136
          failed <= failed + 1;
137
        end if;
138
        if ( enc = '0') then
139
          writeline(out_enc_file_ptr, out_line);
140
        else
141
          writeline(out_dec_file_ptr, out_line);
142
        end if;
143
 
144
      end if;
145
 
146
    end if;
147
 
148
  end process;
149
 
150
end test_bench;

powered by: WebSVN 2.1.0

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