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

Subversion Repositories descore

[/] [descore/] [trunk/] [tb/] [tb_des_loop.vhd] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 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 2 entactogen
LIBRARY ieee;
18
USE ieee.std_logic_1164.ALL;
19
 
20 3 entactogen
 ENTITY tb_des_loop IS
21 2 entactogen
END tb_des_loop;
22
 
23
ARCHITECTURE behavior OF tb_des_loop IS
24
 
25
    -- Component Declaration for the Unit Under Test (UUT)
26
 
27
    COMPONENT des_loop
28
    PORT(
29
         clk : IN  std_logic;
30
         rst : IN  std_logic;
31
         mode : IN  std_logic;
32
         key_in : IN  std_logic_vector(63 downto 0);
33
         blk_in : IN  std_logic_vector(63 downto 0);
34
         blk_out : OUT  std_logic_vector(63 downto 0)
35
        );
36
    END COMPONENT;
37
 
38
 
39
   --Inputs
40
   signal clk : std_logic := '0';
41
   signal rst : std_logic := '0';
42
   signal mode : std_logic := '0';
43
   signal key_in : std_logic_vector(63 downto 0) := (others => '0');
44
   signal blk_in : std_logic_vector(63 downto 0) := (others => '0');
45
 
46
        --Outputs
47
   signal blk_out : std_logic_vector(63 downto 0);
48
 
49
   -- Clock period definitions
50
   constant clk_period : time := 10 ns;
51
 
52
BEGIN
53
 
54
        -- Instantiate the Unit Under Test (UUT)
55
   uut: des_loop PORT MAP (
56
          clk => clk,
57
          rst => rst,
58
          mode => mode,
59
          key_in => key_in,
60
          blk_in => blk_in,
61
          blk_out => blk_out
62
        );
63
 
64
   -- Clock process definitions
65
   clk_process :process
66
   begin
67
                clk <= '0';
68
                wait for clk_period/2;
69
                clk <= '1';
70
                wait for clk_period/2;
71
   end process;
72
 
73
 
74
   -- Stimulus process
75
   stim_proc: process
76
   begin
77
                wait for clk_period/2 + clk_period;
78
                mode <= '0';
79
                blk_in <= X"4E45565251554954";
80
                key_in <= X"4B41534849534142";
81
                rst <= '1';
82
                wait for clk_period;
83
                rst <= '0';
84
      wait for clk_period*16;
85
 
86
                assert blk_out = X"763549D38B570C0E"
87
                        report "ENCRYPT ERROR" severity FAILURE;
88
 
89
                wait for clk_period;
90
 
91
                mode <= '1';
92
                blk_in <=  X"763549D38B570C0E";
93
                key_in <=  X"4B41534849534142";
94
                rst <= '1';
95
                wait for clk_period;
96
                rst <= '0';
97
      wait for clk_period*16;
98
 
99
                assert blk_out = X"4E45565251554954"
100
                        report "DECRYPT ERROR" severity FAILURE;
101
 
102
      wait;
103
   end process;
104
 
105
END;

powered by: WebSVN 2.1.0

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