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

Subversion Repositories present

[/] [present/] [trunk/] [DecodeTesting/] [bench/] [vhdl/] [PresentKeyGenTB.vhd] - Blame information for rev 4

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

Line No. Rev Author Line
1 4 gajos
-----------------------------------------------------------------------
2
----                                                               ----
3
---- Present - a lightweight block cipher project                  ----
4
----                                                               ----
5
---- This file is part of the Present - a lightweight block        ----
6
---- cipher project                                                ----
7
---- http://www.http://opencores.org/project,present               ----
8
----                                                               ----
9
---- Description:                                                  ----
10
----     Present key gen test bench - nothing special.             ----
11
---- To Do:                                                        ----
12
----                                                               ----
13
---- Author(s):                                                    ----
14
---- - Krzysztof Gajewski, gajos@opencores.org                     ----
15
----                       k.gajewski@gmail.com                    ----
16
----                                                               ----
17
-----------------------------------------------------------------------
18
----                                                               ----
19
---- Copyright (C) 2013 Authors and OPENCORES.ORG                  ----
20
----                                                               ----
21
---- This source file may be used and distributed without          ----
22
---- restriction provided that this copyright statement is not     ----
23
---- removed from the file and that any derivative work contains   ----
24
---- the original copyright notice and the associated disclaimer.  ----
25
----                                                               ----
26
---- This source file is free software; you can redistribute it    ----
27
---- and-or modify it under the terms of the GNU Lesser General    ----
28
---- Public License as published by the Free Software Foundation;  ----
29
---- either version 2.1 of the License, or (at your option) any    ----
30
---- later version.                                                ----
31
----                                                               ----
32
---- This source is distributed in the hope that it will be        ----
33
---- useful, but WITHOUT ANY WARRANTY; without even the implied    ----
34
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       ----
35
---- PURPOSE. See the GNU Lesser General Public License for more   ----
36
---- details.                                                      ----
37
----                                                               ----
38
---- You should have received a copy of the GNU Lesser General     ----
39
---- Public License along with this source; if not, download it    ----
40
---- from http://www.opencores.org/lgpl.shtml                      ----
41
----                                                               ----
42
-----------------------------------------------------------------------
43 3 gajos
LIBRARY ieee;
44
USE ieee.std_logic_1164.ALL;
45
 
46
-- Uncomment the following library declaration if using
47
-- arithmetic functions with Signed or Unsigned values
48
--USE ieee.numeric_std.ALL;
49
 
50
ENTITY PresentKeyGenTB IS
51
END PresentKeyGenTB;
52
 
53
ARCHITECTURE behavior OF PresentKeyGenTB IS
54
 
55
    -- Component Declaration for the Unit Under Test (UUT)
56
 
57
    COMPONENT PresentEncKeyGen
58
    PORT(
59
         key : IN  std_logic_vector(79 downto 0);
60
         key_end : OUT  std_logic_vector(79 downto 0);
61
         start : IN  std_logic;
62
         clk : IN  std_logic;
63
         reset : IN  std_logic;
64
         ready : OUT  std_logic
65
        );
66
    END COMPONENT;
67
 
68
 
69
   --Inputs
70
   signal key : std_logic_vector(79 downto 0) := (others => '0');
71
   signal start : std_logic := '0';
72
   signal clk : std_logic := '0';
73
   signal reset : std_logic := '0';
74
 
75
        --Outputs
76
   signal key_end : std_logic_vector(79 downto 0);
77
   signal ready : std_logic;
78
 
79
   -- Clock period definitions
80
   constant clk_period : time := 10 ns;
81
 
82
BEGIN
83
 
84
        -- Instantiate the Unit Under Test (UUT)
85
   uut: PresentEncKeyGen PORT MAP (
86
          key => key,
87
                         key_end => key_end,
88
          start => start,
89
          clk => clk,
90
          reset => reset,
91
          ready => ready
92
        );
93
 
94
   -- Clock process definitions
95
   clk_process :process
96
   begin
97
                clk <= '0';
98
                wait for clk_period/2;
99
                clk <= '1';
100
                wait for clk_period/2;
101
   end process;
102
 
103
 
104
   -- Stimulus process
105
   stim_proc: process
106
   begin
107
 
108
                reset <= '1';
109
      start <= '0';
110
                wait for 100 ns;
111
                reset <= '0';
112
 
113
                key <= (others => '0');
114
                start <= '1';
115
      wait for clk_period*40;
116
                start <= '0';
117
                wait for clk_period;
118
 
119
                key <= (others => '1');
120
                start <= '1';
121
      wait for clk_period*40;
122
                start <= '0';
123
                wait for clk_period;
124
 
125
                key <= (others => '0');
126
                start <= '1';
127
      wait for clk_period*40;
128
                start <= '0';
129
                wait for clk_period;
130
 
131
                key <= (others => '1');
132
                start <= '1';
133
      wait for clk_period*40;
134
                start <= '0';
135
                wait for clk_period;
136
 
137
                assert false severity failure;
138
 
139
   end process;
140
 
141
END;

powered by: WebSVN 2.1.0

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