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

Subversion Repositories desxcore

[/] [desxcore/] [trunk/] [tb/] [tb_des_loop.vhd] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 entactogen
--------------------------------------------------------------------------------
2
-- Company: 
3
-- Engineer:
4
--
5
-- Create Date:   11:47:33 02/21/2013
6
-- Design Name:   
7
-- Module Name:   C:/Users/vmr/Desktop/crypto_ng/des/dram/desl/tb_des_loop.vhd
8
-- Project Name:  desl
9
-- Target Device:  
10
-- Tool versions:  
11
-- Description:   
12
-- 
13
-- VHDL Test Bench Created by ISE for module: des_loop
14
-- 
15
-- Dependencies:
16
-- 
17
-- Revision:
18
-- Revision 0.01 - File Created
19
-- Additional Comments:
20
--
21
-- Notes: 
22
-- This testbench has been automatically generated using types std_logic and
23
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
24
-- that these types always be used for the top-level I/O of a design in order
25
-- to guarantee that the testbench will bind correctly to the post-implementation 
26
-- simulation model.
27
--------------------------------------------------------------------------------
28
LIBRARY ieee;
29
USE ieee.std_logic_1164.ALL;
30
 
31
-- Uncomment the following library declaration if using
32
-- arithmetic functions with Signed or Unsigned values
33
--USE ieee.numeric_std.ALL;
34
 
35
ENTITY tb_des_loop IS
36
END tb_des_loop;
37
 
38
ARCHITECTURE behavior OF tb_des_loop IS
39
 
40
    -- Component Declaration for the Unit Under Test (UUT)
41
 
42
    COMPONENT des_loop
43
        port(clk :  in std_logic;
44
                  rst : in std_logic;
45
                  mode : in std_logic; -- 0 encrypt, 1 decrypt
46
                  key_in : in std_logic_vector(63 downto 0);
47
                  key_pre_w_in : in std_logic_vector(63 downto 0);
48
                  key_pos_w_in : in std_logic_vector(63 downto 0);
49
                  blk_in : in std_logic_vector(63 downto 0);
50
                  blk_out : out std_logic_vector(63 downto 0));
51
    END COMPONENT;
52
 
53
 
54
   --Inputs
55
   signal clk : std_logic := '0';
56
   signal rst : std_logic := '0';
57
   signal mode : std_logic := '0';
58
   signal key_in : std_logic_vector(63 downto 0) := (others => '0');
59
   signal blk_in : std_logic_vector(63 downto 0) := (others => '0');
60
 
61
        signal key_pre_w_in : std_logic_vector(63 downto 0);
62
        signal key_pos_w_in : std_logic_vector(63 downto 0);
63
 
64
        --Outputs
65
   signal blk_out : std_logic_vector(63 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: des_loop PORT MAP (
74
          clk => clk,
75
          rst => rst,
76
          mode => mode,
77
          key_in => key_in,
78
                         key_pre_w_in => key_pre_w_in,
79
                         key_pos_w_in => key_pos_w_in,
80
          blk_in => blk_in,
81
          blk_out => blk_out
82
        );
83
 
84
   -- Clock process definitions
85
   clk_process :process
86
   begin
87
                clk <= '0';
88
                wait for clk_period/2;
89
                clk <= '1';
90
                wait for clk_period/2;
91
   end process;
92
 
93
 
94
   -- Stimulus process
95
   stim_proc: process
96
   begin
97
                wait for clk_period/2 + clk_period;
98
                mode <= '0';
99
                blk_in <= X"4E45565251554954";
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"A937617ABB16ED28"
109
                        report "ENCRYPT ERROR" severity FAILURE;
110
 
111
                wait for clk_period;
112
 
113
                mode <= '1';
114
                blk_in <=  X"A937617ABB16ED28";
115
                key_in <=  X"4B41534849534142";
116
                key_pre_w_in <= X"F0DE87C455F0247D";
117
                key_pos_w_in <= X"BC8E72E928DFDD66";
118
                rst <= '1';
119
                wait for clk_period;
120
                rst <= '0';
121
      wait for clk_period*16;
122
 
123
                assert blk_out = X"4E45565251554954"
124
                        report "DECRYPT ERROR" severity FAILURE;
125
 
126
      wait;
127
   end process;
128
 
129
END;

powered by: WebSVN 2.1.0

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