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

Subversion Repositories noekeoncore

[/] [noekeoncore/] [trunk/] [tb/] [tb_noekeon.vhd] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
 
2
-- Copyright (c) 2013 Antonio de la Piedra
3
 
4
-- This program is free software: you can redistribute it and/or modify
5
-- it under the terms of the GNU General Public License as published by
6
-- the Free Software Foundation, either version 3 of the License, or
7
-- (at your option) any later version.
8
 
9
-- This program is distributed in the hope that it will be useful,
10
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
-- GNU General Public License for more details.
13
 
14
-- You should have received a copy of the GNU General Public License
15
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
LIBRARY ieee;
18
USE ieee.std_logic_1164.ALL;
19
 
20
ENTITY tb_noekeon IS
21
END tb_noekeon;
22
 
23
ARCHITECTURE behavior OF tb_noekeon IS
24
 
25
    -- Component Declaration for the Unit Under Test (UUT)
26
 
27
    COMPONENT noekeon
28
    PORT(
29
         clk : IN  std_logic;
30
         rst : IN  std_logic;
31
         enc : IN  std_logic;
32
         a_0_in : IN  std_logic_vector(31 downto 0);
33
         a_1_in : IN  std_logic_vector(31 downto 0);
34
         a_2_in : IN  std_logic_vector(31 downto 0);
35
         a_3_in : IN  std_logic_vector(31 downto 0);
36
         k_0_in : IN  std_logic_vector(31 downto 0);
37
         k_1_in : IN  std_logic_vector(31 downto 0);
38
         k_2_in : IN  std_logic_vector(31 downto 0);
39
         k_3_in : IN  std_logic_vector(31 downto 0);
40
         a_0_out : OUT  std_logic_vector(31 downto 0);
41
         a_1_out : OUT  std_logic_vector(31 downto 0);
42
         a_2_out : OUT  std_logic_vector(31 downto 0);
43
         a_3_out : OUT  std_logic_vector(31 downto 0)
44
        );
45
    END COMPONENT;
46
 
47
 
48
   --Inputs
49
   signal clk : std_logic := '0';
50
   signal rst : std_logic := '0';
51
   signal enc : std_logic := '0';
52
   signal a_0_in : std_logic_vector(31 downto 0) := (others => '0');
53
   signal a_1_in : std_logic_vector(31 downto 0) := (others => '0');
54
   signal a_2_in : std_logic_vector(31 downto 0) := (others => '0');
55
   signal a_3_in : std_logic_vector(31 downto 0) := (others => '0');
56
   signal k_0_in : std_logic_vector(31 downto 0) := (others => '0');
57
   signal k_1_in : std_logic_vector(31 downto 0) := (others => '0');
58
   signal k_2_in : std_logic_vector(31 downto 0) := (others => '0');
59
   signal k_3_in : std_logic_vector(31 downto 0) := (others => '0');
60
 
61
        --Outputs
62
   signal a_0_out : std_logic_vector(31 downto 0);
63
   signal a_1_out : std_logic_vector(31 downto 0);
64
   signal a_2_out : std_logic_vector(31 downto 0);
65
   signal a_3_out : std_logic_vector(31 downto 0);
66
 
67
   -- Clock period definitions
68
   constant clk_period : time := 10 ns;
69
 
70
BEGIN
71
 
72
        -- Instantiate the Unit Under Test (UUT)
73
   uut: noekeon PORT MAP (
74
          clk => clk,
75
          rst => rst,
76
          enc => enc,
77
          a_0_in => a_0_in,
78
          a_1_in => a_1_in,
79
          a_2_in => a_2_in,
80
          a_3_in => a_3_in,
81
          k_0_in => k_0_in,
82
          k_1_in => k_1_in,
83
          k_2_in => k_2_in,
84
          k_3_in => k_3_in,
85
          a_0_out => a_0_out,
86
          a_1_out => a_1_out,
87
          a_2_out => a_2_out,
88
          a_3_out => a_3_out
89
        );
90
 
91
   -- Clock process definitions
92
   clk_process :process
93
   begin
94
                clk <= '0';
95
                wait for clk_period/2;
96
                clk <= '1';
97
                wait for clk_period/2;
98
   end process;
99
 
100
 
101
   -- Stimulus process
102
   stim_proc: process
103
   begin
104
                wait for clk_period/2 + clk_period;
105
                rst <= '1';
106
                enc <= '0';
107
 
108
                a_0_in <= X"2a78421b";
109
                a_1_in <= X"87c7d092";
110
                a_2_in <= X"4f26113f";
111
                a_3_in <= X"1d1349b2";
112
 
113
                k_0_in <= X"b1656851";
114
                k_1_in <= X"699e29fa";
115
                k_2_in <= X"24b70148";
116
                k_3_in <= X"503d2dfc";
117
 
118
                wait for clk_period;
119
                rst <= '0';
120
 
121
                wait for clk_period*15 + clk_period/2;
122
 
123
      assert a_0_out = X"e2f687e0"
124
                        report "ENCRYPT ERROR (a_0)" severity FAILURE;
125
 
126
      assert a_1_out = X"7b75660f"
127
                        report "ENCRYPT ERROR (a_1)" severity FAILURE;
128
 
129
      assert a_2_out = X"fc372233"
130
                        report "ENCRYPT ERROR (a_2)" severity FAILURE;
131
 
132
      assert a_3_out = X"bc47532c"
133
                        report "ENCRYPT ERROR (a_3)" severity FAILURE;
134
 
135
                wait for clk_period + clk_period/2;
136
                rst <= '1';
137
                enc <= '1';
138
 
139
                a_0_in <= X"e2f687e0";
140
                a_1_in <= X"7b75660f";
141
                a_2_in <= X"fc372233";
142
                a_3_in <= X"bc47532c";
143
 
144
                k_0_in <= X"b1656851";
145
                k_1_in <= X"699e29fa";
146
                k_2_in <= X"24b70148";
147
                k_3_in <= X"503d2dfc";
148
 
149
                wait for clk_period;
150
                rst <= '0';
151
 
152
                wait for clk_period*15 + clk_period/2;
153
 
154
      assert a_0_out = X"2a78421b"
155
                        report "DECRYPT ERROR (a_0)" severity FAILURE;
156
 
157
      assert a_1_out = X"87c7d092"
158
                        report "DECRYPT ERROR (a_1)" severity FAILURE;
159
 
160
      assert a_2_out = X"4f26113f"
161
                        report "DECRYPT ERROR (a_2)" severity FAILURE;
162
 
163
      assert a_3_out = X"1d1349b2"
164
                        report "DECRYPT ERROR (a_3)" severity FAILURE;
165
 
166
      wait;
167
   end process;
168
 
169
END;

powered by: WebSVN 2.1.0

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