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

Subversion Repositories deslcore

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

powered by: WebSVN 2.1.0

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