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

Subversion Repositories present

[/] [present/] [trunk/] [PureTesting/] [bench/] [vhdl/] [sLayerTB.vhd] - Blame information for rev 15

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
----     Substitution layer test bench of Present encoder.         ----
11
---- Nothing special.                                              ----
12
---- To Do:                                                        ----
13
----                                                               ----
14
---- Author(s):                                                    ----
15
---- - Krzysztof Gajewski, gajos@opencores.org                     ----
16
----                       k.gajewski@gmail.com                    ----
17
----                                                               ----
18
-----------------------------------------------------------------------
19
----                                                               ----
20
---- Copyright (C) 2013 Authors and OPENCORES.ORG                  ----
21
----                                                               ----
22
---- This source file may be used and distributed without          ----
23
---- restriction provided that this copyright statement is not     ----
24
---- removed from the file and that any derivative work contains   ----
25
---- the original copyright notice and the associated disclaimer.  ----
26
----                                                               ----
27
---- This source file is free software; you can redistribute it    ----
28
---- and-or modify it under the terms of the GNU Lesser General    ----
29
---- Public License as published by the Free Software Foundation;  ----
30
---- either version 2.1 of the License, or (at your option) any    ----
31
---- later version.                                                ----
32
----                                                               ----
33
---- This source is distributed in the hope that it will be        ----
34
---- useful, but WITHOUT ANY WARRANTY; without even the implied    ----
35
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR       ----
36
---- PURPOSE. See the GNU Lesser General Public License for more   ----
37
---- details.                                                      ----
38
----                                                               ----
39
---- You should have received a copy of the GNU Lesser General     ----
40
---- Public License along with this source; if not, download it    ----
41
---- from http://www.opencores.org/lgpl.shtml                      ----
42
----                                                               ----
43
-----------------------------------------------------------------------
44 3 gajos
LIBRARY ieee;
45
USE ieee.std_logic_1164.ALL;
46
USE ieee.std_logic_unsigned.all;
47
USE ieee.numeric_std.ALL;
48
 
49
ENTITY sLayerTB IS
50
END sLayerTB;
51
 
52
ARCHITECTURE behavior OF sLayerTB IS
53
 
54
    -- Component Declaration for the Unit Under Test (UUT)
55
 
56
    COMPONENT slayer
57
    PORT(
58
         input : IN  std_logic_vector(3 downto 0);
59
         output : OUT  std_logic_vector(3 downto 0)
60
        );
61
    END COMPONENT;
62
 
63
 
64
   --Inputs
65
   signal clk : std_logic := '0';
66
   signal reset : std_logic := '0';
67
 
68
        --BiDirs
69
   signal input : std_logic_vector(3 downto 0);
70
   signal output : std_logic_vector(3 downto 0);
71
 
72
   -- Clock period definitions
73
   constant clk_period : time := 1ns;
74
 
75
BEGIN
76
 
77
        -- Instantiate the Unit Under Test (UUT)
78
   uut: slayer PORT MAP (
79
          input => input,
80
          output => output
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
      -- hold reset state for 100ms.
97
                reset <= '1';
98
      wait for 100ns;
99
                reset <= '0';
100
      wait for clk_period;
101 13 gajos
 
102
---- Preparation for test case 1 -----------------
103
--   inpput <= x"0";
104
--   expected_output <= x"";
105
--------------------------------------------------
106
 
107 3 gajos
                input <= x"0";
108
      wait for clk_period;
109 13 gajos
 
110
                if output /= x"C" then
111
                        report "RESULT MISMATCH! Test case 1 failed" severity ERROR;
112
                        assert false severity failure;
113
                else
114
                        report "Test case 1 successful" severity note;
115
                end if;
116
 
117
---- Preparation for test case 2 -----------------
118
--   inpput <= x"0";
119
--   expected_output <= x"";
120
--------------------------------------------------
121
 
122 3 gajos
                input <= x"A";
123
      wait for clk_period;
124 13 gajos
 
125
                if output /= x"F" then
126
                        report "RESULT MISMATCH! Test case 2 failed" severity ERROR;
127
                        assert false severity failure;
128
                else
129
                        report "Test case 2 successful" severity note;
130
                end if;
131
 
132
---- Preparation for test case 3 -----------------
133
--   inpput <= x"0";
134
--   expected_output <= x"";
135
--------------------------------------------------
136
 
137 3 gajos
                input <= x"F";
138
      wait for clk_period;
139 13 gajos
 
140
                if output /= x"2" then
141
                        report "RESULT MISMATCH! Test case 3 failed" severity ERROR;
142
                        assert false severity failure;
143
                else
144
                        report "Test case 3 successful" severity note;
145
                end if;
146
 
147 3 gajos
      -- insert stimulus here 
148
                assert false severity failure;
149
   end process;
150
 
151
END;

powered by: WebSVN 2.1.0

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