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

Subversion Repositories deslxcore

[/] [deslxcore/] [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(55 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(55 downto 0) := (others => '0');
59
   signal blk_in : std_logic_vector(63 downto 0) := (others => '0');
60
        signal key_pre_w_in : std_logic_vector(63 downto 0);
61
        signal key_pos_w_in : std_logic_vector(63 downto 0);
62
 
63
        --Outputs
64
   signal blk_out : std_logic_vector(63 downto 0);
65
 
66
   -- Clock period definitions
67
   constant clk_period : time := 10 ns;
68
 
69
BEGIN
70
 
71
        -- Instantiate the Unit Under Test (UUT)
72
   uut: des_loop PORT MAP (
73
          clk => clk,
74
          rst => rst,
75
          mode => mode,
76
          key_in => key_in,
77
                      key_pre_w_in => key_pre_w_in,
78
                            key_pos_w_in => key_pos_w_in,
79
          blk_in => blk_in,
80
          blk_out => blk_out
81
        );
82
 
83
   -- Clock process definitions
84
   clk_process :process
85
   begin
86
                clk <= '0';
87
                wait for clk_period/2;
88
                clk <= '1';
89
                wait for clk_period/2;
90
   end process;
91
 
92
 
93
   -- Stimulus process
94
   stim_proc: process
95
   begin
96
                wait for clk_period/2 + clk_period;
97
                mode <= '0';
98
                blk_in <= X"4E45565251554954";
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"E2EEB45D3A1B8CE4"
108
                        report "ENCRYPT ERROR" severity FAILURE;
109
 
110
                wait for clk_period;
111
 
112
                mode <= '1';
113
                blk_in <=  X"E2EEB45D3A1B8CE4";
114
                key_in <=  "00000000111111110000000000101010010100000000000110010100";
115
                key_pre_w_in <= X"F0DE87C455F0247D";
116
                key_pos_w_in <= X"BC8E72E928DFDD66";
117
                rst <= '1';
118
                wait for clk_period;
119
                rst <= '0';
120
    wait for clk_period*16;
121
 
122
                assert blk_out = X"4E45565251554954"
123
                        report "DECRYPT ERROR" severity FAILURE;
124
 
125
      wait;
126
   end process;
127
 
128
END;

powered by: WebSVN 2.1.0

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