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

Subversion Repositories desxcore

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

powered by: WebSVN 2.1.0

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