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 22

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 2 arif_endro
-- 
15 21 arif_endro
-- THIS SOFTWARE IS PROVIDED BY ARIF ENDRO NUGROHO "AS IS" AND ANY EXPRESS
16
-- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
-- DISCLAIMED. IN NO EVENT SHALL ARIF ENDRO NUGROHO BE LIABLE FOR ANY
19
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23
-- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
24
-- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
-- POSSIBILITY OF SUCH DAMAGE.
26 2 arif_endro
-- 
27 21 arif_endro
-- End Of License.
28
-- ------------------------------------------------------------------------
29 2 arif_endro
 
30
library ieee;
31
use ieee.std_logic_1164.all;
32
use ieee.std_logic_arith.all;
33
use ieee.std_logic_textio.all;
34
use std.textio.all;
35
 
36
entity output is
37
  port (
38
    clock          : in std_logic;
39 7 arif_endro
    clear          : in std_logic;
40
    load           : in std_logic;
41 2 arif_endro
    enc            : in std_logic;
42
    done           : in std_logic;
43
    test_iteration : in integer;
44 7 arif_endro
    verifier       : in std_logic_vector (007 downto 000);
45
    data_o         : in std_logic_vector (007 downto 000)
46 2 arif_endro
    );
47
end output;
48
 
49
architecture test_bench of output is
50
 
51
  file out_enc_file_ptr : text open write_mode is "ecb_tbl_result_enc.txt";
52
  file out_dec_file_ptr : text open write_mode is "ecb_tbl_result_dec.txt";
53
  signal failed         : integer := 0;
54
  signal passed         : integer := 0;
55
 
56 7 arif_endro
  type fifo16x8 is array (0 to 15) of std_logic_vector (7 downto 0);
57
 
58
  signal fifo_verifier : fifo16x8 :=
59
  (
60
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
61
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
62
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000",
63
   B"0000_0000", B"0000_0000", B"0000_0000", B"0000_0000"
64
  );
65
 
66
  signal counter : integer range 0 to 15 := 0;
67
  signal current_verifier : std_logic_vector (7 downto 0);
68
 
69 2 arif_endro
begin
70
 
71 7 arif_endro
  process(clock, clear)
72
  begin
73
  if (clear = '1') then
74
     counter <= 0;
75
  elsif (clock = '1' and clock'event) then
76
     if (done = '0') then
77
        counter <= 0;
78
     elsif (counter < 15 ) then
79
        counter <= counter + 1;
80
     else
81
        counter <= 0;
82
     end if;
83
  end if;
84
  end process;
85
 
86
  current_verifier <= fifo_verifier(counter);
87
 
88
  process(clock, clear)
89
  begin
90
  if (clear = '1') then
91
  fifo_verifier <= (others => ( others => '0'));
92
  elsif(clock = '1' and clock'event) then
93
     if (load = '1') then
94
     fifo_verifier <= (fifo_verifier (1 to 15) & verifier);
95
     end if;
96
  end if;
97
  end process;
98
 
99 2 arif_endro
  process (clock)
100
    variable out_line                     : line;
101
  begin
102
    if (clock = '1' and clock'event) then
103
      if (done = '1') then
104
        write(out_line, string'("Test ====> "));
105
        write(out_line, test_iteration);
106 7 arif_endro
        write(out_line, string'(" byte "));
107
        write(out_line, counter);
108 2 arif_endro
        if ( enc = '0') then
109
          writeline(out_enc_file_ptr, out_line);
110
        else
111
          writeline(out_dec_file_ptr, out_line);
112
        end if;
113
        write(out_line, string'("Expected : "));
114 7 arif_endro
        write(out_line, current_verifier);
115 2 arif_endro
        if ( enc = '0') then
116
          writeline(out_enc_file_ptr, out_line);
117
        else
118
          writeline(out_dec_file_ptr, out_line);
119
        end if;
120
        write(out_line, string'("Got      : "));
121
        write(out_line, data_o);
122
        if ( enc = '0') then
123
          writeline(out_enc_file_ptr, out_line);
124
        else
125
          writeline(out_dec_file_ptr, out_line);
126
        end if;
127
        write(out_line, string'("Status   : "));
128 7 arif_endro
        if (current_verifier = data_o ) then
129 2 arif_endro
          write (out_line, string'("OK"));
130
          passed <= passed + 1;
131
        else
132
          write (out_line, string'("FAILED"));
133
          failed <= failed + 1;
134
        end if;
135
        if ( enc = '0') then
136
          writeline(out_enc_file_ptr, out_line);
137
        else
138
          writeline(out_dec_file_ptr, out_line);
139
        end if;
140
 
141
      end if;
142
 
143
    end if;
144
 
145
  end process;
146
 
147
end test_bench;

powered by: WebSVN 2.1.0

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