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

Subversion Repositories deslxcore

[/] [deslxcore/] [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 3 entactogen
 
20 2 entactogen
ENTITY tb_des_loop IS
21
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(clk :  in std_logic;
29
                  rst : in std_logic;
30
                  mode : in std_logic; -- 0 encrypt, 1 decrypt
31
                  key_in : in std_logic_vector(55 downto 0);
32
                  key_pre_w_in : in std_logic_vector(63 downto 0);
33
                  key_pos_w_in : in std_logic_vector(63 downto 0);
34
                  blk_in : in std_logic_vector(63 downto 0);
35
                  blk_out : out std_logic_vector(63 downto 0));
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(55 downto 0) := (others => '0');
44
   signal blk_in : std_logic_vector(63 downto 0) := (others => '0');
45
        signal key_pre_w_in : std_logic_vector(63 downto 0);
46
        signal key_pos_w_in : std_logic_vector(63 downto 0);
47
 
48
        --Outputs
49
   signal blk_out : std_logic_vector(63 downto 0);
50
 
51
   -- Clock period definitions
52
   constant clk_period : time := 10 ns;
53
 
54
BEGIN
55
 
56
        -- Instantiate the Unit Under Test (UUT)
57
   uut: des_loop PORT MAP (
58
          clk => clk,
59
          rst => rst,
60
          mode => mode,
61
          key_in => key_in,
62
                      key_pre_w_in => key_pre_w_in,
63
                            key_pos_w_in => key_pos_w_in,
64
          blk_in => blk_in,
65
          blk_out => blk_out
66
        );
67
 
68
   -- Clock process definitions
69
   clk_process :process
70
   begin
71
                clk <= '0';
72
                wait for clk_period/2;
73
                clk <= '1';
74
                wait for clk_period/2;
75
   end process;
76
 
77
 
78
   -- Stimulus process
79
   stim_proc: process
80
   begin
81
                wait for clk_period/2 + clk_period;
82
                mode <= '0';
83
                blk_in <= X"4E45565251554954";
84
                key_in <= "00000000111111110000000000101010010100000000000110010100";
85
                key_pre_w_in <= X"F0DE87C455F0247D";
86
                key_pos_w_in <= X"BC8E72E928DFDD66";
87
                rst <= '1';
88
                wait for clk_period;
89
                rst <= '0';
90
      wait for clk_period*16;
91
 
92
                assert blk_out = X"E2EEB45D3A1B8CE4"
93
                        report "ENCRYPT ERROR" severity FAILURE;
94
 
95
                wait for clk_period;
96
 
97
                mode <= '1';
98
                blk_in <=  X"E2EEB45D3A1B8CE4";
99
                key_in <=  "00000000111111110000000000101010010100000000000110010100";
100
                key_pre_w_in <= X"F0DE87C455F0247D";
101
                key_pos_w_in <= X"BC8E72E928DFDD66";
102
                rst <= '1';
103
                wait for clk_period;
104
                rst <= '0';
105
    wait for clk_period*16;
106
 
107
                assert blk_out = X"4E45565251554954"
108
                        report "DECRYPT ERROR" severity FAILURE;
109
 
110
      wait;
111
   end process;
112
 
113
END;

powered by: WebSVN 2.1.0

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